Skip to content

Commit

Permalink
Remove overridden reload concept
Browse files Browse the repository at this point in the history
Or: document.open() simplifications, part 1.9.

This behavior is only implemented in Firefox and Edge and has
contributed to developer confusion. See
https://bugzilla.mozilla.org/show_bug.cgi?id=556002.

This is a part of the effort to renovate document.open(). See
whatwg#3818 for context.

Tests: web-platform-tests/wpt#12555
  • Loading branch information
TimothyGu authored and domenic committed Aug 23, 2018
1 parent bef6f78 commit 6440cca
Showing 1 changed file with 5 additions and 86 deletions.
91 changes: 5 additions & 86 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -9133,60 +9133,6 @@ o.myself = o;</code></pre>
that can be set when the <code>Document</code> is created. If it is not explicitly set, then its
value is the empty string.</p>

<p>Each <code>Document</code> object has a <dfn>reload override flag</dfn> that is originally
unset. The flag is set by the <code data-x="dom-document-open">document.open(<var>type</var>,
<var>replace</var>)</code> and <code data-x="dom-document-write">document.write()</code> methods
in certain situations. When the flag is set, the <code>Document</code> also has a <dfn>reload
override buffer</dfn> which is a Unicode string that is used as the source of the document when it
is reloaded.</p>

<p>When the user agent is to perform <dfn>an overridden reload</dfn>, given a <span>source
browsing context</span>, it must act as follows:</p>

<ol>

<li><p>Let <var>source</var> be the value of the <span>browsing context</span>'s
<span>active document</span>'s <span>reload override buffer</span>.</p></li>

<li><p>Let <var>address</var> be the <span>browsing context</span>'s <span>active
document</span>'s <span data-x="concept-document-url">URL</span>.</p></li>

<li><p>Let <var>HTTPS state</var> be the <span data-x="concept-document-https-state">HTTPS
state</span> of the <span>browsing context</span>'s <span>active document</span>.</p></li>

<li><p>Let <var>referrer policy</var> be the <span
data-x="concept-document-referrer-policy">referrer policy</span> of the <span>browsing
context</span>'s <span>active document</span>.</p></li>

<li><p>Let <var>CSP list</var> be the <span data-x="concept-document-csp-list">CSP list</span>
of the <span>browsing context</span>'s <span>active document</span>.</p></li>

<li>

<p><span>Navigate</span><!--DONAV reload after d.open()--> the <span>browsing context</span> to
a new <span data-x="concept-response">response</span> whose <span
data-x="concept-response-body">body</span> is <var>source</var>, <span
data-x="concept-response-header-list">header list</span> is `<code
data-x="http-referrer-policy">Referrer-Policy</code>`/<var>referrer policy</var>, <span
data-x="concept-response-csp-list">CSP list</span> is <var>CSP list</var> and <span
data-x="concept-response-https-state">HTTPS state</span> is <var>HTTPS state</var>, with the
<var><span>exceptions enabled flag</span></var> set and <span>replacement enabled</span>. The
<span>source browsing context</span> is that given to the <span data-x="an overridden
reload">overridden reload</span> algorithm. When the <span>navigate</span> algorithm creates a
<code>Document</code> object for this purpose, set that <code>Document</code>'s <span>reload
override flag</span> and set its <span>reload override buffer</span> to <var>source</var>.
Rethrow any exceptions.</p>

<p>When it comes time to <span>set the document's address</span> in the <span
data-x="navigate">navigation algorithm</span>, use <var>address</var> as the
<span>override URL</span>.</p>

</li>


</ol>



<h4>The <code>Document</code> object</h4>

Expand Down Expand Up @@ -81613,13 +81559,6 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
attributes</span> of the <span>browsing context</span>'s <span>browsing context
container</span>.</p></dd>

<dt>If the <span>browsing context</span>'s <span>active document</span> has its <span>reload
override flag</span> set</dt>

<dd><p>Perform <span>an overridden reload</span>, with the <span>browsing context</span> being
navigated as the <span>responsible browsing context</span>. Rethrow any exceptions.</p></dd>
<!-- https://damowmow.com/playground/demos/sandbox/001.html -->

