Skip to content

Adapt to Fetch's data URL changes #1782

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

Merged
merged 2 commits into from
Oct 10, 2016
Merged
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
61 changes: 40 additions & 21 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2840,7 +2840,6 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<li><dfn data-x="concept-request-priority" data-x-href="https://fetch.spec.whatwg.org/#concept-request-priority">priority</dfn></li>
<li><dfn data-dfn-for="request" data-x="concept-request-origin" data-x-href="https://fetch.spec.whatwg.org/#concept-request-origin">origin</dfn></li>
<li><dfn data-x-href="https://fetch.spec.whatwg.org/#omit-origin-header-flag">omit-<code>Origin</code>-header flag</dfn></li>
<li><dfn data-x-href="https://fetch.spec.whatwg.org/#same-origin-data-url-flag">same-origin data-URL flag</dfn></li>
<li><dfn data-x="concept-request-referrer" data-x-href="https://fetch.spec.whatwg.org/#concept-request-referrer">referrer</dfn></li>
<li><dfn data-x-href="https://fetch.spec.whatwg.org/#synchronous-flag">synchronous flag</dfn></li>
<li><dfn data-x="concept-request-mode" data-x-href="https://fetch.spec.whatwg.org/#concept-request-mode">mode</dfn></li>
Expand Down Expand Up @@ -26172,8 +26171,6 @@ was an English &lt;a href="/wiki/Music_hall">music hall&lt;/a> singer, ...</pre>
<code>picture</code></span>, set <var>request</var>'s <span
data-x="concept-request-initiator">initiator</span> to "<code data-x="">imageset</code>".</p>

<p>&#x231B; Set <var>request</var>'s <span>same-origin data-URL flag</span>.</p>

<p>&#x231B; Set <var>request</var>'s
<span data-x="concept-request-referrer-policy">referrer policy</span> to the current state of
the element's <code data-x="attr-img-referrerpolicy">referrerpolicy</code> attribute.</p>
Expand Down Expand Up @@ -27037,8 +27034,6 @@ was an English &lt;a href="/wiki/Music_hall">music hall&lt;/a> singer, ...</pre>
data-x="">imageset</code>", and set <var>request</var>'s <span>synchronous
flag</span>.</p></li>

<li><p>Set <var>request</var>'s <span>same-origin data-URL flag</span>.</p></li>

