Index: headless/app/headless_shell.cc |
diff --git a/headless/app/headless_shell.cc b/headless/app/headless_shell.cc |
index b57fc5f9070de1e36aa9bfb743c76945ef53ca64..6f291a6cd6b9f8a71cc852e80644bcd69aec76a3 100644 |
--- a/headless/app/headless_shell.cc |
+++ b/headless/app/headless_shell.cc |
@@ -119,7 +119,10 @@ class HeadlessShell : public HeadlessWebContents::Observer, |
if (!RemoteDebuggingEnabled()) { |
devtools_client_->GetEmulation()->GetExperimental()->RemoveObserver(this); |
devtools_client_->GetPage()->RemoveObserver(this); |
- web_contents_->GetDevToolsTarget()->DetachClient(devtools_client_.get()); |
+ if (web_contents_->GetDevToolsTarget()) { |
+ web_contents_->GetDevToolsTarget()->DetachClient( |
+ devtools_client_.get()); |
+ } |
} |
web_contents_->RemoveObserver(this); |
web_contents_ = nullptr; |
@@ -159,6 +162,15 @@ class HeadlessShell : public HeadlessWebContents::Observer, |
// TODO(skyostil): Implement more features to demonstrate the devtools API. |
} |
+ void RenderProcessExited(base::TerminationStatus status, |
+ int exit_code) override { |
+ if (status == base::TERMINATION_STATUS_NORMAL_TERMINATION) |
+ return; |
+ |
+ LOG(ERROR) << "Abnormal renderer termination."; |
+ Shutdown(); |
+ } |
+ |
void PollReadyState() { |
// We need to check the current location in addition to the ready state to |
// be sure the expected page is ready. |