Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapshot fallback base URL for about:-schemed Documents #9464

Merged
merged 16 commits into from
Jul 13, 2023
Merged
125 changes: 94 additions & 31 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -6944,24 +6944,24 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<span>URL record</span> obtained by running these steps:</p>

<ol>
<li><p>If <var>document</var> is <span>an <code>iframe</code> <code
data-x="attr-iframe-srcdoc">srcdoc</code> document</span>, then return <var>document</var>'s
<span data-x="doc-container-document">container document</span>'s <span>document base
URL</span>.</p></li>

<li>
<!-- https://www.hixie.ch/tests/adhoc/html/navigation/javascript-url/ -->
<p>If <var>document</var> is <span data-x="an iframe srcdoc document">an <code>iframe</code>
<code data-x="attr-iframe-srcdoc">srcdoc</code> document</span>, then:</p>

<!-- this should be tested in the case of a browsing context that was navigated to about:blank
after having been elsewhere, as opposed to the about:blank used at the time of the browsing
context's creation. -->
<ol>
<li><p><span>Assert</span>: <var>document</var>'s <span
data-x="concept-document-about-base-url">about base URL</span> is non-null.</p></li>
domfarolino marked this conversation as resolved.
Show resolved Hide resolved

<p>If <var>document</var>'s <span data-x="concept-document-url">URL</span> is
<code>about:blank</code>, and <var>document</var>'s <span data-x="concept-document-bc">browsing
context</span>'s <span>creator base URL</span> is non-null, then return that <span>creator base
URL</span>.</p>
<li><p>Return <var>document</var>'s <span data-x="concept-document-about-base-url">about base
URL</span>.</p></li>
</ol>
</li>

<li><p>If <var>document</var>'s <span data-x="concept-document-url">URL</span> is
<code>about:blank</code> and <var>document</var>'s <span
data-x="concept-document-about-base-url">about base URL</span> is non-null, then return
<var>document</var>'s <span data-x="concept-document-about-base-url">about base URL</span>.</p></li>

<!-- https://www.hixie.ch/tests/adhoc/dom/level0/history/pushState/001/ -->

