Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Issue 2783723002: Keep track in the browser of which frames have onunload and onbeforeunload handlers. (Closed)

Created:
3 years, 8 months ago by jam
Modified:
3 years, 8 months ago
Reviewers:
nasko, dcheng
CC:
chromium-reviews, nasko+codewatch_chromium.org, darin-cc_chromium.org, creis+watch_chromium.org, mlamouri+watch-content_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Keep track in the browser of which frames have onunload and onbeforeunload handlers. This allows PlzNavigate to only pause fetching the request if it knows that the page has an onbeforeunload handler, where today it currently always goes to the renderer. This avoids delaying the network requests in the 95% cases that don't onbeforeunload handler on a process hop to the renderer. BUG=365039, 705559 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation R=dcheng@chromium.org, nasko@chromium.org Review-Url: https://codereview.chromium.org/2783723002 . Cr-Commit-Position: refs/heads/master@{#460581} Committed: https://chromium.googlesource.com/chromium/src/+/a2c84a7664eceb5cbeaae5bf1ec32da0060e3097

Patch Set 1 : original cl #

Patch Set 2 : just notify only #

Patch Set 3 : check if onbeforeunload exists before calling it, with PlzNavigate #

Patch Set 4 : without PlzNavigate #

Patch Set 5 : fix browser tests #

Patch Set 6 : update unittest expectations, and fix unloadcontroller to check if a tab needs to fire onbeforeunlo… #

Patch Set 7 : test fixes #

Patch Set 8 : test fixes #

Patch Set 9 : fix tests #

Total comments: 3

Patch Set 10 : fix content_browsertests with plznavigate and also remove now unnecessary unloadcontroller change #

Total comments: 18
Unified diffs Side-by-side diffs Delta from patch set Stats (+135 lines, -90 lines) Patch
M chrome/browser/lifetime/browser_close_manager.cc View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -1 line 0 comments Download
M content/browser/browser_side_navigation_browsertest.cc View 1 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 2 comments Download
M content/browser/devtools/protocol/devtools_protocol_browsertest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M content/browser/frame_host/navigation_request.h View 1 2 3 4 2 chunks +3 lines, -0 lines 0 comments Download
M content/browser/frame_host/navigation_request.cc View 1 2 3 4 3 chunks +15 lines, -11 lines 1 comment Download
M content/browser/frame_host/navigator_impl_unittest.cc View 1 2 3 4 5 3 chunks +1 line, -10 lines 2 comments Download
M content/browser/frame_host/render_frame_host_impl.h View 1 2 3 4 5 6 7 3 chunks +10 lines, -0 lines 2 comments Download
M content/browser/frame_host/render_frame_host_impl.cc View 1 2 3 4 5 6 7 4 chunks +33 lines, -1 line 0 comments Download
M content/browser/frame_host/render_frame_host_manager_unittest.cc View 1 2 3 4 5 2 chunks +1 line, -2 lines 2 comments Download
M content/browser/web_contents/web_contents_impl.cc View 1 2 3 4 5 6 7 1 chunk +3 lines, -1 line 2 comments Download
M content/browser/web_contents/web_contents_impl_browsertest.cc View 1 2 1 chunk +23 lines, -0 lines 0 comments Download
M content/browser/web_contents/web_contents_impl_unittest.cc View 1 2 3 4 5 10 chunks +3 lines, -43 lines 0 comments Download
M content/common/frame_messages.h View 1 chunk +7 lines, -0 lines 2 comments Download
M content/renderer/render_frame_impl.h View 1 chunk +3 lines, -0 lines 0 comments Download
M content/renderer/render_frame_impl.cc View 1 chunk +15 lines, -0 lines 1 comment Download
M content/test/test_render_frame_host.h View 1 2 3 4 5 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp View 1 2 3 4 3 chunks +3 lines, -19 lines 4 comments Download
M ui/views/controls/webview/web_dialog_view.cc View 1 2 3 4 5 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 58 (48 generated)
jam
Daniel: webkit Nasko: the rest
3 years, 8 months ago (2017-03-29 20:15:28 UTC) #40
nasko
For navigations, the only event that matters is the beforeunload one. It might be useful ...
3 years, 8 months ago (2017-03-29 21:45:17 UTC) #45
jam
https://codereview.chromium.org/2783723002/diff/160001/content/browser/web_contents/web_contents_impl.cc File content/browser/web_contents/web_contents_impl.cc (right): https://codereview.chromium.org/2783723002/diff/160001/content/browser/web_contents/web_contents_impl.cc#newcode1427 content/browser/web_contents/web_contents_impl.cc:1427: GetMainFrame()->ShouldDispatchUnload()); On 2017/03/29 21:45:17, nasko wrote: > Why would ...
3 years, 8 months ago (2017-03-29 22:19:09 UTC) #50
dcheng
Blink LGTM I don't feel super strongly about keeping the comments as-is, but it does ...
3 years, 8 months ago (2017-03-29 23:03:46 UTC) #51
nasko
TIL WebContents::NeedToFireBeforeUnload doesn't do what it is named to do :(. https://codereview.chromium.org/2783723002/diff/180001/content/browser/browser_side_navigation_browsertest.cc File content/browser/browser_side_navigation_browsertest.cc (right): ...
3 years, 8 months ago (2017-03-29 23:31:26 UTC) #52
nasko
LGTM on content, assuming the comments will be addressed in an immediate follow up CL, ...
3 years, 8 months ago (2017-03-29 23:42:08 UTC) #53
jam
Committed patchset #10 (id:180001) manually as a2c84a7664eceb5cbeaae5bf1ec32da0060e3097 (presubmit successful).
3 years, 8 months ago (2017-03-29 23:48:08 UTC) #55
jam
thanks all, the followup comments are in: https://codereview.chromium.org/2781383002 https://codereview.chromium.org/2783723002/diff/180001/content/browser/browser_side_navigation_browsertest.cc File content/browser/browser_side_navigation_browsertest.cc (right): https://codereview.chromium.org/2783723002/diff/180001/content/browser/browser_side_navigation_browsertest.cc#newcode286 content/browser/browser_side_navigation_browsertest.cc:286: "data:text/html,<html><script>window.onbeforeunload=function(e)" ...
3 years, 8 months ago (2017-03-30 14:53:23 UTC) #56
achuithb
A revert of this CL (patchset #10 id:180001) has been created in https://codereview.chromium.org/2803633004/ by achuith@chromium.org. ...
3 years, 8 months ago (2017-04-05 17:40:43 UTC) #57
jam
3 years, 8 months ago (2017-04-10 22:11:13 UTC) #58
Message was sent while issue was closed.
A revert of this CL (patchset #10 id:180001) has been created in
https://codereview.chromium.org/2812743002/ by jam@chromium.org.

The reason for reverting is: Exposed races with FrameHostMsg_DidStopLoading

BUG=710062
.

Powered by Google App Engine
This is Rietveld 408576698