Skip to content

Commit

Permalink
finish up serialization and deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Nov 20, 2024
1 parent 55929e3 commit 28b5a43
Showing 1 changed file with 49 additions and 3 deletions.
52 changes: 49 additions & 3 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -9830,6 +9830,23 @@ interface <dfn interface>DOMStringList</dfn> {
</ol>
</li>

<li>
<p>Otherwise, if <var>value</var> has a [[SourceTextModuleRecord]] internal slot, then:</p>

<ol>
<li><p>If <var>forStorage</var> is true, then throw a
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>Let <var>moduleScript</var> be <var>value</var>.[[SourceTextModuleRecord]].
[[HostDefined]].</p></li>

<li><p>Set <var>serialized</var> to { [[Type]]: "SourceTextModule", [[SourceText]]: <var>value
</var>.[[SourceTextModuleRecord]].[[SourceText]], [[BaseURL]]: <var>moduleScript</var>'s
<span>base URL</span>, [[AgentCluster]]: the <span>surrounding agent</span>'s <span>agent
cluster</span> }.</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>value</var> has an [[ErrorData]] internal slot and <var>value</var> is not
a <span>platform object</span>, then:</p>
Expand Down Expand Up @@ -10233,6 +10250,34 @@ o.myself = o;</code></pre>
</ol>
</li>

<li><p>Set <var>serialized</var> to { [[Type]]: "SourceTextModule", [[SourceText]]:
<var>value</var>.[[SourceTextModuleRecord]].[[SourceText]], [[URL]]: <var>moduleScript</var>'s
<span>base URL</span>, [[AgentCluster]]: the <span>surrounding
agent</span>'s <span>agent cluster</span> }.</p></li>

<li>
<p>Otherwise, if <var>serialized</var>.[[Type]] is "SourceTextModule", then:</p>

<ol>
<li><p>If <var>targetRealm</var>'s corresponding <span>agent cluster</span> is not
<var>serialized</var>.[[AgentCluster]], then throw a
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p>

<li><p>Let <var>settingsObject</var> be <var>targetRealm</var>'s <span>environment settings
object</span>.</p></li>

<li><p>Let <var>options</var> be a the <span>default script fetch options</span>.</p></li>

<li><p>Let <var>moduleScript</var> be the result of <span>creating a JavaScript module script
</span>using <var>serialized</var>.[[SourceText]], <var>settingsObject</var>,
<var>serialized</var>.[[BaseURL]], <var>options</var>, and false.</p></li>

<li><p>Let <var>moduleRecord</var> be <var>moduleScript</var>'s record.</p></li>

<li><p>Set <var>value</var> to <var>moduleRecord</var>.GetModuleSource().</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>serialized</var>.[[Type]] is "Map", then:</p>

Expand Down Expand Up @@ -120760,7 +120805,8 @@ interface <dfn interface>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope
<li><p>Let <var>sourceText</var> be <var>moduleRecord</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>, and <var>urlOrModuleScript</var>'s <span>rooted source</span>.</li></p>
<span>base URL</span>, <var>options</var> and <var>urlOrModuleScript</var>'s
<span>rooted source</span>.</li></p>
</ol>
</li>
<li>
Expand All @@ -120783,8 +120829,8 @@ interface <dfn interface>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope

<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>, and <var>urlOrModuleScript</var>'s <span>
rooted source</span>.</p></li>
urlOrModuleScript</var>'s <span>base URL</span>, <var>options</var>, and
<var>urlOrModuleScript</var>'s <span> rooted source</span>.</p></li>
</ol>
</li>

Expand Down

0 comments on commit 28b5a43

Please sign in to comment.