Skip to content

Commit

Permalink
Use current instead of incumbent + entry in worker constructors
Browse files Browse the repository at this point in the history
As shown by https://settings-object-worker-client-abibrisfdk.now.sh, all
browsers use the current settings object for the fetch client, i.e. the
"outside settings", instead of the incumbent settings object. (Except we
do not know the result in Edge, since they don't seem to send a Referer
header for us to inspect.) Part of whatwg#1430.

As shown by
https://settings-object-worker-client-wellwosyqf.now.sh/entry/entry.html,
all browsers also use the current settings object for URL resolution,
instead of the entry settings object. Part of whatwg#1431.
  • Loading branch information
domenic authored and Alice Boxhall committed Jan 7, 2019
1 parent a89fd45 commit 5be84c7
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -87315,18 +87315,19 @@ interface <dfn>NavigatorOnLine</dfn> {
<pre>&lt;!DOCTYPE html>
&lt;iframe>&lt;/iframe>
&lt;script>
new frames[0].Worker('worker.js');
new frames[0].MessageChannel();
&lt;/script></pre>

<p>When the <code data-x="dom-Worker">Worker()</code> constructor looks up the <span>incumbent
settings object</span> to use for various parts of its algorithm, the <span>topmost script-having
execution context</span> will be that corresponding to the <code>script</code> element: it was
pushed onto the <span>JavaScript execution context stack</span> as part of <span
data-x="js-ScriptEvaluation">ScriptEvaluation</span> during the <span>run a classic script</span>
algorithm. Since there are no Web IDL callback invocations involved, the context's
<span>skip-when-determining-incumbent counter</span> is zero, so it is used to determine the
<span>incumbent settings object</span>; the result is the <span>environment settings
object</span> of <code data-x="">window</code>.</p>
<p>When the <code data-x="dom-MessageChannel">MessageChannel()</code> constructor looks up the
<span>incumbent settings object</span> to use as the <span
data-x="concept-port-owner">owner</span> of the new <code>MessagePort</code> objects, the
<span>topmost script-having execution context</span> will be that corresponding to the
<code>script</code> element: it was pushed onto the <span>JavaScript execution context
stack</span> as part of <span data-x="js-ScriptEvaluation">ScriptEvaluation</span> during the
<span>run a classic script</span> algorithm. Since there are no Web IDL callback invocations
involved, the context's <span>skip-when-determining-incumbent counter</span> is zero, so it is
used to determine the <span>incumbent settings object</span>; the result is the <span>environment
settings object</span> of <code data-x="">window</code>.</p>

<p>(In this example, the <span>environment settings object</span> of <code
data-x="">frames[0]</code> is not involved at all. It is the <span>current settings
Expand Down Expand Up @@ -96955,8 +96956,10 @@ enum <dfn>WorkerType</dfn> { "classic", "module" };
<code>DOMException</code> and abort these steps if the request violates a policy decision (e.g.
if the user agent is configured to not allow the page to start dedicated workers).</p></li>

<li><p><span data-x="parse a url">Parse</span> the <var>scriptURL</var> argument relative to the
<span>entry settings object</span>.</p></li>
<li><p>Let <var>outside settings</var> be the <span>current settings object</span>.</p>

<li><p><span data-x="parse a url">Parse</span> the <var>scriptURL</var> argument relative to
<var>outside settings</var>.</p></li>

<li><p>If this fails, throw a <span>"<code>SyntaxError</code>"</span> <code>DOMException</code>
and abort these steps.</p></li>
Expand All @@ -96968,8 +96971,6 @@ enum <dfn>WorkerType</dfn> { "classic", "module" };
data-x="blob protocol">blob:</code> URLs.</p>
</li>

<li><p>Let <var>outside settings</var> be the <span>incumbent settings object</span>.</p>

<li><p>Let <var>worker</var> be a new <code>Worker</code> object.</p></li>

<li><p><span>Create a new <code>MessagePort</code> object</span> whose <span
Expand Down Expand Up @@ -97030,8 +97031,10 @@ interface <dfn>SharedWorker</dfn> : <span>EventTarget</span> {
<code>DOMException</code> and abort these steps if the request violates a policy decision (e.g.
if the user agent is configured to not allow the page to start shared workers).</p></li>

<li><p><span data-x="parse a url">Parse</span> <var>scriptURL</var> relative to the <span>entry
settings object</span>.</p></li>
<li><p>Let <var>outside settings</var> be the <span>current settings object</span>.</p></li>

<li><p><span data-x="parse a url">Parse</span> <var>scriptURL</var> relative to <var>outside
settings</var>.</p></li>

<li><p>If this fails, throw a <span>"<code>SyntaxError</code>"</span> <code>DOMException</code>
and abort these steps.</p></li>
Expand All @@ -97044,8 +97047,6 @@ interface <dfn>SharedWorker</dfn> : <span>EventTarget</span> {
data-x="blob protocol">blob:</code> URLs.</p>
</li>

<li><p>Let <var>outside settings</var> be the <span>incumbent settings object</span>.</p></li>

<li>

<p>Execute the following substeps atomically:</p>
Expand Down

0 comments on commit 5be84c7

Please sign in to comment.