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:
parent
ddec3c0e78
commit
f98454e5dd
39 changed files with 561 additions and 812 deletions
38
patches/chromium/crashpad_pid_check.patch
Normal file
38
patches/chromium/crashpad_pid_check.patch
Normal file
|
@ -0,0 +1,38 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cheng Zhao <zcbenz@gmail.com>
|
||||
Date: Tue Jun 4 11:30:12 JST 2019
|
||||
Subject: crashpad_pid_check.patch
|
||||
|
||||
When both browser process and renderer process are connecting to the pipe,
|
||||
the API may return the PID of browser process as real_pid, which is different
|
||||
from the PID of renderer process.
|
||||
|
||||
This is caused by the crashReporter getting started after the sanbox, after
|
||||
we redesign crashReporter's API to make it alwasy start before the
|
||||
sanbox, we can remove this patch.
|
||||
|
||||
See following links for more:
|
||||
https://github.com/electron/electron/pull/18483#discussion_r292703588
|
||||
https://github.com/electron/electron/pull/18483#issuecomment-501090683
|
||||
|
||||
diff --git a/third_party/crashpad/crashpad/util/win/exception_handler_server.cc b/third_party/crashpad/crashpad/util/win/exception_handler_server.cc
|
||||
index 2593ff2de032..e89b8ff675be 100644
|
||||
--- a/third_party/crashpad/crashpad/util/win/exception_handler_server.cc
|
||||
+++ b/third_party/crashpad/crashpad/util/win/exception_handler_server.cc
|
||||
@@ -448,9 +448,16 @@ bool ExceptionHandlerServer::ServiceClientConnection(
|
||||
DWORD real_pid = 0;
|
||||
if (get_named_pipe_client_process_id(service_context.pipe(), &real_pid) &&
|
||||
message.registration.client_process_id != real_pid) {
|
||||
+ // Electron: When both browser process and renderer process are connecting
|
||||
+ // to the pipe, the API may return the PID of browser process as real_pid,
|
||||
+ // which is different from the PID of renderer process.
|
||||
+ //
|
||||
+ // I don't understand why Chromium does not have this issue.
|
||||
+#if 0
|
||||
LOG(ERROR) << "forged client pid, real pid: " << real_pid
|
||||
<< ", got: " << message.registration.client_process_id;
|
||||
return false;
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue