Skip to content

Commit

Permalink
work on records for module expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Nov 22, 2024
1 parent d35921a commit d25d1b6
Showing 1 changed file with 23 additions and 38 deletions.
61 changes: 23 additions & 38 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -120675,13 +120675,13 @@ interface <dfn interface>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope
<h4 id="worker-processing-model"><span id="processing-model-10"></span>Processing model</h4>

<p>When a user agent is to <dfn export>run a worker</dfn> for a script with <code>Worker</code> or
<code>SharedWorker</code> object <var>worker</var>, <span>URL</span> or <span>module script</span>
<var>urlOrModuleScript</var>, <span>environment settings object</span> <var>outside settings</var>,
<code>SharedWorker</code> object <var>worker</var>, <span>URL</span> or <span>module record</span>
<var>urlOrModuleRecord</var>, <span>environment settings object</span> <var>outside settings</var>,
<code>MessagePort</code> <var>outside port</var>, and a <code>WorkerOptions</code> dictionary
<var>options</var>, it must run the following steps.</p>

<ol>
<li><p>Assert: If <var>urlOrModuleScript</var> is a <span>URL</span>, then<var>options</var>'s
<li><p>Assert: If <var>urlOrModuleRecord</var> is a <span>URL</span>, then<var>options</var>'s
<code data-x="">type</code> member is not "<code data-x="">classic</code>"</p></li>

<li><p>Let <var>is shared</var> be true if <var>worker</var> is a <code>SharedWorker</code>
Expand Down Expand Up @@ -120736,11 +120736,11 @@ interface <dfn interface>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope
<var>outside settings</var>'s <span
data-x="concept-settings-object-origin">origin</span>.</p></li>

<li><p>Assert: <var>urlOrModuleScript</var> is a <span>URL</span>.</p></li>
<li><p>Assert: <var>urlOrModuleRecord</var> is a <span>URL</span>.</p></li>

<li><p>Set <var>worker global scope</var>'s <span
data-x="concept-SharedWorkerGlobalScope-constructor-url">constructor url</span> to
<var>urlOrModuleScript</var>.</p></li>
<var>urlOrModuleRecord</var>.</p></li>

<li><p>Set <var>worker global scope</var>'s <span
data-x="concept-WorkerGlobalScope-type">type</span> to the value of <var>options</var>'s
Expand All @@ -120757,7 +120757,7 @@ interface <dfn interface>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope
shared</var> is true, and "<code data-x="">worker</code>" otherwise.</p></li>

<li>
<p>If <var>urlOrModuleScript</var> is a <span>URL</span>, then obtain <var>script</var> by
<p>If <var>urlOrModuleRecord</var> is a <span>URL</span>, then obtain <var>script</var> by
switching on the value of <var>options</var>'s <code data-x="">type</code> member:</p>

<dl class="switch">
Expand Down Expand Up @@ -120876,13 +120876,15 @@ interface <dfn interface>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope
<p>Otherwise,</p>

<ol>
<li><p>Let <var>baseURL</var> be <var>urlOrModuleScript</var>'s <span
<li><p>Let <var>script</var> be <var>urlOrModuleRecord</var>.[[HostDefined]]</span>.</p></li>

<li><p>Let <var>baseURL</var> be <var>script</var>'s <span
data-x="concept-script-base-url">base URL</span></p></li>

<li>
<p>If <span>baseURL</span> is null, then:
<ul>
<li><p>Assert: <var>urlOrModuleScript</var>'s <span>rooted source</span> property is false.
<li><p>Assert: <var>script</var>'s <span>rooted source</span> property is false.
</p></li>

<li><p>Set <var>baseURL</var> to <var>outside settings</var>'s <span>API base URL</span></p>
Expand Down Expand Up @@ -120911,43 +120913,28 @@ interface <dfn interface>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope
string, and <span data-x="concept-script-fetch-options-fetch-priority">fetch priority</span> is
"<code data-x="">auto</code>".</p>

<li><p>Let <var>moduleRecord</var> be <var>urlOrModuleScript</var>'s <span
data-x="concept-script-record">record</span>.</p></li>

<li>
<p>If <var>urlOrModuleScript</var> is a <span>JavaScript module script</span> then:</p>
<p>If <var>urlOrModuleRecord</var> is a <span>Source Text Module Record</span> then:</p>

