Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 67 additions & 15 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2521,6 +2521,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<dfn data-x="set append" data-x-href="https://infra.spec.whatwg.org/#set-append">append</dfn></li>
<li>The <dfn data-x-href="https://infra.spec.whatwg.org/#struct">struct</dfn> specification type and the associated definition for
<dfn data-x="struct item" data-x-href="https://infra.spec.whatwg.org/#struct-item">item</dfn></li>
<li>The <dfn data-x-href="https://infra.spec.whatwg.org/#tuple">tuple</dfn> data structure</li>
<li>The <dfn data-x-href="https://infra.spec.whatwg.org/#forgiving-base64-encode">forgiving-base64 encode</dfn> and
<dfn data-x-href="https://infra.spec.whatwg.org/#forgiving-base64-decode">forgiving-base64 decode</dfn> algorithms</li>
<li><dfn data-x-href="https://infra.spec.whatwg.org/#html-namespace">HTML namespace</dfn></li>
Expand Down Expand Up @@ -80996,26 +80997,82 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
the following steps would produce:</p>

<ol>
<li><p>Let <var>output</var> be a new <span>list</span> of strings.</p></li>
<li><p>Let <var>parentOrigins</var> be a new <span>list</span> of <span
data-x="tuple">tuples</span> consisting of <dfn data-x="tuple parent's origin">parent's
origin</dfn> and <dfn data-x="tuple referrer">referrer</dfn>.</p></li>

<li><p>Let <var>current</var> be the <span data-x="concept-document-bc">browsing context</span>
of the <code>Document</code> with which this <code>Location</code> object is associated.</p></li>
<!-- All Location objects are associated with Document objects that have a browsing context upon
creation. -->

<li><p><i>Loop</i>: If <var>current</var> has no <span>parent browsing context</span>, jump to
the step labeled <i>end</i>.</p></li>
<li>
<p>While <var>current</var> has a <span>parent browsing context</span>:</p>

<li><p>Let <var>current</var> be <var>current</var>'s <span>parent browsing
context</span>.</p></li>
<ol>
<li><p><span data-x="list append">Append</span> (<var>current</var>'s <span>parent browsing
context</span>'s <span>active document</span>'s <span>origin</span>, <var>current</var>'s
<span>active document</span>'s <span data-x="the document's referrer">referrer</span>) to
<var>parentOrigins</var>.</p></li>

<li><p><span data-x="list append">Append</span> the <span data-x="serialization of an
origin">serialization</span> of <var>current</var>'s <span>active document</span>'s
<span>origin</span> to <var>output</var>.</p></li>
<li><p>Set <var>current</var> to <var>current</var>'s <span>parent browsing
context</span>.</p></li>
</ol>
</li>

<li><p>Return to the step labeled <i>loop</i>.</p></li>
<li><p>Let <var>output</var> be a new <span>list</span> of strings.</p></li>

<li><p>Let <var>lastRedactedOrigin</var> be null.</p></li>

<li>
<p><span data-x="list iterate">For each</span> <var>tuple</var> in <var>parentOrigins</var>:</p>

<ol>
<li><p>If <var>lastRedactedOrigin</var> is not null and <var>tuple</var>'s <span data-x="tuple
parent's origin">parent's origin</span> is <span>same origin</span> with
<var>lastRedactedOrigin</var>, then <span data-x="list append">append</span>
"<code data-x="">null</code>" to <var>output</var> and <span>continue</span>.</p></li>

<li><p>Set <var>lastRedactedOrigin</var> to null.</p></li>

<li><p>Let <var>origin</var> be null.</p></li>

<li><p><i>End</i>: Return <var>output</var>.</p></li>
<li>
<p>If <var>tuple</var>'s <span data-x="tuple referrer">referrer</span> is not the empty
string, then:</p>

<ol>
<li><p>Let <var>referrerURL</var> be the result of <span data-x="URL parser">parsing</span>
<var>tuple</var>'s <span data-x="tuple referrer">referrer</span>.</p></li>

<li><p>Assert: <var>referrerURL</var> is not failure.</p></li>

<li><p>Set <var>origin</var> to <var>referrerURL</var>'s <span
data-x="concept-url-origin">origin</span>.</p></li>
</ol>
</li>

<li><p>If <var>origin</var> is null or <var>tuple</var>'s <span data-x="tuple parent's
origin">parent's origin</span> is not <span>same origin</span> with <var>origin</var>, then set
<var>lastRedactedOrigin</var> to <var>tuple</var>'s <span data-x="tuple parent's
origin">parent's origin</span> and <span data-x="list append">append</span> "<code
data-x="">null</code>" to <var>output</var>.</p></li>

<li><p>Otherwise, <span data-x="list append">append</span> the <span data-x="serialization of
an origin">serialization</span> of <var>tuple</var>'s <span data-x="tuple parent's
origin">parent's origin</span> to <var>output</var>.</p></li>
</ol>
</li>

<li><p>Return <var>output</var>.</p></li>
</ol>

<p class="note">The reliance on <span data-x="browsing context">browsing contexts</span> and their
<span>active document</span> in this algorithm is safe as the <span>active document</span> is the
<code>Document</code> object that the <span data-x="browsing context">browsing contexts</span> are
<span data-x="browsing context nested through">nested through</span>, and both are available when
a <code>Location</code> object is created at which point this algorithm is run.</p>

<p>A <code>Location</code> object has an associated <dfn><code>Location</code>-object-setter
navigate</dfn> algorithm, which given a <var>url</var>, runs these steps:</p>

Expand Down Expand Up @@ -81538,11 +81595,6 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
data-x="concept-location-ancestor-origins-list">ancestor origins list</span>.</p></li>
</ol>

<p class="warning">The details of how the <code
data-x="dom-location-ancestorOrigins">ancestorOrigins</code> attribute works are still
controversial and might change. See <a href="https://github.com/whatwg/html/issues/1918">issue
#1918</a> for more information.</p>

<hr>

<p id="location-internal-methods">As explained earlier, the <code>Location</code> exotic object
Expand Down