DescriptionImprove 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
Messages
Total messages: 10 (2 generated)
|