Chromium Code Reviews| Index: content/browser/frame_host/render_frame_host_impl.cc |
| diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc |
| index c8b5dcc9fbd8a11090cd2d404fdbcc9cc96cc1bd..3a9303bc76b79f91f78647c8d3779e0a450340c4 100644 |
| --- a/content/browser/frame_host/render_frame_host_impl.cc |
| +++ b/content/browser/frame_host/render_frame_host_impl.cc |
| @@ -2388,14 +2388,26 @@ void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation, |
| // handler. |
| is_waiting_for_beforeunload_ack_ = true; |
| unload_ack_is_for_navigation_ = for_navigation; |
| - // Increment the in-flight event count, to ensure that input events won't |
| - // cancel the timeout timer. |
| - render_view_host_->GetWidget()->increment_in_flight_event_count(); |
| - render_view_host_->GetWidget()->StartHangMonitorTimeout( |
| - TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS), |
| - RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_BEFORE_UNLOAD); |
| - send_before_unload_start_time_ = base::TimeTicks::Now(); |
| - Send(new FrameMsg_BeforeUnload(routing_id_, is_reload)); |
| + if (delegate_->IsJavaScriptDialogShowing()) { |
| + // If there is a JavaScript dialog up, don't bother sending the renderer |
| + // the unload event because it is known unresponsive, waiting for the |
| + // reply from the dialog. Instead, force the page to be in "waiting for |
| + // unload ack", and tell the widget's delegate that the renderer is |
| + // unresponsive. That will let the page close immediately. |
| + render_view_host_->is_waiting_for_close_ack_ = true; |
| + render_view_host_->GetWidget()->delegate()->RendererUnresponsive( |
| + render_view_host_->GetWidget(), |
| + RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_DIALOG_SHOWING); |
|
Charlie Reis
2016/10/07 22:44:23
Could we call OnBeforeUnloadACK(true, ...) here in
Avi (use Gerrit)
2016/10/08 00:13:19
I was hoping to run past both issues with one call
|
| + } else { |
| + // Increment the in-flight event count, to ensure that input events won't |
| + // cancel the timeout timer. |
| + render_view_host_->GetWidget()->increment_in_flight_event_count(); |
| + render_view_host_->GetWidget()->StartHangMonitorTimeout( |
| + TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS), |
| + RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_BEFORE_UNLOAD); |
| + send_before_unload_start_time_ = base::TimeTicks::Now(); |
| + Send(new FrameMsg_BeforeUnload(routing_id_, is_reload)); |
| + } |
| } |
| } |