Skip to content

Commit

Permalink
document.open(): only abort when there is a navigation
Browse files Browse the repository at this point in the history
This implements the "ideal 2" plan in whatwg#3975, which was found to be
compatible with the existing Chrome test suite while being reasonably
straightforward.

Closes whatwg#3651.
Fixes whatwg#3975.

Tests: web-platform-tests/wpt#10789
  • Loading branch information
TimothyGu authored and mustaqahmed committed Feb 15, 2019
1 parent 704bd6e commit d82d154
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -78530,11 +78530,8 @@ interface <dfn data-export="" data-dfn-type="interface">Window</dfn> : <span>Eve
been <span data-x="a browsing context is discarded">discarded</span>, and false otherwise.</p>

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

</div>

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

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

<p>To <dfn>stop document loading</dfn> given a <code>Document</code> object <var>document</var>,
run these steps:</p>

<ol>
<li><p>If <var>document</var> is not an <span>active document</span>, then return.</p></li>

<li><p>Let <var>browsingContext</var> be <var>document</var>'s <span
data-x="concept-document-bc">browsing context</span>.</p></li>

<li><p>If there is an existing attempt to <span>navigate</span> <var>browsingContext</var> and
that attempt is not currently running the <span>unload a document</span> algorithm, then cancel
that <span data-x="navigate">navigation</span>.</p></li>

<li><p><span data-x="abort a document">Abort</span> <var>document</var>.</p></li>
</ol>

</div>


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

<li><p>If <var>document</var> is an <span>active document</span>, then <span data-x="abort a
document">abort</span> <var>document</var>.</p></li>
<li>
<p>If there is an existing attempt to <span>navigate</span> <var>document</var>'s <span
data-x="concept-document-bc">browsing context</span>, then <span>stop document loading</span>
given <var>document</var>.</p>

<p class="&#x0058;&#x0058;&#x0058;">Issue <a
href="https://github.com/whatwg/html/issues/3447">#3447</a> looks into the distinction between
an ongoing instance of the <span>navigate</span> algorithm versus tasks to <span>navigate</span>
that are still queued. For the purpose of implementing this step, both an ongoing instance of
the <span>navigate</span> algorithm and tasks queued to <span>navigate</span> should be counted
towards "an existing attempt to <span>navigate</span>," before that issue is resolved.</p>
</li>

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

0 comments on commit d82d154

Please sign in to comment.