<li><p>Set <var>request</var>'s
<span data-x="concept-request-referrer-policy">referrer policy</span> to the current state of
the element's <code data-x="attr-img-referrerpolicy">referrerpolicy</code> attribute.</p></li>
Expand Down Expand Up @@ -96554,7 +96549,9 @@ interface <dfn>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope</span> {

<p>A <code>SharedWorkerGlobalScope</code> object has an associated <dfn
data-dfn-for="SharedWorkerGlobalScope"
data-x="concept-SharedWorkerGlobalScope-constructor-url">constructor url</dfn> and <dfn
data-x="concept-SharedWorkerGlobalScope-constructor-origin">constructor origin</dfn>, <dfn
data-dfn-for="SharedWorkerGlobalScope"
data-x="concept-SharedWorkerGlobalScope-constructor-url">constructor url</dfn>, and <dfn
data-dfn-for="SharedWorkerGlobalScope"
data-x="concept-SharedWorkerGlobalScope-name">name</dfn>. They are initialized when the
<code>SharedWorkerGlobalScope</code> object is created, in the <span>run a worker</span>
Expand Down Expand Up @@ -96767,6 +96764,11 @@ interface <dfn>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope</span> {
<p>If <var>is shared</var> is true, then:</p>

<ol>
<li><p>Set <var>worker global scope</var>'s <span
data-x="concept-SharedWorkerGlobalScope-constructor-origin">constructor origin</span> to
<var>outside settings</var>'s <span
data-x="concept-settings-object-origin">origin</span>.</p></li>

<li><p>Set <var>worker global scope</var>'s <span
data-x="concept-SharedWorkerGlobalScope-constructor-url">constructor url</span> to
<var>url</var>.</p></li>
Expand Down Expand Up @@ -97147,7 +97149,7 @@ interface <dfn>AbstractWorker</dfn> {
<dt>The <span>API URL character encoding</span></dt>
<dd>

<p>Return UTF-8.</p>
<p>Return <span>UTF-8</span>.</p>

</dd>

Expand All @@ -97162,7 +97164,10 @@ interface <dfn>AbstractWorker</dfn> {
<dt>The <span data-x="concept-settings-object-origin">origin</span></dt>
<dd>

<p>Return <var>inherited origin</var>.</p>
<p>Return a unique <span data-x="concept-origin-opaque">opaque origin</span> if <var>worker
global scope</var>'s <span data-x="concept-WorkerGlobalScope-url">url</span>'s <span
data-x="concept-url-scheme">scheme</span> is "<code data-x="">data</code>", and <var>inherited
origin</var> otherwise.</p>

</dd>

Expand Down Expand Up @@ -97303,8 +97308,10 @@ enum <dfn>WorkerType</dfn> { "classic", "module" };
<li>
<p>Let <var>worker URL</var> be the <span>resulting URL record</span>.</p>

<p class="note">Any <span data-x="same origin">same-origin</span> URL will do, including <code
data-x="blob protocol">blob:</code> URLs.</p>
<p class="note">Any <span data-x="same origin">same-origin</span> URL (including <code
data-x="blob protocol">blob:</code> URLs) can be used. <code data-x="data protocol">data:</code>
URLs can also be used, but they create a worker with an <span
Copy link
Member

@domenic domenic Oct 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "but they create" instead of "but create"; both are correct but the former reads a bit easier. Here and below.

data-x="concept-origin-opaque">opaque origin</span>.</p>
</li>

<li><p>Let <var>worker</var> be a new <code>Worker</code> object.</p></li>
Expand Down Expand Up @@ -97378,8 +97385,10 @@ interface <dfn>SharedWorker</dfn> : <span>EventTarget</span> {
<li>
<p>Otherwise, let <var>urlRecord</var> be the <span>resulting URL record</span>.</p>

<p class="note">Any <span data-x="same origin">same-origin</span> URL will do, including <code
data-x="blob protocol">blob:</code> URLs.</p>
<p class="note">Any <span data-x="same origin">same-origin</span> URL (including <code
data-x="blob protocol">blob:</code> URLs) can be used. <code data-x="data protocol">data:</code>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we should add a note here that explains how it's possible for constructor url to be equal but constructor origin to be different. Something like: "The reason we compare both constructor url and constructor origin is that data: URLs cause the created worker settings object to have a unique opaque origin, instead of one derived from the constructor url. This ensures that using the same data: URL multiple times creates separate SharedWorkerGlobalScope instances, as desired." (Hope I got that right...)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not quite right. The same data URL can be used to get the same instance, but we don't want to allow that across documents of different origins. Therefore we store the origin of the constructor. So only if the constructor origin is same-origin can the URL be equal.

URLs can also be used, but they create a worker with an <span
data-x="concept-origin-opaque">opaque origin</span>.</p>
</li>

<li><p>Let <var>worker</var> be a new <code>SharedWorker</code> object.</p></li>
Expand All @@ -97400,15 +97409,25 @@ interface <dfn>SharedWorker</dfn> : <span>EventTarget</span> {
<ol>
<li><p>Let <var>worker global scope</var> be null.</p></li>

<li><p>If there exists a <code>SharedWorkerGlobalScope</code> object whose <span
data-x="dom-WorkerGlobalScope-closing">closing</span> flag is false, whose <span
data-x="concept-SharedWorkerGlobalScope-name">name</span> is exactly equal to <var>name</var>,
whose <span data-x="concept-SharedWorkerGlobalScope-constructor-url">constructor url</span>
<span data-x="concept-url-equals">equals</span> <var>urlRecord</var>, and whose <span>relevant
settings object</span>'s <span data-x="concept-settings-object-origin">origin</span> is
<span>same origin</span> with <var>outside settings</var>'s <span
data-x="concept-settings-object-origin">origin</span>, then set <var>worker global scope</var>
to that <code>SharedWorkerGlobalScope</code> object.</p></li>
<li>
<p>If there exists a <code>SharedWorkerGlobalScope</code> object whose <span
data-x="dom-WorkerGlobalScope-closing">closing</span> flag is false, <span
data-x="concept-SharedWorkerGlobalScope-constructor-origin">constructor origin</span> is
<span>same origin</span> with <var>outside settings</var>'s <span
data-x="concept-settings-object-origin">origin</span>, <span
data-x="concept-SharedWorkerGlobalScope-constructor-url">constructor url</span> <span
data-x="concept-url-equals">equals</span> <var>urlRecord</var>, and <span
data-x="concept-SharedWorkerGlobalScope-name">name</span> is <var>name</var>, then set
<var>worker global scope</var> to that <code>SharedWorkerGlobalScope</code> object.</p>

<p class="note"><code data-x="data protocol">data:</code> URLs create a worker with an <span
data-x="concept-origin-opaque">opaque origin</span>. Both the <span
data-x="concept-SharedWorkerGlobalScope-constructor-origin">constructor origin</span> and
<span data-x="concept-SharedWorkerGlobalScope-constructor-url">constructor url</span> are
compared so the same <code data-x="data protocol">data:</code> URL can be used within an
<span>origin</span> to get to the same <code>SharedWorkerGlobalScope</code> object, but cannot
be used to bypass the <span>same origin</span> restriction.</p>
</li>

<li>
<p>If <var>worker global scope</var> is not null, but the user agent has been
Expand Down