Skip to content

Commit

Permalink
Compare against storage key when creating a shared worker
Browse files Browse the repository at this point in the history
This is technically not a normative change right now, but it will be when whatwg/storage#144 lands.
  • Loading branch information
wanderview authored Jun 15, 2022
1 parent c3d7391 commit 5aa1a59
Showing 1 changed file with 38 additions and 10 deletions.
48 changes: 38 additions & 10 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -105160,23 +105160,51 @@ interface <dfn interface>SharedWorker</dfn> : <span>EventTarget</span> {
<li><p>Let <var>callerIsSecureContext</var> be true if <var>outside settings</var> is a
<span>secure context</span>; otherwise, false.</p></li>

<li><p>Let <var>outside storage key</var> be the result of running <span>obtain a storage key
for non-storage purposes</span> given <var>outside settings</var>.</p></li>

<li>
<p><span>Enqueue the following steps</span> to the <span>shared worker manager</span>:</p>

<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, <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-WorkerGlobalScope-name">name</span> equals the value of <var>options</var>'s
<code data-x="">name</code> member, then set <var>worker global scope</var> to that
<code>SharedWorkerGlobalScope</code> object.</p>
<p><span data-x="list iterate">For each</span> <var>scope</var> in the list of all
<code>SharedWorkerGlobalScope</code> objects:</p>

<ol>
<li><p>Let <var>worker storage key</var> be the result of running <span>obtain a storage
key for non-storage purposes</span> given <var>scope</var>'s <span>relevant settings
object</span>.</p></li>

<li>
<p>If all of the following conditions are true:</p>

<ul class="brief">
<li><var>worker storage key</var> <span data-x="storage key equal">equals</span>
<var>outside storage key</var>;</li>

<li><var>scope</var>'s <span data-x="dom-WorkerGlobalScope-closing">closing</span> flag
is false;</li>

<li><var>scope</var>'s <span data-x="concept-SharedWorkerGlobalScope-constructor-url">
constructor url</span> <span data-x="concept-url-equals">equals</span>
<var>urlRecord</var>; and</li>

<li><var>scope</var>'s <span data-x="concept-WorkerGlobalScope-name">name</span> equals
the value of <var>option</var>'s <code data-x="">name</code> member</li>
</ul>

<p>then:</p>

<ol>
<li><p>Set <var>worker global scope</var> to <var>scope</var>.</p></li>

<li><p><span>Break</span>.</p></li>
</ol>
</li>
</ol>

<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
Expand Down

0 comments on commit 5aa1a59

Please sign in to comment.