Chromium Code Reviews| Index: content/browser/web_contents/web_contents_impl.cc |
| diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
| index 3362cc1b63417be749ef6832eabd73c03b175083..de81e78ca4183958deda34669c159a9a4a5fcbde 100644 |
| --- a/content/browser/web_contents/web_contents_impl.cc |
| +++ b/content/browser/web_contents/web_contents_impl.cc |
| @@ -4553,8 +4553,16 @@ void WebContentsImpl::RendererUnresponsive( |
| if (DevToolsAgentHost::IsDebuggerAttached(this)) |
| return; |
| - if (rfhi->is_waiting_for_beforeunload_ack() || |
| - rfhi->IsWaitingForUnloadACK()) { |
| + if (rfhi->is_waiting_for_beforeunload_ack()) { |
| + // If the hang is in the beforeunload handler, |
|
Charlie Reis
2016/05/19 22:11:56
nit: Fix line wrap.
|
| + // pretend the beforeunload listeners have all fired and allow the delegate |
| + // to continue closing; the user will not have the option of cancelling the |
| + // close. |
| + rfhi->ForceBeforeUnloadAck(); |
| + return; |
| + } |
| + |
| + if (rfhi->IsWaitingForUnloadACK()) { |
| // Hang occurred while firing the beforeunload/unload handler. |
|
Charlie Reis
2016/05/19 22:11:56
nit: Drop "beforeunload/"
|
| // Pretend the handler fired so tab closing continues as if it had. |
| GetRenderViewHost()->set_sudden_termination_allowed(true); |
| @@ -4562,18 +4570,10 @@ void WebContentsImpl::RendererUnresponsive( |
| if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer()) |
| return; |
| - // If the tab hangs in the beforeunload/unload handler there's really |
| - // nothing we can do to recover. If the hang is in the beforeunload handler, |
| - // pretend the beforeunload listeners have all fired and allow the delegate |
| - // to continue closing; the user will not have the option of cancelling the |
| - // close. Otherwise, pretend the unload listeners have all fired and close |
| + // If the tab hangs in the unload handler there's really nothing we can do |
| + // to recover. Pretend the unload listeners have all fired and close |
| // the tab. |
| - bool close = true; |
| - if (rfhi->is_waiting_for_beforeunload_ack() && delegate_) { |
| - delegate_->BeforeUnloadFired(this, true, &close); |
| - } |
| - if (close) |
| - Close(); |
| + Close(); |
| return; |
| } |