Skip to content

Commit 1ca520a

Browse files
TimothyGudomenic
authored andcommitted
document.open(): only abort when there is a navigation
This implements the "ideal 2" plan in #3975, which was found to be compatible with the existing Chrome test suite while being reasonably straightforward. Closes #3651. Fixes #3975. Tests: web-platform-tests/wpt#10789
1 parent 712a053 commit 1ca520a

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

source

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78530,11 +78530,8 @@ interface <dfn data-export="" data-dfn-type="interface">Window</dfn> : <span>Eve
7853078530
been <span data-x="a browsing context is discarded">discarded</span>, and false otherwise.</p>
7853178531

7853278532
<p>The <dfn><code data-x="dom-window-stop">stop()</code></dfn> method on <code>Window</code>
78533-
objects should, if there is an existing attempt to <span>navigate</span> the <span>browsing
78534-
context</span> and that attempt is not currently running the <span>unload a document</span>
78535-
algorithm, cancel that <span data-x="navigate">navigation</span>; then, it must <span
78536-
data-x="abort a document">abort</span> the <span>active document</span> of the <span>browsing
78537-
context</span> of the <code>Window</code> object on which it was invoked.</p>
78533+
objects must <span>stop document loading</span> given this <code>Window</code> object's <span
78534+
data-x="concept-document-window">associated <code>Document</code></span>.</p>
7853878535

7853978536
</div>
7854078537

@@ -83776,6 +83773,22 @@ interface <dfn>BeforeUnloadEvent</dfn> : <span>Event</span> {
8377683773

8377783774
<!-- I'd love to make this more precise, anyone have any suggestions on what it should say? -->
8377883775

83776+
<p>To <dfn>stop document loading</dfn> given a <code>Document</code> object <var>document</var>,
83777+
run these steps:</p>
83778+
83779+
<ol>
83780+
<li><p>If <var>document</var> is not an <span>active document</span>, then return.</p></li>
83781+
83782+
<li><p>Let <var>browsingContext</var> be <var>document</var>'s <span
83783+
data-x="concept-document-bc">browsing context</span>.</p></li>
83784+
83785+
<li><p>If there is an existing attempt to <span>navigate</span> <var>browsingContext</var> and
83786+
that attempt is not currently running the <span>unload a document</span> algorithm, then cancel
83787+
that <span data-x="navigate">navigation</span>.</p></li>
83788+
83789+
<li><p><span data-x="abort a document">Abort</span> <var>document</var>.</p></li>
83790+
</ol>
83791+
8377983792
</div>
8378083793

8378183794

@@ -90987,8 +91000,18 @@ document.body.appendChild(frame)</code></pre>
9098791000
handler while the <code>Document</code> is being unloaded.</p>
9098891001
</li>
9098991002

90990-
<li><p>If <var>document</var> is an <span>active document</span>, then <span data-x="abort a
90991-
document">abort</span> <var>document</var>.</p></li>
91003+
<li>
91004+
<p>If there is an existing attempt to <span>navigate</span> <var>document</var>'s <span
91005+
data-x="concept-document-bc">browsing context</span>, then <span>stop document loading</span>
91006+
given <var>document</var>.</p>
91007+
91008+
<p class="&#x0058;&#x0058;&#x0058;">Issue <a
91009+
href="https://github.com/whatwg/html/issues/3447">#3447</a> looks into the distinction between
91010+
an ongoing instance of the <span>navigate</span> algorithm versus tasks to <span>navigate</span>
91011+
that are still queued. For the purpose of implementing this step, both an ongoing instance of
91012+
the <span>navigate</span> algorithm and tasks queued to <span>navigate</span> should be counted
91013+
towards "an existing attempt to <span>navigate</span>," before that issue is resolved.</p>
91014+
</li>
9099291015

9099391016
<li><p>For each <span>shadow-including inclusive descendant</span> <var>node</var> of
9099491017
<var>document</var>, <span>erase all event listeners and handlers</span> given

0 commit comments

Comments
 (0)