| Index: content/renderer/render_frame_impl.cc
|
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
| index 8994b8d093f887cd8d38540fc01250776adc17f6..cb15dcad42600a890ed2a2f22da489d90424c264 100644
|
| --- a/content/renderer/render_frame_impl.cc
|
| +++ b/content/renderer/render_frame_impl.cc
|
| @@ -1516,7 +1516,9 @@ void RenderFrameImpl::OnBeforeUnload() {
|
| CHECK(!frame_->parent());
|
|
|
| base::TimeTicks before_unload_start_time = base::TimeTicks::Now();
|
| - bool proceed = frame_->dispatchBeforeUnloadEvent();
|
| + bool proceed;
|
| + if (!frame_->dispatchBeforeUnloadEvent(&proceed))
|
| + return;
|
| base::TimeTicks before_unload_end_time = base::TimeTicks::Now();
|
| Send(new FrameHostMsg_BeforeUnload_ACK(routing_id_, proceed,
|
| before_unload_start_time,
|
| @@ -4852,6 +4854,17 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
|
| return blink::WebNavigationPolicyIgnore;
|
| }
|
|
|
| + // Execute the BeforeUnload event. If asked not to proceed or the frame is
|
| + // destroyed, ignore the navigation.
|
| + bool proceed = false;
|
| + if (!IsBrowserSideNavigationEnabled() ||
|
| + info.urlRequest.checkForBrowserSideNavigation()) {
|
| + // PlzNavigate: this is not executed when commiting the navigation.
|
| + if (!frame_->dispatchBeforeUnloadEvent(&proceed) || !proceed) {
|
| + return blink::WebNavigationPolicyIgnore;
|
| + }
|
| + }
|
| +
|
| // PlzNavigate: if the navigation is not synchronous, send it to the browser.
|
| // This includes navigations with no request being sent to the network stack.
|
| if (IsBrowserSideNavigationEnabled() &&
|
| @@ -5603,7 +5616,6 @@ void RenderFrameImpl::BeginNavigation(blink::WebURLRequest* request,
|
| bool is_client_redirect) {
|
| CHECK(IsBrowserSideNavigationEnabled());
|
| DCHECK(request);
|
| - // TODO(clamy): Execute the beforeunload event.
|
|
|
| // Note: At this stage, the goal is to apply all the modifications the
|
| // renderer wants to make to the request, and then send it to the browser, so
|
|
|