Skip to content

Commit 18c891f

Browse files
committed
Regression fix: add back origin check for shared workers
Shared workers always needs to perform a same-origin check since if the SharedWorkerGlobalScope already exists, no fetching is done, so we cannot count on fetching to do the same-origin check. Additionally, module workers allow cross-origin fetches, but we still want to ensure a distinct SharedWorkerGlobalScope per origin. This also cleans up “set up a worker environment settings object” with a more explicit way of referencing the needed environment settings object. This regressed through #339 (though that change also had to be made for module workers). Fixes #1321.
1 parent 0678e3d commit 18c891f

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

source

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95560,7 +95560,8 @@ interface <dfn>WorkerGlobalScope</dfn> : <span>EventTarget</span> {
9556095560
</li>
9556195561

9556295562
<li><p><span>Set up a worker environment settings object</span> with <var>realm execution
95563-
context</var>, and let <var>inside settings</var> be the result.</p></li>
95563+
context</var> and <var>outside settings</var>, and let <var>inside settings</var> be the
95564+
result.</p></li>
9556495565

9556595566
<li><p>Let <var>destination</var> be "<code data-x="">sharedworker</code>" if <var>is
9556695567
shared</var> is true, and "<code data-x="">worker</code>" otherwise.</p></li>
@@ -95856,16 +95857,17 @@ interface <dfn>AbstractWorker</dfn> {
9585695857
<h5>Script settings for workers</h5>
9585795858

9585895859
<p>When the user agent is required to <dfn>set up a worker environment settings object</dfn>,
95859-
given a <span>JavaScript execution context</span> <var>execution context</var>, it must run the
95860-
following steps:</p>
95860+
given a <span>JavaScript execution context</span> <var>execution context</var> and
95861+
<span>environment settings object</span> <var>outside settings</var>, it must run the following
95862+
steps:</p>
9586195863

9586295864
<ol>
9586395865

95864-
<li><p>Let <var>inherited responsible browsing context</var> be the <span>responsible
95865-
browsing context</span> specified by the <span>incumbent settings object</span>.</p></li>
95866+
<li><p>Let <var>inherited responsible browsing context</var> be <var>outside settings</var>'s
95867+
<span>responsible browsing context</span>.</p></li>
9586695868

95867-
<li><p>Let <var>inherited origin</var> be the <span>origin</span> specified by the
95868-
<span>incumbent settings object</span>.</p></li>
95869+
<li><p>Let <var>inherited origin</var> be <var>outside settings</var>'s
95870+
<span>origin</span>.</p></li>
9586995871

9587095872
<li><p>Let <var>worker event loop</var> be a newly created <span>event
9587195873
loop</span>.</p></li>
@@ -96179,8 +96181,10 @@ interface <dfn>SharedWorker</dfn> : <span>EventTarget</span> {
9617996181
<li><p>If there exists a <code>SharedWorkerGlobalScope</code> object whose <span
9618096182
data-x="dom-WorkerGlobalScope-closing">closing</span> flag is false, whose <span
9618196183
data-x="concept-SharedWorkerGlobalScope-name">name</span> is exactly equal to <var>name</var>,
96182-
and whose <span data-x="concept-SharedWorkerGlobalScope-constructor-url">constructor url</span>
96183-
is equal to <var>urlString</var>, then let <var>worker global scope</var> be that
96184+
whose <span data-x="concept-SharedWorkerGlobalScope-constructor-url">constructor url</span> is
96185+
equal to <var>urlString</var>, and whose <span>relevant settings object</span>'s
96186+
<span>origin</span> is <span>same origin</span> with <var>outside settings</var>'s
96187+
<span>origin</span>, then let <var>worker global scope</var> be that
9618496188
<code>SharedWorkerGlobalScope</code> object.</p></li>
9618596189

9618696190
<li>

0 commit comments

Comments
 (0)