Skip to content

Commit

Permalink
Fix window.close() always doing nothing
Browse files Browse the repository at this point in the history
This regressed in af3ff83, which intended to allow other specifications to call "close a top-level traversable" without interfering with ongoing close operations due to window.close(). However, the way it did so was buggy. Fix it.

Additionally, export "close" for top-level traversables, and update the editorial style for how "close" and "destroy" are declared for top-level traversables.

Fixes #10678.
  • Loading branch information
domenic committed Oct 9, 2024
1 parent d8e5343 commit 3a8303e
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -89791,7 +89791,8 @@ dictionary <dfn dictionary>WindowPostMessageOptions</dfn> : <span>StructuredSeri
<li><p>Set <var>thisTraversable</var>'s <span>is closing</span> to true.</p></li>

<li><p><span>Queue a task</span> on the <span>DOM manipulation task source</span> to <span
data-x="close a top-level traversable">close</span> <var>thisTraversable</var>.</p></li>
data-x="definitely close a top-level traversable">definitely close</span>
<var>thisTraversable</var>.</p></li>
</ol>
</li>
</ol>
Expand Down Expand Up @@ -96837,8 +96838,8 @@ interface <dfn interface>NotRestoredReasons</dfn> {
<li><p>Invoke <span>WebDriver BiDi navigable destroyed</span> with <var>navigable</var>.</p></li>
</ol>

<p>To <dfn>destroy a top-level traversable</dfn> given a <span>top-level traversable</span>
<var>traversable</var>:</p>
<p>To <dfn data-x="destroy a top-level traversable">destroy</dfn> a <span>top-level
traversable</span> <var>traversable</var>:</p>

<ol>
<li><p>Let <var>browsingContext</var> be <var>traversable</var>'s <span
Expand Down Expand Up @@ -96872,21 +96873,30 @@ interface <dfn interface>NotRestoredReasons</dfn> {
<p>User agents may <span>destroy a top-level traversable</span> at any time (typically, <a
href="#nav-traversal-ui">in response to user requests</a>).</p>

<p id="closing-browsing-contexts"><span id="close-a-browsing-context"></span>To <dfn>close a
top-level traversable</dfn> <var>traversable</var>:</p>
<p id="closing-browsing-contexts"><span id="close-a-browsing-context"></span>To <dfn export
id="close-a-top-level-traversable" for="top-level traversable" data-x="close a top-level
traversable">close</dfn> a <span>top-level traversable</span> <var>traversable</var>:</p>

<ol>
<li><p>If <var>traversable</var>'s <span>is closing</span> is true, then return.</p></li>

<li><p><span data-x="definitely close a top-level traversable">Definitely close</span>
<var>traversable</var>.</p></li>
</ol>

<p>To <dfn data-x="definitely close a top-level traversable">definitely close</dfn> a
<span>top-level traversable</span> <var>traversable</var>:</p>

<ol>
<li><p>Let <var>toUnload</var> be <var>traversable</var>'s <span data-x="nav-document">active
document</span>'s <span>inclusive descendant navigables</span>.</p></li>

<li><p>If the result of <span>checking if unloading is canceled</span> for <var>toUnload</var> is
true, then return.</p></li>

<li>
<p><span data-x="tn-append-session-history-traversal-steps">Append the following session
history traversal steps</span> to <var>traversable</var>:</p>
<p><span data-x="tn-append-session-history-traversal-steps">Append the following session history
traversal steps</span> to <var>traversable</var>:</p>

<ol>
<li><p>Let <var>afterAllUnloads</var> be an algorithm step which <span data-x="destroy a
Expand All @@ -96898,6 +96908,12 @@ interface <dfn interface>NotRestoredReasons</dfn> {
</li>
</ol>

<p class="note">The <span data-x="close a top-level traversable">close</span> vs. <span
data-x="definitely close a top-level traversable">definitely close</span> separation allows other
specifications to call <span data-x="close a top-level traversable">close</span> and have it be a
no-op if the top-level traversable is already closing due to JavaScript code calling <code
data-x="dom-window-close">window.close()</code>.</p>


<h5><span id="browsing-context-names"></span>Navigable target names</h5>

Expand Down

0 comments on commit 3a8303e

Please sign in to comment.