From 28599e5e7cf48462bc6b14194fb9fc066d0dcded Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Mon, 8 Feb 2021 17:08:11 -0800 Subject: [PATCH] feat: add exit code to render-process-gone details (#27580) --- docs/api/app.md | 3 +++ docs/api/web-contents.md | 3 +++ shell/browser/api/electron_api_web_contents.cc | 1 + 3 files changed, 7 insertions(+) diff --git a/docs/api/app.md b/docs/api/app.md index 77aaaffa8ef3..28e25bc6f149 100755 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -406,6 +406,9 @@ Returns: * `oom` - Process ran out of memory * `launch-failed` - Process never successfully launched * `integrity-failure` - Windows code integrity checks failed + * `exitCode` Integer - The exit code of the process, unless `reason` is + `launch-failed`, in which case `exitCode` will be a platform-specific + launch failure error code. Emitted when the renderer process unexpectedly disappears. This is normally because it was crashed or killed. diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index 7e23a6c17f8a..43a799836ed7 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -403,6 +403,9 @@ Returns: * `oom` - Process ran out of memory * `launch-failed` - Process never successfully launched * `integrity-failure` - Windows code integrity checks failed + * `exitCode` Integer - The exit code of the process, unless `reason` is + `launch-failed`, in which case `exitCode` will be a platform-specific + launch failure error code. Emitted when the renderer process unexpectedly disappears. This is normally because it was crashed or killed. diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 58f94e536a0f..b06ea2e803fb 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -1396,6 +1396,7 @@ void WebContents::RenderProcessGone(base::TerminationStatus status) { v8::HandleScope handle_scope(isolate); gin_helper::Dictionary details = gin_helper::Dictionary::CreateEmpty(isolate); details.Set("reason", status); + details.Set("exitCode", web_contents()->GetCrashedErrorCode()); Emit("render-process-gone", details); }