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 c8cc6470d22ab8354ec7efc73f3fe424d35e1d55..d35505afa73f26f3bc13c180b6d9edd38d0f2adb 100644 |
| --- a/content/browser/frame_host/render_frame_host_impl.cc |
| +++ b/content/browser/frame_host/render_frame_host_impl.cc |
| @@ -1681,8 +1681,9 @@ void RenderFrameHostImpl::Stop() { |
| void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation) { |
| // TODO(creis): Support beforeunload on subframes. For now just pretend that |
| // the handler ran and allowed the navigation to proceed. |
| - if (GetParent() || !IsRenderFrameLive()) { |
| - // We don't have a live renderer, so just skip running beforeunload. |
| + if (!ShouldDispatchBeforeUnload()) { |
| + // We don't have a live renderer or are on a subframe, so just skip running |
|
clamy
2015/06/09 16:01:30
If changing the comment, rephrase so that it does
carlosk
2015/06/10 11:53:09
Done.
|
| + // beforeunload. |
| if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
|
clamy
2015/06/09 16:07:44
Now that I think about it, we should never end up
carlosk
2015/06/10 11:53:09
Done.
|
| switches::kEnableBrowserSideNavigation)) { |
| frame_tree_node_->navigator()->OnBeforeUnloadACK( |
| @@ -1723,6 +1724,10 @@ void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation) { |
| } |
| } |
| +bool RenderFrameHostImpl::ShouldDispatchBeforeUnload() { |
|
clamy
2015/06/09 16:01:30
I think you may copy the TODO(creis): Support befo
carlosk
2015/06/10 11:53:09
Done.
|
| + return !GetParent() && IsRenderFrameLive(); |
| +} |
| + |
| void RenderFrameHostImpl::DisownOpener() { |
| Send(new FrameMsg_DisownOpener(GetRoutingID())); |
| } |