fix: use crashpad on Windows (#18483)

* Initial changes to use crashpad for windows

* Remove crashpad patch

* Report error when failed to connect pipe

* Allow crashpad to communicate with named pipe

* Add patch to make crashpad named pipe work

* Windows also needs crashReporter on main process

* Call SetUnhandledExceptionFilter in node process

Node can also use crash reporter.

* Do not treat node process as browser process

* No more need to manually start crash service

* Use base::StringPrintf for better readbility

* Print error when pipe name not available

* Make sure pipe name is updated

Note that the crashpad may be started after renderer process gets
created.

* Fix some tests

* Update node

* Exclude crashpad files on Linux and MAS

* Fix lint warning

* Remove unused checks

* kCrashpadPipeName is only available on Windows

* Fix uploadToServer tests

* Fix extra params tests

* Fix getCrashesDirectory tests

* Run crashReporter tests on CI

* Style fixes

* Update crashreporter docs

* Rename InitBreakpad to Init

* Add comment for process_type_.empty() and UTF16ToASCII to UTF16ToUTF8.

* Update build.gn include crashpad headers

* Address comment https://github.com/electron/electron/pull/18483#discussion_r290887898

* Avoid using api::WebContents

* Put kRunAsNode in atom_constants

* Remove duplicate settings on upload params

* Fix building on macOS

* Update description for crashpad_pid_check.patch
This commit is contained in:
Nitish Sakhawalkar 2019-06-12 23:42:21 -07:00 committed by Cheng Zhao
parent ddec3c0e78
commit f98454e5dd
39 changed files with 561 additions and 812 deletions

View file

@ -81,6 +81,10 @@
#include "ui/base/resource/resource_bundle.h"
#include "v8/include/v8.h"
#if defined(OS_WIN)
#include "sandbox/win/src/sandbox_policy.h"
#endif
#if defined(USE_NSS_CERTS)
#include "net/ssl/client_cert_store_nss.h"
#elif defined(OS_WIN)
@ -961,6 +965,18 @@ bool AtomBrowserClient::WillCreateURLLoaderFactory(
return true;
}
#if defined(OS_WIN)
bool AtomBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy) {
// Allow crashpad to communicate via named pipe.
sandbox::ResultCode result = policy->AddRule(
sandbox::TargetPolicy::SUBSYS_FILES,
sandbox::TargetPolicy::FILES_ALLOW_ANY, L"\\??\\pipe\\crashpad_*");
if (result != sandbox::SBOX_ALL_OK)
return false;
return true;
}
#endif // defined(OS_WIN)
std::string AtomBrowserClient::GetApplicationLocale() {
if (BrowserThread::CurrentlyOn(BrowserThread::IO))
return g_io_thread_application_locale.Get();