<ol>
<li><p>Assert: <var>moduleRecord</var> is a <span>Source Text Module Record</span>.</p></li>
<li><p>Let <var>sourceText</var> be <var>moduleRecord</var>.[[SourceText]].</p></li>
<li><p>Let <var>sourceText</var> be <var>urlOrModuleRecord</var>.[[SourceText]].</p></li>
<li><p>Set <var>target module</var> to the result of <span>creating a JavaScript module script
</span> with <var>sourceText</var>, <var>inside settings</var>, <var>urlOrModuleScript</var>'s
<span>base URL</span>, <var>options</var> and <var>urlOrModuleScript</var>'s
</span> with <var>sourceText</var>, <var>inside settings</var>, <var>urlOrModuleRecord</var>'s
<span>base URL</span>, <var>options</var> and <var>urlOrModuleRecord</var>'s
<span>rooted source</span>.</li></p>
</ol>
</li>
<li>
<p>Otherwise, <var>urlOrModuleScript</var> is a <span>WebAssembly module script</span>, then:
<p>Otherwise, <var>urlOrModuleRecord</var> is a <span>WebAssembly Module Record</span>, then:
</p>

<ol>
<li><p>Assert: <var>moduleRecord</var> is a <span>WebAssembly Module Record</span>.</p></li>
<li><p>Let <var>wasmModule</var> be <var>moduleRecord</var>.[[WebAssemblyModule]].</p></li>
<var>script</var>.[[SourceTextModuleRecord]].[[SourceText]].</p></li>
<li><p>Let <var>wasmModule</var> be <var>urlOrModuleRecord</var>.[[WebAssemblyModule]].</p>
</li>
<li><p>Let <var>bytes</var> be <var>wasmModule</var>.[[Bytes]].</p></li>
<li><p>Set <var>target module</var> to the result of <span>creating a JavaScript module script
</span> with <var>sourceText</var>, <var>inside settings</var>, <var>urlOrModuleScript</var>'s
<span>base URL</span>, and <var>urlOrModuleScript</var>'s <span>rooted source</span>.</li></p>
</ol>
<ol>
<li><p>Let <var>wasmModule</var> be
<li><p>Set <var>serialized</var>.[[WebAssemblyModule]] to a new empty <span>record</span>.
<li><p>Perform the <span>serialization steps</span> for a WebAssembly.Module given <var>script
</var>'s <span></span>record

<li><p>Set <var>target module</var> to the result of <span>creating a WebAssembly module
script</span> with <var>wasmModule</var>.[[Bytes]], <var>inside settings</var>, <var>
urlOrModuleScript</var>'s <span>base URL</span>, <var>options</var>, and
<var>urlOrModuleScript</var>'s <span> rooted source</span>.</p></li>
</span> with <var>sourceText</var>, <var>inside settings</var>, <var>urlOrModuleRecord</var>'s
<span>base URL</span>, and <var>urlOrModuleRecord</var>'s <span>rooted source</span>.</li></p>
</ol>
</li>

Expand Down Expand Up @@ -121399,10 +121386,8 @@ enum <dfn enum>WorkerType</dfn> { "classic", "module", "auto" };
<p>If <var>module</var> is not <code data-x="">~not-a-module~</code>, then:</p>

<ol>
<li><p>Let <var>moduleScript</var> be <var>module</var>.[[HostDefined]]</p></li>

<li><p><span>Assert</span>: <var>moduleScript</var> is either a <span>JavaScript module script
</span> or a <span>WebAssembly module script</span>.</p></li>
<li><p><span>Assert</span>: <var>module</var> is either a <span>Source Text Module Record
</span>or a <span>WebAssembly Module Record</span>.</p></li>

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

Expand All @@ -121420,7 +121405,7 @@ enum <dfn enum>WorkerType</dfn> { "classic", "module", "auto" };
<p>Run this step <span>in parallel</span>:</p>

<ol>
<li><p><span>Run a worker</span> given <var>worker</var>, <var>moduleScript</var>, <var>
<li><p><span>Run a worker</span> given <var>worker</var>, <var>module</var>, <var>
outside settings</var>, <var>outside port</var>, and <var>options</var>.</p></li>
</ol>
</li>
Expand Down

0 comments on commit d25d1b6

Please sign in to comment.