fix: crashReporter incompatible with sandbox on Linux (#23265)
This commit is contained in:
parent
fc434f136b
commit
06bf0d08dc
77 changed files with 2235 additions and 2404 deletions
42
shell/renderer/api/electron_api_crash_reporter_renderer.cc
Normal file
42
shell/renderer/api/electron_api_crash_reporter_renderer.cc
Normal file
|
@ -0,0 +1,42 @@
|
|||
// Copyright (c) 2020 Slack Technologies, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "shell/common/crash_keys.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
namespace {
|
||||
|
||||
v8::Local<v8::Value> GetParameters(v8::Isolate* isolate) {
|
||||
std::map<std::string, std::string> keys;
|
||||
#if !defined(MAS_BUILD)
|
||||
electron::crash_keys::GetCrashKeys(&keys);
|
||||
#endif
|
||||
return gin::ConvertToV8(isolate, keys);
|
||||
}
|
||||
|
||||
#if defined(MAS_BUILD)
|
||||
void SetCrashKeyStub(const std::string& key, const std::string& value) {}
|
||||
void ClearCrashKeyStub(const std::string& key) {}
|
||||
#endif
|
||||
|
||||
void Initialize(v8::Local<v8::Object> exports,
|
||||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
||||
#if defined(MAS_BUILD)
|
||||
dict.SetMethod("addExtraParameter", &SetCrashKeyStub);
|
||||
dict.SetMethod("removeExtraParameter", &ClearCrashKeyStub);
|
||||
#else
|
||||
dict.SetMethod("addExtraParameter", &electron::crash_keys::SetCrashKey);
|
||||
dict.SetMethod("removeExtraParameter", &electron::crash_keys::ClearCrashKey);
|
||||
#endif
|
||||
dict.SetMethod("getParameters", &GetParameters);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(electron_renderer_crash_reporter, Initialize)
|
Loading…
Add table
Add a link
Reference in a new issue