<li><p>Return <var>document</var>'s <span data-x="concept-document-url">URL</span>.</p></li>
Expand Down Expand Up @@ -10585,6 +10585,12 @@ partial interface <dfn id="document" data-lt="">Document</dfn> {
<p>Each <code>Document</code> has a <dfn data-x="concept-document-navigation-id">navigation
id</dfn>, which is a <span>navigation ID</span> or null, initially null.</p>

<p>Each <code>Document</code> has an <dfn data-x="concept-document-about-base-url">about base
URL</dfn>, which is a <span>URL</span> or null, initially null.</p>

<p class="note">This is only populated for "<code data-x="">about:</code>"-schemed
<code>Document</code>s.</p>

<h4>The <code>DocumentOrShadowRoot</code> interface</h4>

<p><cite>DOM</cite> defines the <code data-x="DOM
Expand Down Expand Up @@ -93189,6 +93195,10 @@ interface <dfn interface>BeforeUnloadEvent</dfn> : <span>Event</span> {

<dt><span data-x="document-state-nav-target-name">navigable target name</span></dt>
<dd><var>targetName</var></dd>

<dt><span data-x="document-state-about-base-url">about base URL</span></dt>
<dd><var>document</var>'s <span data-x="concept-document-about-base-url">about base
URL</span></dd>
</dl>
</li>

Expand Down Expand Up @@ -93351,6 +93361,10 @@ interface <dfn interface>BeforeUnloadEvent</dfn> : <span>Event</span> {

<dt><span data-x="document-state-nav-target-name">navigable target name</span></dt>
<dd><var>targetName</var></dd>

<dt><span data-x="document-state-about-base-url">about base URL</span></dt>
<dd><var>document</var>'s <span data-x="concept-document-about-base-url">about base
URL</span></dd>
</dl>
</li>

Expand Down Expand Up @@ -94012,9 +94026,6 @@ interface <dfn interface>BeforeUnloadEvent</dfn> : <span>Event</span> {
<li><p>An <dfn data-x="browsing-context-initial-url">initial URL</dfn>, a <span>URL</span> or
null, initially null.</p></li>

<li><p>A <dfn>creator base URL</dfn>, null or an algorithm that returns a <span>URL</span>,
initially null.</p></li>

<li><p>A <dfn data-x="virtual-browsing-context-group-id">virtual browsing context group ID</dfn>
integer, initially 0. This is used by <span data-x="coop-struct-report-only-value">cross-origin
opener policy reporting</span>, to keep track of the browsing context group switches that would
Expand Down Expand Up @@ -94088,15 +94099,17 @@ interface <dfn interface>BeforeUnloadEvent</dfn> : <span>Event</span> {

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

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

<li id="creator-browsing-context">
<p>If <var>creator</var> is non-null, then:</p>

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

<li><p>Set <var>browsingContext</var>'s <span>creator base URL</span> to an algorithm which
returns <var>creator</var>'s <span data-x="document base URL">base URL</span>.</p></li>
<li><p>Set <var>creatorBaseURL</var> to <var>creator</var>'s <span>document base
URL</span>.</p></li>

<li><p>Set <var>browsingContext</var>'s <span
data-x="virtual-browsing-context-group-id">virtual browsing context group ID</span> to
Expand All @@ -94109,10 +94122,6 @@ interface <dfn interface>BeforeUnloadEvent</dfn> : <span>Event</span> {
<li><p>Let <var>sandboxFlags</var> be the result of <span>determining the creation sandboxing
flags</span> given <var>browsingContext</var> and <var>embedder</var>.</p></li>

<!--
This step does not need to use |embedder|, because determining the origin only consults the
containerOrigin when the url argument is about:srcdoc. However, here we always pass about:blank.
-->
<li id="about-blank-origin"><p>Let <var>origin</var> be the result of <span>determining the
origin</span> given <code>about:blank</code>, <var>sandboxFlags</var>, <var>creatorOrigin</var>,
and null.</p></li>
Expand Down Expand Up @@ -94186,6 +94195,9 @@ interface <dfn interface>BeforeUnloadEvent</dfn> : <span>Event</span> {

domfarolino marked this conversation as resolved.
Show resolved Hide resolved
<dt><span>is initial <code>about:blank</code></span></dt>
<dd>true</dd>

<dt><span data-x="concept-document-about-base-URL">about base URL</span></dt>
<dd><var>creatorBaseURL</var></dd>
</dl>
</li>

Expand Down Expand Up @@ -94865,6 +94877,16 @@ interface <dfn interface>BeforeUnloadEvent</dfn> : <span>Event</span> {
data-x="document-state-nav-target-name">navigable target name</span> is cleared.</p>
</li>

<li>
<p>An <dfn data-x="document-state-about-base-url">about base URL</dfn>, which is a
<span>URL</span> or null, initially null.</p>

<p class="note">This will be populated only for "<code data-x="">about:</code>"-schemed
<code>Document</code>s and will be the <span>fallback base URL</span> for those
<code>Document</code>s. It is a snapshot of the initiator <code>Document</code>'s <span>document
base URL</span>.</p>
</li>

<li><p><dfn data-x="document-state-nested-histories">Nested histories</dfn>, a <span>list</span>
of <span data-x="nested history">nested histories</span>, initially an empty
<span>list</span>.</p></li>
Expand Down Expand Up @@ -95587,6 +95609,14 @@ location.href = '#foo';</code></pre>
<dt><dfn data-x="navigation-params-nav-timing-type">navigation timing type</dfn></dt>
domfarolino marked this conversation as resolved.
Show resolved Hide resolved
<dd>a <code>NavigationTimingType</code> used for <span data-x="create the navigation timing
entry">creating the navigation timing entry</span> for the new <code>Document</code></dd>

<dt><dfn data-x="navigation-params-about-base-url">about base URL</dfn></dt>
<dd>
<p>a <span>URL</span> or null</p>

<p class="note">This is used to populate the resulting <code>Document</code>'s <span
data-x="concept-document-about-base-url">about base URL</span>.</p>
</dd>
</dl>

<p class="note">Once a <span>navigation params</span> struct is created, this standard does not
Expand Down Expand Up @@ -95721,6 +95751,9 @@ location.href = '#foo';</code></pre>
<li><p>Let <var>initiatorOriginSnapshot</var> be <var>sourceDocument</var>'s <span
data-x="concept-document-origin">origin</span>.</p></li>

<li><p>Let <var>initiatorBaseURLSnapshot</var> be <var>sourceDocument</var>'s <span>document base
URL</span>.</p></li>

<li id="sandboxLinks">
<p>If <var>sourceDocument</var>'s <span>node navigable</span> is not <span>allowed by
sandboxing to navigate</span> <var>navigable</var> given and <var>sourceSnapshotParams</var>,
Expand Down Expand Up @@ -95988,16 +96021,18 @@ location.href = '#foo';</code></pre>
the document state is finalized.</p>
</li>

<li><p>If <var>url</var> is <code>about:blank</code>, then set <var>documentState</var>'s <span
data-x="document-state-origin">origin</span> to <var>documentState</var>'s <span
data-x="document-state-initiator-origin">initiator origin</span>.</p></li>
<li>
<p>If <var>url</var> is <code>about:blank</code> or <code>about:srcdoc</code>, then:</p>

<li><p>Otherwise, if <var>url</var> is <code>about:srcdoc</code>, then set
<var>documentState</var>'s <span
data-x="document-state-origin">origin</span> to
<var>navigable</var>'s <span data-x="nav-parent">parent</span>'s <span
data-x="nav-document">active document</span>'s <span
data-x="concept-document-origin">origin</span>.</p></li>
<ol>
<li><p>Set <var>documentState</var>'s <span data-x="document-state-origin">origin</span> to
<var>documentState</var>'s <span data-x="document-state-initiator-origin">initiator
origin</span>.</p></li>

<li><p>Set <var>documentState</var>'s <span data-x="document-state-about-base-url">about base
URL</span> to <var>initiatorBaseURLSnapshot</var>.</p></li>
</ol>
domfarolino marked this conversation as resolved.
Show resolved Hide resolved
</li>

<li><p>Let <var>historyEntry</var> be a new <span>session history entry</span>, with its <span
data-x="she-url">URL</span> set to <var>url</var> and its <span
Expand Down Expand Up @@ -96096,6 +96131,9 @@ location.href = '#foo';</code></pre>

<dt><span data-x="navigation-params-nav-timing-type">navigation timing type</span></dt>
<dd>"<code data-x="dom-navigationtimingtype-navigate">navigate</code>"</dd>

<dt><span data-x="navigation-params-about-base-url">about base URL</span></dt>
<dd>null</dd>
domfarolino marked this conversation as resolved.
Show resolved Hide resolved
</dl>
</li>
</ol>
Expand Down Expand Up @@ -96306,6 +96344,10 @@ location.href = '#foo';</code></pre>
<dt><span data-x="document-state-initiator-origin">origin</span></dt>
<dd><var>initiatorOriginSnapshot</var></dd>

<dt><span data-x="document-state-about-base-url">about base URL</span></dt>
<dd><var>oldDocState</var>'s <span data-x="document-state-about-base-url">about base
URL</span></dd>

<dt><span data-x="document-state-resource">resource</span></dt>
<dd>null</dd>

Expand Down Expand Up @@ -96476,6 +96518,10 @@ location.href = '#foo';</code></pre>

<dt><span data-x="navigation-params-nav-timing-type">navigation timing type</span></dt>
<dd>"<code data-x="dom-navigationtimingtype-navigate">navigate</code>"</dd>

<dt><span data-x="navigation-params-about-base-url">about base URL</span></dt>
<dd><var>targetNavigable</var>'s <span data-x="nav-document">active document</span>'s <span
data-x="concept-document-about-base-url">about base URL</span></dd>
</dl>
</li>

Expand Down Expand Up @@ -97778,6 +97824,10 @@ location.href = '#foo';</code></pre>

<dt><span data-x="navigation-params-nav-timing-type">navigation timing type</span></dt>
<dd><var>navTimingType</var></dd>

<dt><span data-x="navigation-params-about-base-url">about base URL</span></dt>
<dd><var>entry</var>'s <span data-x="she-document-state">document state's</span>'s <span
data-x="document-state-about-base-url">about base URL</span></dd>
</dl>
</li>
</ol>
Expand Down Expand Up @@ -98177,6 +98227,9 @@ location.href = '#foo';</code></pre>
<dt><span data-x="document-state-origin">origin</span></dt>
<dd><var>oldDocState</var>'s <span data-x="document-state-origin">origin</span></dd>

<dt><span data-x="document-state-about-base-url">about base URL</span></dt>
<dd><var>oldDocState</var>'s <span data-x="document-state-about-base-url">about base URL</span></dd>

<dt><span data-x="document-state-resource">resource</span></dt>
<dd><var>oldDocState</var>'s <span data-x="document-state-resource">resource</span></dd>

Expand Down Expand Up @@ -98398,6 +98451,10 @@ location.href = '#foo';</code></pre>

<dt><span data-x="navigation-params-nav-timing-type">navigation timing type</span></dt>
<dd><var>navTimingType</var></dd>

<dt><span data-x="navigation-params-about-base-url">about base URL</span></dt>
<dd><var>entry</var>'s <span data-x="she-document-state">document state</span> <span
data-x="document-state-about-base-url">about base URL</span></dd>
</dl>
</li>
</ol>
Expand Down Expand Up @@ -100030,6 +100087,9 @@ location.href = '#foo';</code></pre>

<dt><span>current document readiness</span></dt>
<dd>"<code data-x="">loading</code>"</dd>

<dt><span data-x="concept-document-about-base-url">about base URL</span></dt>
<dd><var>navigationParams</var>'s <span data-x="navigation-params-about-base-URL">about base URL</span></dd>
</dl>
</li>

Expand Down Expand Up @@ -100503,6 +100563,9 @@ new PaymentRequest(&hellip;); // Allowed to use

<dt><span data-x="navigation-params-nav-timing-type">navigation timing type</span></dt>
<dd><var>navTimingType</var></dd>

<dt><span data-x="navigation-params-about-base-url">about base URL</span></dt>
<dd>null</dd>
</dl>
</li>

Expand Down