@@ -83619,7 +83619,16 @@ interface <dfn>BarProp</dfn> {
83619
83619
data-x="struct item">items</span>:</p>
83620
83620
83621
83621
<ul>
83622
- <li><p><dfn data-x="she-url">URL</dfn>, a <span>URL</span></p></li>
83622
+ <li>
83623
+ <p><dfn data-x="she-url">URL</dfn>, a <span>URL</span></p>
83624
+
83625
+ <p class="warning">This <a href="#warning-document-open-url-mismatch">doesn't necessarily
83626
+ match</a> the <span data-x="she-document">document</span>'s <span
83627
+ data-x="concept-document-URL">URL</span>. In general, to find the "current URL" prefer using the
83628
+ appropriate <code>Document</code>'s <span data-x="concept-document-URL">URL</span>; a
83629
+ <span>session history entry</span>'s <span data-x="she-url">URL</span> is only to be used for
83630
+ session history traversal and restoration.</p>
83631
+ </li>
83623
83632
83624
83633
<li>
83625
83634
<p><dfn data-x="she-document">document</dfn>, a <code>Document</code> or null</p>
@@ -84178,8 +84187,8 @@ interface <dfn>History</dfn> {
84178
84187
<li><p>Let <var>serializedData</var> be
84179
84188
<span>StructuredSerializeForStorage</span>(<var>data</var>). Rethrow any exceptions.</p></li>
84180
84189
84181
- <li><p>Let <var>newURL</var> be the <span>session history</span >'s <span>current entry</span>'s
84182
- <span data-x="she-url ">URL</span>.</p></li>
84190
+ <li><p>Let <var>newURL</var> be <var>document</var >'s <span
84191
+ data-x="concept-document-URL ">URL</span>.</p></li>
84183
84192
84184
84193
<li>
84185
84194
<p>If <var>url</var> is not null, then:</p>
@@ -85086,52 +85095,56 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
85086
85095
<p class="note">The <code data-x="dom-location-replace">replace()</code> method intentionally has
85087
85096
no security check.</p>
85088
85097
85089
- <p>When the <dfn method for="Location"><code data-x="dom-location-reload">reload()</code></dfn>
85090
- method is invoked, the user agent must run the appropriate steps from the following list:</p>
85091
-
85092
- <dl class="switch">
85093
- <dt>If this <code>Location</code> object's <span>relevant <code>Document</code></span> is
85094
- null</dt>
85095
-
85096
- <dd><p>Return.</p></dd>
85098
+ <p>The <dfn method for="Location"><code data-x="dom-location-reload">reload()</code></dfn> method
85099
+ steps are:</p>
85097
85100
85098
- <dt>If this <code>Location</code> object's <span>relevant <code>Document</code></span>'s <span
85099
- data-x="concept-document-origin">origin</span> is not <span>same origin-domain</span> with the
85100
- <span>entry settings object</span>'s <span
85101
- data-x="concept-settings-object-origin">origin</span></dt>
85101
+ <ol>
85102
+ <li><p>Let <var>document</var> be <span>this</span>'s <span>relevant
85103
+ <code>Document</code></span>.</p></li>
85102
85104
85103
- <dd><p>Throw a <span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p></dd>
85105
+ <li><p>Let <var>browsingContext</var> be <var>document</var>'s <span
85106
+ data-x="concept-document-bc">browsing context</span>.</p></li>
85104
85107
85105
- <dt>If the currently executing <span data-x="concept-task">task</span> is the dispatch of a <code
85106
- data-x="event-resize">resize</code> event in response to the user resizing the <span>browsing
85107
- context</span></dt>
85108
+ <li><p>If <var>document</var> is null, then return.</p></li>
85108
85109
85109
- <dd><p>Repaint the <span>browsing context</span> and return.</p></dd> <!-- this
85110
- theoretically would have no effect but in practice can be useful to work around rendering bugs.
85111
- -->
85110
+ <li><p>If <var>document</var>'s <span data-x="concept-document-origin">origin</span> is not
85111
+ <span>same origin-domain</span> with the <span>entry settings object</span>'s <span
85112
+ data-x="concept-settings-object-origin">origin</span>, then throw a
85113
+ <span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p></li>
85112
85114
85113
- <dt>If the <span>browsing context</span>'s <span>active document</span> is <span>an
85114
- <code>iframe</code> <code data-x="attr-iframe-srcdoc">srcdoc</code> document</span></dt>
85115
+ <li><p>If <span>this</span>'s <span>relevant agent</span>'s <span
85116
+ data-x="concept-agent-event-loop">event loop</span>'s <span>currently running task</span> is the
85117
+ dispatch of a <code data-x="event-resize">resize</code> event in response to the user resizing
85118
+ the <span>browsing context</span>, then repaint the <span>browsing context</span> and
85119
+ return.</p></li>
85120
+ <!-- this theoretically would have no effect but in practice can be useful to work around
85121
+ rendering bugs. -->
85115
85122
85116
- <dd><p><span data-x="process the iframe attributes">Reprocess the <code>iframe</code>
85117
- attributes</span> of the <span>browsing context</span>'s <span
85118
- data-x="bc-container">container</span>.</p></dd>
85123
+ <li><p>If <var>document</var> is <span>an <code>iframe</code> <code
85124
+ data-x="attr-iframe-srcdoc">srcdoc</code> document</span>, then <span data-x="process the iframe
85125
+ attributes">reprocess the <code>iframe</code> attributes</span> of <var>browsingContext</var>'s
85126
+ <span data-x="bc-container">container</span> and return.</p></li>
85119
85127
85120
- <dt>Otherwise</dt>
85128
+ <li>
85129
+ <p><span>Navigate</span><!--DONAV location.reload()--> <var>browsingContext</var> to
85130
+ <var>browsingContext</var>'s <span>session history</span>'s <span>current entry</span>'s <span
85131
+ data-x="she-url">URL</span>, with <var><span>exceptionsEnabled</span></var> set to true, <var
85132
+ data-x="navigation-hh">historyHandling</var> set to "<code data-x="hh-reload">reload</code>",
85133
+ and the <span>source browsing context</span> set to <var>browsingContext</var>.</p>
85121
85134
85122
- <dd><p><span>Navigate</span><!--DONAV location.reload()--> the <span>browsing context</span> to
85123
- this <code>Location</code> object's <span>relevant <code>Document</code></span>'s <span
85124
- data-x="concept-document-url">URL</span>, with <var><span>exceptionsEnabled</span></var> set to
85125
- true, <var data-x="navigation-hh">historyHandling</var> set to "<code
85126
- data-x="hh-reload">reload</code>", and the <span>source browsing context</span> set to the
85127
- <span>browsing context</span> being navigated.</p></dd>
85135
+ <p class="note">This is different than navigating to <var>document</var>'s <span
85136
+ data-x="concept-document-url">URL</span>, due to the potential for <a
85137
+ href="#warning-document-open-url-mismatch">mismatches caused by <code
85138
+ data-x="dom-document-open">document.open()</code></a>.</p>
85128
85139
85129
- <!-- It appears that document.reload() always uses GET and does not, e.g., re-POST. Thus the
85130
- difference between using the document's URL here, and "the same resource as that Document" below
85131
- in the user-triggered reload section. -->
85140
+ <!-- It appears that document.reload() always uses GET and does not, e.g., re-POST. Thus the
85141
+ difference between using the document's URL here, and "the same resource as that Document" below
85142
+ in the user-triggered reload section. -->
85132
85143
85133
- <!-- https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=141 defends the source browsing context claim; submit, eval document.referrer, reload, eval document.referrer. -->
85134
- </dl>
85144
+ <!-- https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=141 defends the source
85145
+ browsing context claim; submit, eval document.referrer, reload, eval document.referrer. -->
85146
+ </li>
85147
+ </ol>
85135
85148
85136
85149
<p>When a user requests that the <span>active document</span> of a <span>browsing context</span>
85137
85150
be reloaded through a user interface element, the user agent should <span>navigate</span><!--DONAV
@@ -94075,6 +94088,28 @@ document.body.appendChild(frame)</code></pre>
94075
94088
<li><p>If <var>entryDocument</var> is not <var>document</var>, then set <var>newURL</var>'s
94076
94089
<span data-x="concept-url-fragment">fragment</span> to null.</p></li>
94077
94090
94091
+ <li>
94092
+ <p>Set <var>document</var>'s <span data-x="concept-document-url">URL</span> to
94093
+ <var>newURL</var>.</p>
94094
+
94095
+ <div class="note">
94096
+ <p>The main purpose of this step is to allow code such as the following:</p>
94097
+
94098
+ <pre><code class="js">const w = window.open();
94099
+ w.document.open();
94100
+ w.document.write("<img src='image.png'>");</code></pre>
94101
+
94102
+ <p>to resolve the <code data-x="">image.png</code> URL relative to the caller, instead of
94103
+ relative to <code>about:blank</code>.</p>
94104
+ </div>
94105
+
94106
+ <p class="warning" id="warning-document-open-url-mismatch">This can cause
94107
+ <var>document</var>'s <span data-x="concept-document-url">URL</span> to mismatch its
94108
+ corresponding <span>session history entry</span>'s <span data-x="she-url">URL</span>. This
94109
+ mismatch is required for web compatibility; see <a
94110
+ href="https://github.com/whatwg/html/issues/6556">issue #6556</a>.</p>
94111
+ </li>
94112
+
94078
94113
<li><p>Run the <span>URL and history update steps</span> with <var>document</var> and
94079
94114
<var>newURL</var>.</p></li>
94080
94115
</ol>
0 commit comments