<dt>Otherwise</dt>

<dd><p><span>Navigate</span><!--DONAV location.reload()--> the <span>browsing context</span> to
Expand All @@ -81646,10 +81585,7 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
In the case of non-idempotent methods (e.g. HTTP POST), the user agent should prompt the user to
confirm the operation first, since otherwise transactions (e.g. purchases or database
modifications) could be repeated. User agents may allow the user to explicitly override any caches
when reloading. If <span>browsing context</span>'s <span>active document</span>'s <span>reload
override flag</span> is set, then the user agent may instead perform <span>an overridden
reload</span> rather than the navigation described in this paragraph (with the <span>browsing
context</span> being reloaded as the <span>source browsing context</span>).</p>
when reloading.</p>

<hr>

Expand Down Expand Up @@ -82039,9 +81975,6 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
the bytes that comprise a <span data-x="concept-response-body">response body</span> is
not yet specified, pending further investigation into user agent behavior. See <a
href="https://github.com/whatwg/html/issues/1129">issue #1129</a>.</p>

<p>When it comes time to <span>set the document's address</span>, use <var>address</var> as
the <span>override URL</span>.</p>
</li>

<li><p>Run <span>process a navigate response</span> with <var>resource</var>,
Expand Down Expand Up @@ -82380,17 +82313,10 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
application), or one for which the user agent has dedicated processing rules, or one for which
the user agent has a dedicated handler.</p>

<p><dfn data-x="set the document's address">Setting the document's address</dfn>: If there is no
<dfn>override URL</dfn>, then any <code>Document</code> created by these steps must have its
<span data-x="concept-document-url">URL</span> set to the <span>URL</span> that was
originally to be fetched, ignoring any other data that was used to obtain the resource. However,
if there <em>is</em> an <span>override URL</span>, then any <code>Document</code> created by
these steps must have its <span data-x="concept-document-url">URL</span> set to that
<span>URL</span> instead.</p>

<p class="note">An <span data-x="override URL">override URL</span> is set when <span
data-x="javascript protocol">dereferencing a <code>javascript:</code> URL</span> and when
performing <span>an overridden reload</span>.</p>
<p><dfn data-x="set the document's address">Setting the document's address</dfn>: Any
<code>Document</code> created by these steps must have its <span
data-x="concept-document-url">URL</span> set to the <span>URL</span> that was originally to be
fetched, ignoring any other data that was used to obtain the resource.</p>

<p><!--en-GB--><dfn id="initialise-the-document-object" data-x="initialize the Document object"
data-export="">Initializing a new <code>Document</code> object</dfn>: when a
Expand Down Expand Up @@ -91038,10 +90964,6 @@ document.body.appendChild(frame)</code></pre>
<li><p><span data-x="concept-node-replace-all">Replace all</span> with null within
<var>document</var>, without firing any mutation events.</p></li>

<li><p>If <var>document</var> is <span>ready for post-load tasks</span>, then set
<var>document</var>'s <span>reload override flag</span> and set <var>document</var>'s
<span>reload override buffer</span> to the empty string.</p></li>

<li><p>Change <var>document</var>'s <span data-x="concept-document-url">URL</span> to the
<span data-x="concept-document-url">URL</span> of the <span>responsible document</span> specified
by the <span>entry settings object</span>.</p></li>
Expand Down Expand Up @@ -91254,9 +91176,6 @@ document.body.appendChild(frame)</code></pre>
<li><p>Insert <var>input</var> into the <span>input stream</span> just before the <span>insertion
point</span>.</p></li>

<li><p>If <var>document</var>'s <span>reload override flag</span> is set, then append
<var>input</var> to <var>document</var>'s <span>reload override buffer</span>.</p></li>

<li>
<p>If there is no <span>pending parsing-blocking script</span>, have the <span>HTML
parser</span> process <var>input</var>, one code point at a time, processing resulting tokens as
Expand Down

0 comments on commit 6440cca

Please sign in to comment.