| Index: chrome/browser/renderer_host/render_view_host.cc
|
| diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
|
| index 143bc1a7f099741711d9f2e8f2a2182b2affed7c..708e77a4b75fe3d1043c7655806159b97fdd64a5 100644
|
| --- a/chrome/browser/renderer_host/render_view_host.cc
|
| +++ b/chrome/browser/renderer_host/render_view_host.cc
|
| @@ -594,18 +594,21 @@ void RenderViewHost::JavaScriptMessageBoxClosed(IPC::Message* reply_msg,
|
| process()->set_ignore_input_events(false);
|
| bool is_waiting =
|
| is_waiting_for_beforeunload_ack_ || is_waiting_for_unload_ack_;
|
| - if (is_waiting) {
|
| - if (are_javascript_messages_suppressed_) {
|
| - delegate_->RendererUnresponsive(this, is_waiting);
|
| - return;
|
| - }
|
| -
|
| + if (is_waiting)
|
| StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS));
|
| - }
|
|
|
| ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg,
|
| success, prompt);
|
| Send(reply_msg);
|
| +
|
| + // If we are waiting for an unload or beforeunload ack and the user has
|
| + // suppressed messages, kill the tab immediately; a page that's spamming
|
| + // alerts in onbeforeunload is presumably malicious, so there's no point in
|
| + // continuing to run its script and dragging out the process.
|
| + // This must be done after sending the reply since RenderView can't close
|
| + // correctly while waiting for a response.
|
| + if (is_waiting && are_javascript_messages_suppressed_)
|
| + delegate_->RendererUnresponsive(this, is_waiting);
|
| }
|
|
|
| void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg,
|
|
|