Skip to content

Commit

Permalink
Revert "[spec] Normative: Remove same-agent-cluster restriction for M…
Browse files Browse the repository at this point in the history
…odule deserialization"

The same agent cluster restriction is present in the case of serializing
within memory. Also add a note about how this restricts serialization to be
within an origin.
  • Loading branch information
littledan committed Apr 11, 2018
1 parent bdada16 commit 6432d2a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions document/web-api/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,20 @@ The [=serialization steps=], given |value|, |serialized|, and |forStorage|, are:

1. Set |serialized|.\[[Bytes]] to the [=sub-serialization=] of |value|.\[[Bytes]].

1. If |forStorage| is *false*, set |serialized|.\[[AgentCluster]] to the
[=current Realm=]'s corresponding [=agent cluster=].

The [=deserialization steps=], given |serialized| and |value|, are:

1. Let |bytes| be the [=sub-deserialization=] of |serialized|.\[[Bytes]].

1. Set |value|.\[[Bytes]] to |bytes|.

1. If |serialized| has an \[[AgentCluster]] field, and if |targetRealm|'s
corresponding [=agent cluster=] is not
|serialized|.\[[AgentCluster]], then throw a
"<a exception>DataCloneError</a>" {{DOMException}}.

1. [=Compile a WebAssembly module=] from |bytes| and set |value|.\[[Module]] to the result.

Engines should attempt to share/reuse internal compiled code when performing
Expand All @@ -165,6 +173,10 @@ Given the above engine optimizations, structured serialization provides develope
explicit control over both compiled-code caching and cross-window/worker code
sharing.

Note: The web platform does not permit cross-origin sharing of serialized Modules: in the
case of |forStorage| being true, IndexedDB separates storage per origin; in the case of
|forStorage| being false, agent clusters in HTML do not span multiple origins.

<h2 id="conventions">Developer-Facing Display Conventions</h2>

Browsers, JavaScript engines, and offline tools have common ways of referring to
Expand Down

0 comments on commit 6432d2a

Please sign in to comment.