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

Issue 1053073002: Improve window.closed fidelity. (Closed)

Created:
5 years, 8 months ago by sof
Modified:
5 years, 8 months ago
CC:
blink-reviews
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Improve window.closed fidelity. Have window.close() mark the window object as closing, so that we can return a more precise result for window.closed immediately upon return. Otherwise window.closed would only transition to |true| after the deferred closing operation has gone ahead. This exposes internal details and timing to scripts, which is preferably avoided. Spec-wise, for "close a browsing context", https://html.spec.whatwg.org/#close-a-browsing-context window.closed will transition to |true| at the start of step 3, with unloading&discarding (steps 3-5) being executed asynchronously (when the deferred close operation runs.) This implies that window.closed will return true before |pagehide| and |unload| events have been dispatched as part of step 3 (but _after_ |beforeunload| dispatching and handling, step 2.) This is not correct with the spec, it should only happen once step 5 has run, but the behavior aligns with Gecko. It is thought to be quite unlikely that unload handlers depend on window.closed being |false| rather than |true| when run. R=haraken,mkwst BUG=472379 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=193255

Patch Set 1 #

Patch Set 2 : add test #

Patch Set 3 : rebased #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+33 lines, -11 lines) Patch
A + LayoutTests/fast/dom/Window/window-closed-immediate.html View 1 1 chunk +9 lines, -9 lines 0 comments Download
A + LayoutTests/fast/dom/Window/window-closed-immediate-expected.txt View 1 1 chunk +3 lines, -1 line 0 comments Download
M Source/core/frame/DOMWindow.h View 1 chunk +10 lines, -0 lines 0 comments Download
M Source/core/frame/DOMWindow.cpp View 2 chunks +6 lines, -1 line 2 comments Download
M Source/core/frame/LocalDOMWindow.cpp View 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 10 (2 generated)
sof
please take a look.
5 years, 8 months ago (2015-04-05 14:27:39 UTC) #2
haraken
LGTM, but I want to have one more reviewer since this will involve a web-exposed ...
5 years, 8 months ago (2015-04-05 15:06:36 UTC) #3
sof
https://codereview.chromium.org/1053073002/diff/40001/Source/core/frame/DOMWindow.cpp File Source/core/frame/DOMWindow.cpp (right): https://codereview.chromium.org/1053073002/diff/40001/Source/core/frame/DOMWindow.cpp#newcode44 Source/core/frame/DOMWindow.cpp:44: return m_windowIsClosing || !frame() || !frame()->host(); On 2015/04/05 15:06:36, ...
5 years, 8 months ago (2015-04-05 15:09:42 UTC) #4
sof
On 2015/04/05 15:09:42, sof wrote: > https://codereview.chromium.org/1053073002/diff/40001/Source/core/frame/DOMWindow.cpp > File Source/core/frame/DOMWindow.cpp (right): > > https://codereview.chromium.org/1053073002/diff/40001/Source/core/frame/DOMWindow.cpp#newcode44 > ...
5 years, 8 months ago (2015-04-05 15:10:02 UTC) #5
sof
This also aligns with Presto, but breaks ranks with Trident in not immediately transitioning to ...
5 years, 8 months ago (2015-04-05 15:20:50 UTC) #6
Mike West
LGTM. I don't think we need to be terribly concerned with Trident compatibility for this ...
5 years, 8 months ago (2015-04-07 06:49:11 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1053073002/40001
5 years, 8 months ago (2015-04-07 07:12:44 UTC) #9
commit-bot: I haz the power
5 years, 8 months ago (2015-04-07 08:34:36 UTC) #10
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=193255

Powered by Google App Engine
This is Rietveld 408576698