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)
|
|
@ -236,14 +236,6 @@ void ElectronApiServiceImpl::DereferenceRemoteJSCallback(
|
|||
}
|
||||
#endif
|
||||
|
||||
void ElectronApiServiceImpl::UpdateCrashpadPipeName(
|
||||
const std::string& pipe_name) {
|
||||
#if defined(OS_WIN)
|
||||
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
||||
env->SetVar(kCrashpadPipeName, pipe_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ElectronApiServiceImpl::TakeHeapSnapshot(
|
||||
mojo::ScopedHandle file,
|
||||
TakeHeapSnapshotCallback callback) {
|
||||
|
|
|
@ -39,7 +39,6 @@ class ElectronApiServiceImpl : public mojom::ElectronRenderer,
|
|||
void DereferenceRemoteJSCallback(const std::string& context_id,
|
||||
int32_t object_id) override;
|
||||
#endif
|
||||
void UpdateCrashpadPipeName(const std::string& pipe_name) override;
|
||||
void TakeHeapSnapshot(mojo::ScopedHandle file,
|
||||
TakeHeapSnapshotCallback callback) override;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue