[html5] r6273 - [giow] (1) add infrastructure to postMessage() to support ArrayBuffer cloning Fi [...]
whatwg at whatwg.org
whatwg at whatwg.org
Thu Jun 23 16:48:48 PDT 2011
Author: ianh
Date: 2011-06-23 16:48:46 -0700 (Thu, 23 Jun 2011)
New Revision: 6273
Modified:
complete.html
index
source
Log:
[giow] (1) add infrastructure to postMessage() to support ArrayBuffer cloning
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=12947
Modified: complete.html
===================================================================
--- complete.html 2011-06-21 23:30:59 UTC (rev 6272)
+++ complete.html 2011-06-23 23:48:46 UTC (rev 6273)
@@ -239,7 +239,7 @@
<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1>Web Applications 1.0</h1>
- <h2 class="no-num no-toc">Living Standard — Last Updated 21 June 2011</h2>
+ <h2 class="no-num no-toc">Living Standard — Last Updated 23 June 2011</h2>
</hgroup><dl><dt>Multiple-page version:</dt>
<dd><a href=http://www.whatwg.org/specs/web-apps/current-work/complete/>http://www.whatwg.org/specs/web-apps/current-work/complete/</a></dd>
<dt>One-page version:</dt>
@@ -377,12 +377,13 @@
<li><a href=#htmlpropertiescollection-0><span class=secno>2.8.2.5 </span>HTMLPropertiesCollection</a></ol></li>
<li><a href=#domtokenlist-0><span class=secno>2.8.3 </span>DOMTokenList</a></li>
<li><a href=#domsettabletokenlist-0><span class=secno>2.8.4 </span>DOMSettableTokenList</a></li>
- <li><a href=#safe-passing-of-structured-data><span class=secno>2.8.5 </span>Safe passing of structured data</a></li>
- <li><a href=#domstringmap-0><span class=secno>2.8.6 </span>DOMStringMap</a></li>
- <li><a href=#domelementmap-0><span class=secno>2.8.7 </span>DOMElementMap</a></li>
- <li><a href=#dom-feature-strings><span class=secno>2.8.8 </span>DOM feature strings</a></li>
- <li><a href=#exceptions><span class=secno>2.8.9 </span>Exceptions</a></li>
- <li><a href=#garbage-collection><span class=secno>2.8.10 </span>Garbage collection</a></ol></li>
+ <li><a href=#transferable-objects><span class=secno>2.8.5 </span>Transferable objects</a></li>
+ <li><a href=#safe-passing-of-structured-data><span class=secno>2.8.6 </span>Safe passing of structured data</a></li>
+ <li><a href=#domstringmap-0><span class=secno>2.8.7 </span>DOMStringMap</a></li>
+ <li><a href=#domelementmap-0><span class=secno>2.8.8 </span>DOMElementMap</a></li>
+ <li><a href=#dom-feature-strings><span class=secno>2.8.9 </span>DOM feature strings</a></li>
+ <li><a href=#exceptions><span class=secno>2.8.10 </span>Exceptions</a></li>
+ <li><a href=#garbage-collection><span class=secno>2.8.11 </span>Garbage collection</a></ol></li>
<li><a href=#namespaces><span class=secno>2.9 </span>Namespaces</a></ol></li>
<li><a href=#dom><span class=secno>3 </span>Semantics, structure, and APIs of HTML documents</a>
<ol>
@@ -8630,23 +8631,61 @@
</div>
+
+ <h4 id=transferable-objects><span class=secno>2.8.5 </span>Transferable objects</h4>
+
+ <p>Some objects support being copied and closed in one operation.
+ This is called <i>transferring</i> the object, and is used in
+ particular to transfer ownership of unsharable or expensive
+ resources across worker boundaries.</p>
+
+ <pre class=idl>[NoInterfaceObject]
+interface <dfn id=transferable>Transferable</dfn> { };</pre>
+
<div class=impl>
- <h4 id=safe-passing-of-structured-data><span class=secno>2.8.5 </span>Safe passing of structured data</h4>
+ <p>To <dfn id=transfer-a-transferable-object>transfer a <code>Transferable</code> object</dfn> to a
+ new owner, the user agent must run the steps defined for the type of
+ object in question. The steps will return a new object of the same
+ type, and will permanently neuter the original object. (This is an
+ irreversible and non-idempotent operation; once an object has been
+ transferred, it cannot be transferred, or indeed used, again.)</p>
+ </div>
+
+ <p>The following <code><a href=#transferable>Transferable</a></code> types exist:</p>
+
+ <ul class=brief><li><code><a href=#messageport>MessagePort</a></code>
+ <!--<li><code>ArrayBuffer</code>-->
+ </ul><div class=impl><!-- should move down two sections XXX -->
+
+ <h4 id=safe-passing-of-structured-data><span class=secno>2.8.6 </span>Safe passing of structured data</h4>
+
<p>When a user agent is required to obtain a <dfn id=structured-clone>structured
- clone</dfn> of a value, it must run the following algorithm, which
- either returns a separate value, or throws an exception.</p>
+ clone</dfn> of a value, optionally with a <i>transfer map</i>, it
+ must run the following algorithm, which either returns a separate
+ value, or throws an exception. If a <i>transfer map</i> is provided,
+ it consists of a association list of pairs of
+ <code><a href=#transferable>Transferable</a></code> objects; in each pair, one is the
+ <em>old</em> object and one is the <em>new</em> object.</p>
<ol><li><p>Let <var title="">input</var> be the value being
cloned.</li>
+ <li><p>Let <var title="">transfer map</var> be the <i>transfer
+ map</i> passed to the algorithm, if any, or the empty list
+ otherwise.</li>
+
<li><p>Let <var title="">memory</var> be an association list of
pairs of objects, initially empty. This is used to handle duplicate
references. In each pair of objects, one is called the
<em>source</em> object and the other the <em>destination</em>
object.</li>
+ <li><p>For each pair of objects in <var title="">transfer
+ map</var>, add a mapping from the old object (the source object) to
+ the new object (the destination object) to <var title="">memory</var>.</li>
+
<li><p>Let <var title="">output</var> be the value resulting from
calling the <a href=#internal-structured-cloning-algorithm>internal structured cloning algorithm</a> with
<var title="">input</var> as the "<var title="">input</var>"
@@ -8721,6 +8760,16 @@
<dd><p>Let <var title="">output</var> be a newly constructed <code><a href=#filelist>FileList</a></code> object containing a list of newly constructed <code><a href=#file>File</a></code> objects corresponding to the same underlying data as those in <var title="">input</var>, maintaining their relative order.</dd>
+<!--(when we add this, make sure to throw DATA_CLONE_ERR if these objects are already closed)
+ <dt>If <var title="">input</var> is an <code>ArrayBuffer</code> object</dt>
+
+ <dd><p>...</p></dd>
+
+ <dt>If <var title="">input</var> is an <code>ArrayBufferView</code> object</dt>
+
+ <dd><p>...</p></dd>
+-->
+
<dt>If <var title="">input</var> is an Array object</dt>
<dd><p>Let <var title="">output</var> be a newly constructed empty <code>Array</code> object.</dd>
@@ -8777,7 +8826,7 @@
</div>
- <h4 id=domstringmap-0><span class=secno>2.8.6 </span>DOMStringMap</h4>
+ <h4 id=domstringmap-0><span class=secno>2.8.7 </span>DOMStringMap</h4>
<p>The <code><a href=#domstringmap>DOMStringMap</a></code> interface represents a set of
name-value pairs. It exposes these using the scripting language's
@@ -8861,7 +8910,7 @@
<!--CSSREF-->
- <h4 id=domelementmap-0><span class=secno>2.8.7 </span>DOMElementMap</h4>
+ <h4 id=domelementmap-0><span class=secno>2.8.8 </span>DOMElementMap</h4>
<p>The <code><a href=#domelementmap>DOMElementMap</a></code> interface represents a set of
name-element mappings. It exposes these using the scripting
@@ -8910,7 +8959,7 @@
<!--CSSREF-->
- <h4 id=dom-feature-strings><span class=secno>2.8.8 </span>DOM feature strings</h4>
+ <h4 id=dom-feature-strings><span class=secno>2.8.9 </span>DOM feature strings</h4>
<p>DOM3 Core defines mechanisms for checking for interface support,
and for obtaining implementations of interfaces, using <a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMFeatures>feature
@@ -8932,7 +8981,7 @@
</div>
- <h4 id=exceptions><span class=secno>2.8.9 </span>Exceptions</h4>
+ <h4 id=exceptions><span class=secno>2.8.10 </span>Exceptions</h4>
<p>The following are <code><a href=#domexception>DOMException</a></code> codes. <a href=#refsDOMCORE>[DOMCORE]</a></p>
@@ -8977,7 +9026,7 @@
<div class=impl>
- <h4 id=garbage-collection><span class=secno>2.8.10 </span>Garbage collection</h4>
+ <h4 id=garbage-collection><span class=secno>2.8.11 </span>Garbage collection</h4>
<p>There is an <dfn id=implied-strong-reference>implied strong reference</dfn> from any IDL
attribute that returns a pre-existing object to that object.</p>
@@ -10095,7 +10144,7 @@
and return true from the method.<!--SYNCLOAD Otherwise, continue running these
steps without yet returning.--></li>
- <li><p>Let <var title="">result</var> be an <code><a href=#document>Document</a></code>
+ <li><p>Let <var title="">result</var> be a <code><a href=#document>Document</a></code>
object.</li>
<li><p>Let <var title="">success</var> be false.</li>
@@ -61604,7 +61653,7 @@
any <a href=#dom-showmodaldialog title=dom-showModalDialog>showModalDialog</a>(in DOMString url, in optional any argument<!--, in optional DOMString features-->);
<!--POSTMSG--> // <a href=#web-messaging>cross-document messaging</a>
- void <a href=#dom-window-postmessage title=dom-window-postMessage>postMessage</a>(in any message, in DOMString targetOrigin, in optional sequence<<a href=#messageport>MessagePort</a>> ports);
+ void <a href=#dom-window-postmessage title=dom-window-postMessage>postMessage</a>(in any message, in DOMString targetOrigin, in optional sequence<<a href=#transferable>Transferable</a>> transfer);
<!--POSTMSG-->
// <a href=#event-handler-idl-attributes>event handler IDL attributes</a>
attribute <a href=#function>Function</a>? <a href=#handler-onabort title=handler-onabort>onabort</a>;
@@ -77550,7 +77599,7 @@
<pre class=idl>[Supplemental, NoInterfaceObject]
interface <dfn id=dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</dfn> : <a href=#workerglobalscope>WorkerGlobalScope</a> {
- void <a href=#dom-dedicatedworkerglobalscope-postmessage title=dom-DedicatedWorkerGlobalScope-postMessage>postMessage</a>(in any message, in optional sequence<<a href=#messageport>MessagePort</a>> ports);<!--
+ void <a href=#dom-dedicatedworkerglobalscope-postmessage title=dom-DedicatedWorkerGlobalScope-postMessage>postMessage</a>(in any message, in optional sequence<<a href=#transferable>Transferable</a>> transfer);<!--
<span>MessagePort</span> <span title="dom-DedicatedWorkerGlobalScope-startConversation">startConversation</span>(in any message);-->
attribute <a href=#function>Function</a>? <a href=#handler-dedicatedworkerglobalscope-onmessage title=handler-DedicatedWorkerGlobalScope-onmessage>onmessage</a>;
};</pre>
@@ -78100,7 +78149,7 @@
interface <dfn id=worker>Worker</dfn> : <a href=#abstractworker>AbstractWorker</a> {
void <a href=#dom-worker-terminate title=dom-Worker-terminate>terminate</a>();
- void <a href=#dom-worker-postmessage title=dom-Worker-postMessage>postMessage</a>(in any message, in optional sequence<<a href=#messageport>MessagePort</a>> ports);<!--
+ void <a href=#dom-worker-postmessage title=dom-Worker-postMessage>postMessage</a>(in any message, in optional sequence<<a href=#transferable>Transferable</a>> transfer);<!--
<span>MessagePort</span> <span title="dom-Worker-startConversation">startConversation</span>(in any message);-->
attribute <a href=#function>Function</a>? <a href=#handler-worker-onmessage title=handler-Worker-onmessage>onmessage</a>;
};</pre>
@@ -80346,12 +80395,12 @@
<h4 id=posting-messages><span class=secno>11.4.3 </span>Posting messages</h4>
- <dl class=domintro><dt><var title="">window</var> . <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage</a></code>(<var title="">message</var>, <var title="">targetOrigin</var> [, <var title="">ports</var> ])</dt>
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage</a></code>(<var title="">message</var>, <var title="">targetOrigin</var> [, <var title="">transfer</var> ])</dt>
<dd>
- <p>Posts a message, optionally with an array of ports, to the
- given window.</p>
+ <p>Posts a message to the given window. Objects listed in <var title="">transfer</var> are transferred, not just cloned, meaning
+ that they are no longer usable on the sending side.</p>
<p>If the origin of the target window doesn't match the given
origin, the message is discarded, to avoid information leakage. To
@@ -80360,7 +80409,8 @@
message to same-origin targets only, without needing to explicitly
state the origin, set the target origin to "<code title="">/</code>".</p>
- <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> if the <var title="">ports</var> array contains duplicate ports.</p>
+ <p>Throws a <code><a href=#data_clone_err>DATA_CLONE_ERR</a></code> if <var title="">transfer</var> array contains duplicate objects or if
+ <var title="">message</var> could not be cloned.</p>
</dd>
@@ -80378,11 +80428,11 @@
<div class=impl>
- <p>When a script invokes the <dfn id=dom-window-postmessage title=dom-window-postMessage><code>postMessage(<var title="">message</var>, <var title="">targetOrigin</var>, <var title="">ports</var>)</code></dfn> method (with two or three
+ <p>When a script invokes the <dfn id=dom-window-postmessage title=dom-window-postMessage><code>postMessage(<var title="">message</var>, <var title="">targetOrigin</var>, <var title="">transfer</var>)</code></dfn> method (with two or three
arguments) on a <code><a href=#window>Window</a></code> object, the user agent must
- follow these steps:
+ follow these steps:</p>
- <ol><li>
+ <ol><!-- a lot of this is similar or identical to port.postMessage --><li>
<p>If the value of the <var title="">targetOrigin</var> argument
is neither a single U+002A ASTERISK character (*), a single U+002F
@@ -80394,39 +80444,48 @@
<li>
- <p>Let <var title="">message clone</var> be the result of
- obtaining a <a href=#structured-clone>structured clone</a> of the <var title="">message</var> argument. If this throws an exception, then
- throw that exception and abort these steps.</p>
+ <p>Let <var title="">new ports</var> be an empty array.</p>
</li>
<li>
- <p>If the <var title="">ports</var> argument is present but any
- <code><a href=#messageport>MessagePort</a></code> object is listed in <var title="">ports</var> more than once, or any of the
- <code><a href=#messageport>MessagePort</a></code> objects listed in <var title="">ports</var> have already been cloned once before, then
- throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception and abort these
- steps.</p>
+ <p>Let <var title="">transfer map</var> be an empty association
+ list of pairs of <code><a href=#transferable>Transferable</a></code> objects.</p>
</li>
<li>
- <p>Let <var title="">new ports</var> be an empty array.</p>
+ <p>If the method was invoked with a third argument <var title="">transfer</var>, run these substeps:</p>
- <p>If the <var title="">ports</var> argument is present, then for
- each port in <var title="">ports</var> in turn, obtain a new port
- by <a href=#clone-a-port title="clone a port">cloning</a> the port with the
- <code><a href=#window>Window</a></code> object on which the method was invoked as the
- owner of the clone, and append the clone to the <var title="">new
- ports</var> array.</p>
+ <ol><li>
- <p class=note>If the original <var title="">ports</var> argument
- was omitted or empty, then the <var title="">new ports</var> array
- will be empty.</p>
+ <p>If any object is listed in <var title="">transfer</var> more
+ than once, or any of the <code><a href=#transferable>Transferable</a></code> objects
+ listed in <var title="">transfer</var> have already been <a href=#transfer-a-transferable-object title="transfer a Transferable object">transfered</a> once
+ before, then throw a <code><a href=#data_clone_err>DATA_CLONE_ERR</a></code> exception and
+ abort these steps.</p>
- </li>
+ </li>
+ <li>
+
+ <p>If the <var title="">transfer</var> argument is present, then
+ for each object in <var title="">transfer</var> in turn, obtain
+ a new object by <a href=#transfer-a-transferable-object title="transfer a Transferable
+ object">transferring</a> the object to the
+ <code><a href=#window>Window</a></code> object on which the method was invoked, and
+ add a mapping from the old object to the new transferred object
+ to <var title="">transfer map</var>. If the objects are
+ <code><a href=#messageport>MessagePort</a></code> objects, also append the new
+ transferred object to the <var title="">new ports</var>
+ array.</p>
+
+ </li>
+
+ </ol></li>
+
<li>
<p>Make <var title="">new ports</var> into a <a href=#dfn-read-only-array title=dfn-read-only-array>read only</a> array.</p>
@@ -80435,6 +80494,15 @@
<li>
+ <p>Let <var title="">message clone</var> be the result of
+ obtaining a <a href=#structured-clone>structured clone</a> of the <var title="">message</var> argument, with <var title="">transfer
+ map</var> as the <i>transfer map</i>. If this throws an exception,
+ then throw that exception and abort these steps.</p>
+
+ </li>
+
+ <li>
+
<p>Return from the <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> method, but
asynchronously continue running these steps.</p>
@@ -80605,7 +80673,7 @@
<pre class=idl>interface <dfn id=messageport>MessagePort</dfn> {
<!-- v2-onclose readonly attribute boolean <span title="dom-MessagePort-active">active</span>;
---> void <a href=#dom-messageport-postmessage title=dom-MessagePort-postMessage>postMessage</a>(in any message, in optional sequence<<a href=#messageport>MessagePort</a>> ports);<!--
+--> void <a href=#dom-messageport-postmessage title=dom-MessagePort-postMessage>postMessage</a>(in any message, in optional sequence<<a href=#transferable>Transferable</a>> transfer);<!--
<span>MessagePort</span> <span title="dom-MessagePort-startConversation">startConversation</span>(in any message);-->
void <a href=#dom-messageport-start title=dom-MessagePort-start>start</a>();
void <a href=#dom-messageport-close title=dom-MessagePort-close>close</a>();
@@ -80613,7 +80681,8 @@
// event handlers
attribute <a href=#function>Function</a>? <a href=#handler-messageport-onmessage title=handler-MessagePort-onmessage>onmessage</a>;
};
-<a href=#messageport>MessagePort</a> implements <a href=#eventtarget>EventTarget</a>;</pre>
+<a href=#messageport>MessagePort</a> implements <a href=#eventtarget>EventTarget</a>;
+<a href=#messageport>MessagePort</a> implements <a href=#transferable>Transferable</a>;</pre>
<dl class=domintro><!-- v2-onclose
<dt><var title="">port</var> . <code title="dom-MessagePort-active">active</code></dt>
@@ -80623,15 +80692,16 @@
<p>Returns true if the port is still active; otherwise, returns false.</p>
</dd>
---><dt><var title="">port</var> . <code title=dom-MessagePort-poseMessage>postMessage</code>(<var title="">message</var> [, <var title="">ports</var>] )</dt>
+--><dt><var title="">port</var> . <code title=dom-MessagePort-postMessage><a href=#dom-messageport-postmessage>postMessage</a></code>(<var title="">message</var> [, <var title="">transfer</var>] )</dt>
<dd>
- <p>Posts a message through the channel, optionally with the given
- ports.</p>
+ <p>Posts a message through the channel. Objects listed in <var title="">transfer</var> are transferred, not just cloned, meaning
+ that they are no longer usable on the sending side.</p>
- <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> if the <var title="">ports</var> array contains either duplicate ports, or the
- source or target port.</p>
+ <p>Throws a <code><a href=#data_clone_err>DATA_CLONE_ERR</a></code> if <var title="">transfer</var> array contains duplicate objects or the
+ source or target ports, or if <var title="">message</var> could
+ not be cloned.</p>
</dd>
@@ -80668,7 +80738,7 @@
instantiate a new <code><a href=#messageport>MessagePort</a></code> object, and let its owner
be <var title="">owner</var>.</p>
- <hr><p>When the user agent is to <dfn id=entangle>entangle</dfn> two
+ <p>When the user agent is to <dfn id=entangle>entangle</dfn> two
<code><a href=#messageport>MessagePort</a></code> objects, it must run the following
steps:</p>
@@ -80689,7 +80759,7 @@
<code><a href=#messagechannel>MessageChannel</a></code> object that represents this
channel.)</li>
- </ol><hr><p>When the user agent is to <dfn id=clone-a-port>clone a port</dfn> <var title="">original port</var>, with the clone being owned by <var title="">owner</var>, it must run the following steps, which return
+ </ol><p>When the user agent is to <dfn id=clone-a-port>clone a port</dfn> <var title="">original port</var>, with the clone being owned by <var title="">owner</var>, it must run the following steps, which return
a new <code><a href=#messageport>MessagePort</a></code> object. These steps must be run
atomically.</p>
@@ -80720,7 +80790,11 @@
<li><p>Return <var title="">new port</var>. It is the
clone.</li>
- </ol><hr><!-- v2-onclose
+ </ol><p id=transferMessagePort>To <a href=#transfer-a-transferable-object title="transfer a Transferable
+ object">transfer</a> a <code><a href=#messageport>MessagePort</a></code> object <var title="">old</var> to a new owner <var title="">owner</var>, a user
+ agent must <a href=#clone-a-port title="clone a port">clone</a> the <var title="">old</var> object with the cloned being owned by <var title="">owner</var>, and must return the resulting object.</p>
+
+ <hr><!-- v2-onclose
<p>The <dfn title="dom-MessagePort-active"><code>active</code></dfn>
attribute must return true if the port is entangled, and false
otherwise.</p>
@@ -80730,61 +80804,97 @@
method, when called on a port <var title="">source port</var>, must
cause the user agent to run the following steps:</p>
- <ol><li><p>Let <var title="">target port</var> be the port with which
+ <ol><!-- a lot of this is similar or identical to window.postMessage --><li><p>Let <var title="">target port</var> be the port with which
<var title="">source port</var> is entangled, if any.</li>
- <li><p>If the method was called with a second argument <var title="">ports</var>, then, if any <code><a href=#messageport>MessagePort</a></code> object
- is listed in <var title="">ports</var> more than once, if any of the
- <code><a href=#messageport>MessagePort</a></code> objects listed in <var title="">ports</var>
- have already been cloned once before, or if any of the entries
- in <var title="">ports</var> are either the <var title="">source
- port</var> or the <var title="">target port</var> (if any), then
- throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</li>
+ <li><p>Let <var title="">new owner</var> be the owner of <var title="">target port</var>, if there is a <var title="">target
+ port</var>, or else some arbitrary owner. (This <var title="">new
+ owner</var> is used when transfering objects below. If there is no
+ <var title="">target port</var>, the <code><a href=#transferable>Transferable</a></code>
+ objects given in the second argument, if any, are still <a href=#transfer-a-transferable-object title="transfer a Transferable object">transfered</a>, but since
+ they are then discarded, it doesn't matter where they are
+ transfered to.)</li>
- <li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
- interface, with the name <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is not
- cancelable, and has no default action.</li>
+ <li>
- <li><p>Let <var title="">message</var> be the method's first
- argument.</li>
+ <p>Let <var title="">new ports</var> be an empty array.</p>
- <li><p>Let <var title="">message clone</var> be the result of
- obtaining a <a href=#structured-clone>structured clone</a> of <var title="">message</var>. If this throws an exception, then throw
- that exception and abort these steps.</li>
+ </li>
- <li><p>Let the <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code>
- attribute of the event have the value of <var title="">message
- clone</var>.</li>
+ <li>
- <li><p>If the method was called with a second argument <var title="">ports</var>, then run the following substeps:</p>
+ <p>Let <var title="">transfer map</var> be an empty association
+ list of pairs of <code><a href=#transferable>Transferable</a></code> objects.</p>
- <ol><li>
+ </li>
- <p>Let <var title="">new ports</var> be an empty array.</p>
+ <li>
- <p>For each port in <var title="">ports</var> in turn,
- obtain a new port by <a href=#clone-a-port title="clone a port">cloning</a>
- the port with the owner of the <var title="">target port</var>
- as the owner of the clone, and append the clone to the <var title="">new ports</var> array.</p>
+ <p>If the method was invoked with a second argument <var title="">transfer</var>, run these substeps:</p>
- <p class=note>If the original <var title="">ports</var>
- array was empty, then the <var title="">new ports</var> array will
- also be empty.</p>
+ <ol><li>
+ <p>If any object is listed in <var title="">transfer</var> more
+ than once, or any of the <code><a href=#transferable>Transferable</a></code> objects
+ listed in <var title="">transfer</var> have already been <a href=#transfer-a-transferable-object title="transfer a Transferable object">transfered</a> once
+ before, then throw a <code><a href=#data_clone_err>DATA_CLONE_ERR</a></code> exception and
+ abort these steps.</p>
+
</li>
<li>
- <p>Make <var title="">new ports</var> into a <a href=#dfn-read-only-array title=dfn-read-only-array>read only</a> array.</p>
+ <p>If any of the objects in <var title="">transfer</var> are
+ either the <var title="">source port</var> or the <var title="">target port</var> (if any), then throw a
+ <code><a href=#data_clone_err>DATA_CLONE_ERR</a></code> exception and abort these
+ steps.</li>
+ </ol></li>
+
+ <li>
+
+ <p>If the <var title="">transfer</var> argument is present, then
+ for each object in <var title="">transfer</var> in turn, obtain
+ a new object by <a href=#transfer-a-transferable-object title="transfer a Transferable
+ object">transferring</a> the object to <var title="">new
+ owner</var>, and add a mapping from the old object to the new
+ transferred object to <var title="">transfer map</var>. If the
+ objects are <code><a href=#messageport>MessagePort</a></code> objects, also append the
+ new transferred object to the <var title="">new ports</var>
+ array.</p>
+
</li>
- <li><p>Let the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code>
- attribute of the event be the <var title="">new ports</var>
- array.</li>
+ </ol><li>
- </ol></li>
+ <p>Make <var title="">new ports</var> into a <a href=#dfn-read-only-array title=dfn-read-only-array>read only</a> array.</p>
+ </li>
+
+ <li><p>Let <var title="">message</var> be the method's first
+ argument.</li>
+
+ <li>
+
+ <p>Let <var title="">message clone</var> be the result of
+ obtaining a <a href=#structured-clone>structured clone</a> of the <var title="">message</var> argument, with <var title="">transfer
+ map</var> as the <i>transfer map</i>. If this throws an exception,
+ then throw that exception and abort these steps.</p>
+
+ </li>
+
+ <li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
+ interface, with the name <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is not
+ cancelable, and has no default action.</li>
+
+ <li><p>Let the <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code>
+ attribute of the event have the value of <var title="">message
+ clone</var>.</li>
+
+ <li><p>Let the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code>
+ attribute of the event be the <var title="">new ports</var>
+ array.</li>
+
<li><p>If there is no <var title="">target port</var> (i.e. if <var title="">source port</var> is not entangled), then abort these
steps.</li> <!-- we don't raise an exception if there is no
target port because this can happen at a moment's notice. we don't
@@ -80796,7 +80906,9 @@
<li><p>Add the event to the <a href=#port-message-queue>port message queue</a> of <var title="">target port</var>.</li>
- </ol><!--
+
+
+<!--
<hr>
<p>The <dfn
@@ -80856,7 +80968,8 @@
title="">target port</var>.</p></li>
</ol>
---><hr><p>The <dfn id=dom-messageport-start title=dom-MessagePort-start><code>start()</code></dfn>
+-->
+ <hr><p>The <dfn id=dom-messageport-start title=dom-MessagePort-start><code>start()</code></dfn>
method must enable its port's <a href=#port-message-queue>port message queue</a>, if it
is not already enabled.</p>
Modified: index
===================================================================
--- index 2011-06-21 23:30:59 UTC (rev 6272)
+++ index 2011-06-23 23:48:46 UTC (rev 6273)
@@ -243,7 +243,7 @@
<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
- <h2 class="no-num no-toc">Living Standard — Last Updated 21 June 2011</h2>
+ <h2 class="no-num no-toc">Living Standard — Last Updated 23 June 2011</h2>
</hgroup><dl><dt><strong>Web developer edition</strong></dt>
<dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
<dt>Multiple-page version:</dt>
@@ -377,12 +377,13 @@
<li><a href=#htmlpropertiescollection-0><span class=secno>2.8.2.5 </span>HTMLPropertiesCollection</a></ol></li>
<li><a href=#domtokenlist-0><span class=secno>2.8.3 </span>DOMTokenList</a></li>
<li><a href=#domsettabletokenlist-0><span class=secno>2.8.4 </span>DOMSettableTokenList</a></li>
- <li><a href=#safe-passing-of-structured-data><span class=secno>2.8.5 </span>Safe passing of structured data</a></li>
- <li><a href=#domstringmap-0><span class=secno>2.8.6 </span>DOMStringMap</a></li>
- <li><a href=#domelementmap-0><span class=secno>2.8.7 </span>DOMElementMap</a></li>
- <li><a href=#dom-feature-strings><span class=secno>2.8.8 </span>DOM feature strings</a></li>
- <li><a href=#exceptions><span class=secno>2.8.9 </span>Exceptions</a></li>
- <li><a href=#garbage-collection><span class=secno>2.8.10 </span>Garbage collection</a></ol></li>
+ <li><a href=#transferable-objects><span class=secno>2.8.5 </span>Transferable objects</a></li>
+ <li><a href=#safe-passing-of-structured-data><span class=secno>2.8.6 </span>Safe passing of structured data</a></li>
+ <li><a href=#domstringmap-0><span class=secno>2.8.7 </span>DOMStringMap</a></li>
+ <li><a href=#domelementmap-0><span class=secno>2.8.8 </span>DOMElementMap</a></li>
+ <li><a href=#dom-feature-strings><span class=secno>2.8.9 </span>DOM feature strings</a></li>
+ <li><a href=#exceptions><span class=secno>2.8.10 </span>Exceptions</a></li>
+ <li><a href=#garbage-collection><span class=secno>2.8.11 </span>Garbage collection</a></ol></li>
<li><a href=#namespaces><span class=secno>2.9 </span>Namespaces</a></ol></li>
<li><a href=#dom><span class=secno>3 </span>Semantics, structure, and APIs of HTML documents</a>
<ol>
@@ -8499,23 +8500,61 @@
</div>
+
+ <h4 id=transferable-objects><span class=secno>2.8.5 </span>Transferable objects</h4>
+
+ <p>Some objects support being copied and closed in one operation.
+ This is called <i>transferring</i> the object, and is used in
+ particular to transfer ownership of unsharable or expensive
+ resources across worker boundaries.</p>
+
+ <pre class=idl>[NoInterfaceObject]
+interface <dfn id=transferable>Transferable</dfn> { };</pre>
+
<div class=impl>
- <h4 id=safe-passing-of-structured-data><span class=secno>2.8.5 </span>Safe passing of structured data</h4>
+ <p>To <dfn id=transfer-a-transferable-object>transfer a <code>Transferable</code> object</dfn> to a
+ new owner, the user agent must run the steps defined for the type of
+ object in question. The steps will return a new object of the same
+ type, and will permanently neuter the original object. (This is an
+ irreversible and non-idempotent operation; once an object has been
+ transferred, it cannot be transferred, or indeed used, again.)</p>
+ </div>
+
+ <p>The following <code><a href=#transferable>Transferable</a></code> types exist:</p>
+
+ <ul class=brief><li><code><a href=#messageport>MessagePort</a></code>
+ <!--<li><code>ArrayBuffer</code>-->
+ </ul><div class=impl><!-- should move down two sections XXX -->
+
+ <h4 id=safe-passing-of-structured-data><span class=secno>2.8.6 </span>Safe passing of structured data</h4>
+
<p>When a user agent is required to obtain a <dfn id=structured-clone>structured
- clone</dfn> of a value, it must run the following algorithm, which
- either returns a separate value, or throws an exception.</p>
+ clone</dfn> of a value, optionally with a <i>transfer map</i>, it
+ must run the following algorithm, which either returns a separate
+ value, or throws an exception. If a <i>transfer map</i> is provided,
+ it consists of a association list of pairs of
+ <code><a href=#transferable>Transferable</a></code> objects; in each pair, one is the
+ <em>old</em> object and one is the <em>new</em> object.</p>
<ol><li><p>Let <var title="">input</var> be the value being
cloned.</li>
+ <li><p>Let <var title="">transfer map</var> be the <i>transfer
+ map</i> passed to the algorithm, if any, or the empty list
+ otherwise.</li>
+
<li><p>Let <var title="">memory</var> be an association list of
pairs of objects, initially empty. This is used to handle duplicate
references. In each pair of objects, one is called the
<em>source</em> object and the other the <em>destination</em>
object.</li>
+ <li><p>For each pair of objects in <var title="">transfer
+ map</var>, add a mapping from the old object (the source object) to
+ the new object (the destination object) to <var title="">memory</var>.</li>
+
<li><p>Let <var title="">output</var> be the value resulting from
calling the <a href=#internal-structured-cloning-algorithm>internal structured cloning algorithm</a> with
<var title="">input</var> as the "<var title="">input</var>"
@@ -8590,6 +8629,16 @@
<dd><p>Let <var title="">output</var> be a newly constructed <code><a href=#filelist>FileList</a></code> object containing a list of newly constructed <code><a href=#file>File</a></code> objects corresponding to the same underlying data as those in <var title="">input</var>, maintaining their relative order.</dd>
+<!--(when we add this, make sure to throw DATA_CLONE_ERR if these objects are already closed)
+ <dt>If <var title="">input</var> is an <code>ArrayBuffer</code> object</dt>
+
+ <dd><p>...</p></dd>
+
+ <dt>If <var title="">input</var> is an <code>ArrayBufferView</code> object</dt>
+
+ <dd><p>...</p></dd>
+-->
+
<dt>If <var title="">input</var> is an Array object</dt>
<dd><p>Let <var title="">output</var> be a newly constructed empty <code>Array</code> object.</dd>
@@ -8646,7 +8695,7 @@
</div>
- <h4 id=domstringmap-0><span class=secno>2.8.6 </span>DOMStringMap</h4>
+ <h4 id=domstringmap-0><span class=secno>2.8.7 </span>DOMStringMap</h4>
<p>The <code><a href=#domstringmap>DOMStringMap</a></code> interface represents a set of
name-value pairs. It exposes these using the scripting language's
@@ -8730,7 +8779,7 @@
<!--CSSREF-->
- <h4 id=domelementmap-0><span class=secno>2.8.7 </span>DOMElementMap</h4>
+ <h4 id=domelementmap-0><span class=secno>2.8.8 </span>DOMElementMap</h4>
<p>The <code><a href=#domelementmap>DOMElementMap</a></code> interface represents a set of
name-element mappings. It exposes these using the scripting
@@ -8779,7 +8828,7 @@
<!--CSSREF-->
- <h4 id=dom-feature-strings><span class=secno>2.8.8 </span>DOM feature strings</h4>
+ <h4 id=dom-feature-strings><span class=secno>2.8.9 </span>DOM feature strings</h4>
<p>DOM3 Core defines mechanisms for checking for interface support,
and for obtaining implementations of interfaces, using <a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMFeatures>feature
@@ -8801,7 +8850,7 @@
</div>
- <h4 id=exceptions><span class=secno>2.8.9 </span>Exceptions</h4>
+ <h4 id=exceptions><span class=secno>2.8.10 </span>Exceptions</h4>
<p>The following are <code><a href=#domexception>DOMException</a></code> codes. <a href=#refsDOMCORE>[DOMCORE]</a></p>
@@ -8846,7 +8895,7 @@
<div class=impl>
- <h4 id=garbage-collection><span class=secno>2.8.10 </span>Garbage collection</h4>
+ <h4 id=garbage-collection><span class=secno>2.8.11 </span>Garbage collection</h4>
<p>There is an <dfn id=implied-strong-reference>implied strong reference</dfn> from any IDL
attribute that returns a pre-existing object to that object.</p>
@@ -9964,7 +10013,7 @@
and return true from the method.<!--SYNCLOAD Otherwise, continue running these
steps without yet returning.--></li>
- <li><p>Let <var title="">result</var> be an <code><a href=#document>Document</a></code>
+ <li><p>Let <var title="">result</var> be a <code><a href=#document>Document</a></code>
object.</li>
<li><p>Let <var title="">success</var> be false.</li>
@@ -61476,7 +61525,7 @@
any <a href=#dom-showmodaldialog title=dom-showModalDialog>showModalDialog</a>(in DOMString url, in optional any argument<!--, in optional DOMString features-->);
<!--POSTMSG--> // <a href=#web-messaging>cross-document messaging</a>
- void <a href=#dom-window-postmessage title=dom-window-postMessage>postMessage</a>(in any message, in DOMString targetOrigin, in optional sequence<<a href=#messageport>MessagePort</a>> ports);
+ void <a href=#dom-window-postmessage title=dom-window-postMessage>postMessage</a>(in any message, in DOMString targetOrigin, in optional sequence<<a href=#transferable>Transferable</a>> transfer);
<!--POSTMSG-->
// <a href=#event-handler-idl-attributes>event handler IDL attributes</a>
attribute <a href=#function>Function</a>? <a href=#handler-onabort title=handler-onabort>onabort</a>;
@@ -76614,12 +76663,12 @@
<h4 id=posting-messages><span class=secno>10.2.3 </span>Posting messages</h4>
- <dl class=domintro><dt><var title="">window</var> . <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage</a></code>(<var title="">message</var>, <var title="">targetOrigin</var> [, <var title="">ports</var> ])</dt>
+ <dl class=domintro><dt><var title="">window</var> . <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage</a></code>(<var title="">message</var>, <var title="">targetOrigin</var> [, <var title="">transfer</var> ])</dt>
<dd>
- <p>Posts a message, optionally with an array of ports, to the
- given window.</p>
+ <p>Posts a message to the given window. Objects listed in <var title="">transfer</var> are transferred, not just cloned, meaning
+ that they are no longer usable on the sending side.</p>
<p>If the origin of the target window doesn't match the given
origin, the message is discarded, to avoid information leakage. To
@@ -76628,7 +76677,8 @@
message to same-origin targets only, without needing to explicitly
state the origin, set the target origin to "<code title="">/</code>".</p>
- <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> if the <var title="">ports</var> array contains duplicate ports.</p>
+ <p>Throws a <code><a href=#data_clone_err>DATA_CLONE_ERR</a></code> if <var title="">transfer</var> array contains duplicate objects or if
+ <var title="">message</var> could not be cloned.</p>
</dd>
@@ -76646,11 +76696,11 @@
<div class=impl>
- <p>When a script invokes the <dfn id=dom-window-postmessage title=dom-window-postMessage><code>postMessage(<var title="">message</var>, <var title="">targetOrigin</var>, <var title="">ports</var>)</code></dfn> method (with two or three
+ <p>When a script invokes the <dfn id=dom-window-postmessage title=dom-window-postMessage><code>postMessage(<var title="">message</var>, <var title="">targetOrigin</var>, <var title="">transfer</var>)</code></dfn> method (with two or three
arguments) on a <code><a href=#window>Window</a></code> object, the user agent must
- follow these steps:
+ follow these steps:</p>
- <ol><li>
+ <ol><!-- a lot of this is similar or identical to port.postMessage --><li>
<p>If the value of the <var title="">targetOrigin</var> argument
is neither a single U+002A ASTERISK character (*), a single U+002F
@@ -76662,39 +76712,48 @@
<li>
- <p>Let <var title="">message clone</var> be the result of
- obtaining a <a href=#structured-clone>structured clone</a> of the <var title="">message</var> argument. If this throws an exception, then
- throw that exception and abort these steps.</p>
+ <p>Let <var title="">new ports</var> be an empty array.</p>
</li>
<li>
- <p>If the <var title="">ports</var> argument is present but any
- <code><a href=#messageport>MessagePort</a></code> object is listed in <var title="">ports</var> more than once, or any of the
- <code><a href=#messageport>MessagePort</a></code> objects listed in <var title="">ports</var> have already been cloned once before, then
- throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception and abort these
- steps.</p>
+ <p>Let <var title="">transfer map</var> be an empty association
+ list of pairs of <code><a href=#transferable>Transferable</a></code> objects.</p>
</li>
<li>
- <p>Let <var title="">new ports</var> be an empty array.</p>
+ <p>If the method was invoked with a third argument <var title="">transfer</var>, run these substeps:</p>
- <p>If the <var title="">ports</var> argument is present, then for
- each port in <var title="">ports</var> in turn, obtain a new port
- by <a href=#clone-a-port title="clone a port">cloning</a> the port with the
- <code><a href=#window>Window</a></code> object on which the method was invoked as the
- owner of the clone, and append the clone to the <var title="">new
- ports</var> array.</p>
+ <ol><li>
- <p class=note>If the original <var title="">ports</var> argument
- was omitted or empty, then the <var title="">new ports</var> array
- will be empty.</p>
+ <p>If any object is listed in <var title="">transfer</var> more
+ than once, or any of the <code><a href=#transferable>Transferable</a></code> objects
+ listed in <var title="">transfer</var> have already been <a href=#transfer-a-transferable-object title="transfer a Transferable object">transfered</a> once
+ before, then throw a <code><a href=#data_clone_err>DATA_CLONE_ERR</a></code> exception and
+ abort these steps.</p>
- </li>
+ </li>
+ <li>
+
+ <p>If the <var title="">transfer</var> argument is present, then
+ for each object in <var title="">transfer</var> in turn, obtain
+ a new object by <a href=#transfer-a-transferable-object title="transfer a Transferable
+ object">transferring</a> the object to the
+ <code><a href=#window>Window</a></code> object on which the method was invoked, and
+ add a mapping from the old object to the new transferred object
+ to <var title="">transfer map</var>. If the objects are
+ <code><a href=#messageport>MessagePort</a></code> objects, also append the new
+ transferred object to the <var title="">new ports</var>
+ array.</p>
+
+ </li>
+
+ </ol></li>
+
<li>
<p>Make <var title="">new ports</var> into a <a href=#dfn-read-only-array title=dfn-read-only-array>read only</a> array.</p>
@@ -76703,6 +76762,15 @@
<li>
+ <p>Let <var title="">message clone</var> be the result of
+ obtaining a <a href=#structured-clone>structured clone</a> of the <var title="">message</var> argument, with <var title="">transfer
+ map</var> as the <i>transfer map</i>. If this throws an exception,
+ then throw that exception and abort these steps.</p>
+
+ </li>
+
+ <li>
+
<p>Return from the <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> method, but
asynchronously continue running these steps.</p>
@@ -76873,7 +76941,7 @@
<pre class=idl>interface <dfn id=messageport>MessagePort</dfn> {
<!-- v2-onclose readonly attribute boolean <span title="dom-MessagePort-active">active</span>;
---> void <a href=#dom-messageport-postmessage title=dom-MessagePort-postMessage>postMessage</a>(in any message, in optional sequence<<a href=#messageport>MessagePort</a>> ports);<!--
+--> void <a href=#dom-messageport-postmessage title=dom-MessagePort-postMessage>postMessage</a>(in any message, in optional sequence<<a href=#transferable>Transferable</a>> transfer);<!--
<span>MessagePort</span> <span title="dom-MessagePort-startConversation">startConversation</span>(in any message);-->
void <a href=#dom-messageport-start title=dom-MessagePort-start>start</a>();
void <a href=#dom-messageport-close title=dom-MessagePort-close>close</a>();
@@ -76881,7 +76949,8 @@
// event handlers
attribute <a href=#function>Function</a>? <a href=#handler-messageport-onmessage title=handler-MessagePort-onmessage>onmessage</a>;
};
-<a href=#messageport>MessagePort</a> implements <a href=#eventtarget>EventTarget</a>;</pre>
+<a href=#messageport>MessagePort</a> implements <a href=#eventtarget>EventTarget</a>;
+<a href=#messageport>MessagePort</a> implements <a href=#transferable>Transferable</a>;</pre>
<dl class=domintro><!-- v2-onclose
<dt><var title="">port</var> . <code title="dom-MessagePort-active">active</code></dt>
@@ -76891,15 +76960,16 @@
<p>Returns true if the port is still active; otherwise, returns false.</p>
</dd>
---><dt><var title="">port</var> . <code title=dom-MessagePort-poseMessage>postMessage</code>(<var title="">message</var> [, <var title="">ports</var>] )</dt>
+--><dt><var title="">port</var> . <code title=dom-MessagePort-postMessage><a href=#dom-messageport-postmessage>postMessage</a></code>(<var title="">message</var> [, <var title="">transfer</var>] )</dt>
<dd>
- <p>Posts a message through the channel, optionally with the given
- ports.</p>
+ <p>Posts a message through the channel. Objects listed in <var title="">transfer</var> are transferred, not just cloned, meaning
+ that they are no longer usable on the sending side.</p>
- <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> if the <var title="">ports</var> array contains either duplicate ports, or the
- source or target port.</p>
+ <p>Throws a <code><a href=#data_clone_err>DATA_CLONE_ERR</a></code> if <var title="">transfer</var> array contains duplicate objects or the
+ source or target ports, or if <var title="">message</var> could
+ not be cloned.</p>
</dd>
@@ -76936,7 +77006,7 @@
instantiate a new <code><a href=#messageport>MessagePort</a></code> object, and let its owner
be <var title="">owner</var>.</p>
- <hr><p>When the user agent is to <dfn id=entangle>entangle</dfn> two
+ <p>When the user agent is to <dfn id=entangle>entangle</dfn> two
<code><a href=#messageport>MessagePort</a></code> objects, it must run the following
steps:</p>
@@ -76957,7 +77027,7 @@
<code><a href=#messagechannel>MessageChannel</a></code> object that represents this
channel.)</li>
- </ol><hr><p>When the user agent is to <dfn id=clone-a-port>clone a port</dfn> <var title="">original port</var>, with the clone being owned by <var title="">owner</var>, it must run the following steps, which return
+ </ol><p>When the user agent is to <dfn id=clone-a-port>clone a port</dfn> <var title="">original port</var>, with the clone being owned by <var title="">owner</var>, it must run the following steps, which return
a new <code><a href=#messageport>MessagePort</a></code> object. These steps must be run
atomically.</p>
@@ -76988,7 +77058,11 @@
<li><p>Return <var title="">new port</var>. It is the
clone.</li>
- </ol><hr><!-- v2-onclose
+ </ol><p id=transferMessagePort>To <a href=#transfer-a-transferable-object title="transfer a Transferable
+ object">transfer</a> a <code><a href=#messageport>MessagePort</a></code> object <var title="">old</var> to a new owner <var title="">owner</var>, a user
+ agent must <a href=#clone-a-port title="clone a port">clone</a> the <var title="">old</var> object with the cloned being owned by <var title="">owner</var>, and must return the resulting object.</p>
+
+ <hr><!-- v2-onclose
<p>The <dfn title="dom-MessagePort-active"><code>active</code></dfn>
attribute must return true if the port is entangled, and false
otherwise.</p>
@@ -76998,61 +77072,97 @@
method, when called on a port <var title="">source port</var>, must
cause the user agent to run the following steps:</p>
- <ol><li><p>Let <var title="">target port</var> be the port with which
+ <ol><!-- a lot of this is similar or identical to window.postMessage --><li><p>Let <var title="">target port</var> be the port with which
<var title="">source port</var> is entangled, if any.</li>
- <li><p>If the method was called with a second argument <var title="">ports</var>, then, if any <code><a href=#messageport>MessagePort</a></code> object
- is listed in <var title="">ports</var> more than once, if any of the
- <code><a href=#messageport>MessagePort</a></code> objects listed in <var title="">ports</var>
- have already been cloned once before, or if any of the entries
- in <var title="">ports</var> are either the <var title="">source
- port</var> or the <var title="">target port</var> (if any), then
- throw an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</li>
+ <li><p>Let <var title="">new owner</var> be the owner of <var title="">target port</var>, if there is a <var title="">target
+ port</var>, or else some arbitrary owner. (This <var title="">new
+ owner</var> is used when transfering objects below. If there is no
+ <var title="">target port</var>, the <code><a href=#transferable>Transferable</a></code>
+ objects given in the second argument, if any, are still <a href=#transfer-a-transferable-object title="transfer a Transferable object">transfered</a>, but since
+ they are then discarded, it doesn't matter where they are
+ transfered to.)</li>
- <li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
- interface, with the name <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is not
- cancelable, and has no default action.</li>
+ <li>
- <li><p>Let <var title="">message</var> be the method's first
- argument.</li>
+ <p>Let <var title="">new ports</var> be an empty array.</p>
- <li><p>Let <var title="">message clone</var> be the result of
- obtaining a <a href=#structured-clone>structured clone</a> of <var title="">message</var>. If this throws an exception, then throw
- that exception and abort these steps.</li>
+ </li>
- <li><p>Let the <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code>
- attribute of the event have the value of <var title="">message
- clone</var>.</li>
+ <li>
- <li><p>If the method was called with a second argument <var title="">ports</var>, then run the following substeps:</p>
+ <p>Let <var title="">transfer map</var> be an empty association
+ list of pairs of <code><a href=#transferable>Transferable</a></code> objects.</p>
- <ol><li>
+ </li>
- <p>Let <var title="">new ports</var> be an empty array.</p>
+ <li>
- <p>For each port in <var title="">ports</var> in turn,
- obtain a new port by <a href=#clone-a-port title="clone a port">cloning</a>
- the port with the owner of the <var title="">target port</var>
- as the owner of the clone, and append the clone to the <var title="">new ports</var> array.</p>
+ <p>If the method was invoked with a second argument <var title="">transfer</var>, run these substeps:</p>
- <p class=note>If the original <var title="">ports</var>
- array was empty, then the <var title="">new ports</var> array will
- also be empty.</p>
+ <ol><li>
+ <p>If any object is listed in <var title="">transfer</var> more
+ than once, or any of the <code><a href=#transferable>Transferable</a></code> objects
+ listed in <var title="">transfer</var> have already been <a href=#transfer-a-transferable-object title="transfer a Transferable object">transfered</a> once
+ before, then throw a <code><a href=#data_clone_err>DATA_CLONE_ERR</a></code> exception and
+ abort these steps.</p>
+
</li>
<li>
- <p>Make <var title="">new ports</var> into a <a href=#dfn-read-only-array title=dfn-read-only-array>read only</a> array.</p>
+ <p>If any of the objects in <var title="">transfer</var> are
+ either the <var title="">source port</var> or the <var title="">target port</var> (if any), then throw a
+ <code><a href=#data_clone_err>DATA_CLONE_ERR</a></code> exception and abort these
+ steps.</li>
+ </ol></li>
+
+ <li>
+
+ <p>If the <var title="">transfer</var> argument is present, then
+ for each object in <var title="">transfer</var> in turn, obtain
+ a new object by <a href=#transfer-a-transferable-object title="transfer a Transferable
+ object">transferring</a> the object to <var title="">new
+ owner</var>, and add a mapping from the old object to the new
+ transferred object to <var title="">transfer map</var>. If the
+ objects are <code><a href=#messageport>MessagePort</a></code> objects, also append the
+ new transferred object to the <var title="">new ports</var>
+ array.</p>
+
</li>
- <li><p>Let the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code>
- attribute of the event be the <var title="">new ports</var>
- array.</li>
+ </ol><li>
- </ol></li>
+ <p>Make <var title="">new ports</var> into a <a href=#dfn-read-only-array title=dfn-read-only-array>read only</a> array.</p>
+ </li>
+
+ <li><p>Let <var title="">message</var> be the method's first
+ argument.</li>
+
+ <li>
+
+ <p>Let <var title="">message clone</var> be the result of
+ obtaining a <a href=#structured-clone>structured clone</a> of the <var title="">message</var> argument, with <var title="">transfer
+ map</var> as the <i>transfer map</i>. If this throws an exception,
+ then throw that exception and abort these steps.</p>
+
+ </li>
+
+ <li><p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
+ interface, with the name <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is not
+ cancelable, and has no default action.</li>
+
+ <li><p>Let the <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code>
+ attribute of the event have the value of <var title="">message
+ clone</var>.</li>
+
+ <li><p>Let the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code>
+ attribute of the event be the <var title="">new ports</var>
+ array.</li>
+
<li><p>If there is no <var title="">target port</var> (i.e. if <var title="">source port</var> is not entangled), then abort these
steps.</li> <!-- we don't raise an exception if there is no
target port because this can happen at a moment's notice. we don't
@@ -77064,7 +77174,9 @@
<li><p>Add the event to the <a href=#port-message-queue>port message queue</a> of <var title="">target port</var>.</li>
- </ol><!--
+
+
+<!--
<hr>
<p>The <dfn
@@ -77124,7 +77236,8 @@
title="">target port</var>.</p></li>
</ol>
---><hr><p>The <dfn id=dom-messageport-start title=dom-MessagePort-start><code>start()</code></dfn>
+-->
+ <hr><p>The <dfn id=dom-messageport-start title=dom-MessagePort-start><code>start()</code></dfn>
method must enable its port's <a href=#port-message-queue>port message queue</a>, if it
is not already enabled.</p>
Modified: source
===================================================================
--- source 2011-06-21 23:30:59 UTC (rev 6272)
+++ source 2011-06-23 23:48:46 UTC (rev 6273)
@@ -8616,25 +8616,68 @@
</div>
+
+ <h4>Transferable objects</h4>
+
+ <p>Some objects support being copied and closed in one operation.
+ This is called <i>transferring</i> the object, and is used in
+ particular to transfer ownership of unsharable or expensive
+ resources across worker boundaries.</p>
+
+ <pre class="idl">[NoInterfaceObject]
+interface <dfn>Transferable</dfn> { };</pre>
+
<div class="impl">
+ <p>To <dfn>transfer a <code>Transferable</code> object</dfn> to a
+ new owner, the user agent must run the steps defined for the type of
+ object in question. The steps will return a new object of the same
+ type, and will permanently neuter the original object. (This is an
+ irreversible and non-idempotent operation; once an object has been
+ transferred, it cannot be transferred, or indeed used, again.)</p>
+
+ </div>
+
+ <p>The following <code>Transferable</code> types exist:</p>
+
+ <ul class="brief">
+ <li><code>MessagePort</code>
+ <!--<li><code>ArrayBuffer</code>-->
+ </ul>
+
+
+ <div class="impl"><!-- should move down two sections XXX -->
+
<h4>Safe passing of structured data</h4>
<p>When a user agent is required to obtain a <dfn>structured
- clone</dfn> of a value, it must run the following algorithm, which
- either returns a separate value, or throws an exception.</p>
+ clone</dfn> of a value, optionally with a <i>transfer map</i>, it
+ must run the following algorithm, which either returns a separate
+ value, or throws an exception. If a <i>transfer map</i> is provided,
+ it consists of a association list of pairs of
+ <code>Transferable</code> objects; in each pair, one is the
+ <em>old</em> object and one is the <em>new</em> object.</p>
<ol>
<li><p>Let <var title="">input</var> be the value being
cloned.</p></li>
+ <li><p>Let <var title="">transfer map</var> be the <i>transfer
+ map</i> passed to the algorithm, if any, or the empty list
+ otherwise.</p></li>
+
<li><p>Let <var title="">memory</var> be an association list of
pairs of objects, initially empty. This is used to handle duplicate
references. In each pair of objects, one is called the
<em>source</em> object and the other the <em>destination</em>
object.</p></li>
+ <li><p>For each pair of objects in <var title="">transfer
+ map</var>, add a mapping from the old object (the source object) to
+ the new object (the destination object) to <var
+ title="">memory</var>.</p></li>
+
<li><p>Let <var title="">output</var> be the value resulting from
calling the <span>internal structured cloning algorithm</span> with
<var title="">input</var> as the "<var title="">input</var>"
@@ -8720,6 +8763,16 @@
<dd><p>Let <var title="">output</var> be a newly constructed <code>FileList</code> object containing a list of newly constructed <code>File</code> objects corresponding to the same underlying data as those in <var title="">input</var>, maintaining their relative order.</p></dd>
+<!--(when we add this, make sure to throw DATA_CLONE_ERR if these objects are already closed)
+ <dt>If <var title="">input</var> is an <code>ArrayBuffer</code> object</dt>
+
+ <dd><p>...</p></dd>
+
+ <dt>If <var title="">input</var> is an <code>ArrayBufferView</code> object</dt>
+
+ <dd><p>...</p></dd>
+-->
+
<dt>If <var title="">input</var> is an Array object</dt>
<dd><p>Let <var title="">output</var> be a newly constructed empty <code>Array</code> object.</p></dd>
@@ -10346,7 +10399,7 @@
and return true from the method.<!--SYNCLOAD Otherwise, continue running these
steps without yet returning.--></p></li>
- <li><p>Let <var title="">result</var> be an <code>Document</code>
+ <li><p>Let <var title="">result</var> be a <code>Document</code>
object.</p></li>
<li><p>Let <var title="">success</var> be false.</p></li>
@@ -70066,7 +70119,7 @@
any <span title="dom-showModalDialog">showModalDialog</span>(in DOMString url, in optional any argument<!--, in optional DOMString features-->);
<!--END w3c-html--><!--POSTMSG--> // <span>cross-document messaging</span>
- void <span title="dom-window-postMessage">postMessage</span>(in any message, in DOMString targetOrigin, in optional sequence<<span>MessagePort</span>> ports);
+ void <span title="dom-window-postMessage">postMessage</span>(in any message, in DOMString targetOrigin, in optional sequence<<span>Transferable</span>> transfer);
<!--START w3c-html--><!--POSTMSG-->
// <span>event handler IDL attributes</span>
attribute <span>Function</span>? <span title="handler-onabort">onabort</span>;
@@ -87839,7 +87892,7 @@
<pre class="idl">[Supplemental, NoInterfaceObject]
interface <dfn>DedicatedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope</span> {
- void <span title="dom-DedicatedWorkerGlobalScope-postMessage">postMessage</span>(in any message, in optional sequence<<span>MessagePort</span>> ports);<!--
+ void <span title="dom-DedicatedWorkerGlobalScope-postMessage">postMessage</span>(in any message, in optional sequence<<span>Transferable</span>> transfer);<!--
<span>MessagePort</span> <span title="dom-DedicatedWorkerGlobalScope-startConversation">startConversation</span>(in any message);-->
attribute <span>Function</span>? <span title="handler-DedicatedWorkerGlobalScope-onmessage">onmessage</span>;
};</pre>
@@ -88488,7 +88541,7 @@
interface <dfn>Worker</dfn> : <span>AbstractWorker</span> {
void <span title="dom-Worker-terminate">terminate</span>();
- void <span title="dom-Worker-postMessage">postMessage</span>(in any message, in optional sequence<<span>MessagePort</span>> ports);<!--
+ void <span title="dom-Worker-postMessage">postMessage</span>(in any message, in optional sequence<<span>Transferable</span>> transfer);<!--
<span>MessagePort</span> <span title="dom-Worker-startConversation">startConversation</span>(in any message);-->
attribute <span>Function</span>? <span title="handler-Worker-onmessage">onmessage</span>;
};</pre>
@@ -91156,12 +91209,13 @@
<dl class="domintro">
- <dt><var title="">window</var> . <code title="dom-window-postMessage">postMessage</code>(<var title="">message</var>, <var title="">targetOrigin</var> [, <var title="">ports</var> ])</dt>
+ <dt><var title="">window</var> . <code title="dom-window-postMessage">postMessage</code>(<var title="">message</var>, <var title="">targetOrigin</var> [, <var title="">transfer</var> ])</dt>
<dd>
- <p>Posts a message, optionally with an array of ports, to the
- given window.</p>
+ <p>Posts a message to the given window. Objects listed in <var
+ title="">transfer</var> are transferred, not just cloned, meaning
+ that they are no longer usable on the sending side.</p>
<p>If the origin of the target window doesn't match the given
origin, the message is discarded, to avoid information leakage. To
@@ -91171,8 +91225,9 @@
state the origin, set the target origin to "<code
title="">/</code>".</p>
- <p>Throws an <code>INVALID_STATE_ERR</code> if the <var
- title="">ports</var> array contains duplicate ports.</p>
+ <p>Throws a <code>DATA_CLONE_ERR</code> if <var
+ title="">transfer</var> array contains duplicate objects or if
+ <var title="">message</var> could not be cloned.</p>
</dd>
@@ -91195,11 +91250,11 @@
<p>When a script invokes the <dfn
title="dom-window-postMessage"><code>postMessage(<var
title="">message</var>, <var title="">targetOrigin</var>, <var
- title="">ports</var>)</code></dfn> method (with two or three
+ title="">transfer</var>)</code></dfn> method (with two or three
arguments) on a <code>Window</code> object, the user agent must
- follow these steps:
+ follow these steps:</p>
- <ol>
+ <ol> <!-- a lot of this is similar or identical to port.postMessage -->
<li>
@@ -91213,40 +91268,52 @@
<li>
- <p>Let <var title="">message clone</var> be the result of
- obtaining a <span>structured clone</span> of the <var
- title="">message</var> argument. If this throws an exception, then
- throw that exception and abort these steps.</p>
+ <p>Let <var title="">new ports</var> be an empty array.</p>
</li>
<li>
- <p>If the <var title="">ports</var> argument is present but any
- <code>MessagePort</code> object is listed in <var
- title="">ports</var> more than once, or any of the
- <code>MessagePort</code> objects listed in <var
- title="">ports</var> have already been cloned once before, then
- throw an <code>INVALID_STATE_ERR</code> exception and abort these
- steps.</p>
+ <p>Let <var title="">transfer map</var> be an empty association
+ list of pairs of <code>Transferable</code> objects.</p>
</li>
<li>
- <p>Let <var title="">new ports</var> be an empty array.</p>
+ <p>If the method was invoked with a third argument <var
+ title="">transfer</var>, run these substeps:</p>
- <p>If the <var title="">ports</var> argument is present, then for
- each port in <var title="">ports</var> in turn, obtain a new port
- by <span title="clone a port">cloning</span> the port with the
- <code>Window</code> object on which the method was invoked as the
- owner of the clone, and append the clone to the <var title="">new
- ports</var> array.</p>
+ <ol>
- <p class="note">If the original <var title="">ports</var> argument
- was omitted or empty, then the <var title="">new ports</var> array
- will be empty.</p>
+ <li>
+ <p>If any object is listed in <var title="">transfer</var> more
+ than once, or any of the <code>Transferable</code> objects
+ listed in <var title="">transfer</var> have already been <span
+ title="transfer a Transferable object">transfered</span> once
+ before, then throw a <code>DATA_CLONE_ERR</code> exception and
+ abort these steps.</p>
+
+ </li>
+
+ <li>
+
+ <p>If the <var title="">transfer</var> argument is present, then
+ for each object in <var title="">transfer</var> in turn, obtain
+ a new object by <span title="transfer a Transferable
+ object">transferring</span> the object to the
+ <code>Window</code> object on which the method was invoked, and
+ add a mapping from the old object to the new transferred object
+ to <var title="">transfer map</var>. If the objects are
+ <code>MessagePort</code> objects, also append the new
+ transferred object to the <var title="">new ports</var>
+ array.</p>
+
+ </li>
+
+ </ol>
+
</li>
<li>
@@ -91258,6 +91325,16 @@
<li>
+ <p>Let <var title="">message clone</var> be the result of
+ obtaining a <span>structured clone</span> of the <var
+ title="">message</var> argument, with <var title="">transfer
+ map</var> as the <i>transfer map</i>. If this throws an exception,
+ then throw that exception and abort these steps.</p>
+
+ </li>
+
+ <li>
+
<p>Return from the <code
title="dom-window-postMessage">postMessage()</code> method, but
asynchronously continue running these steps.</p>
@@ -91456,7 +91533,7 @@
<pre class="idl">interface <dfn>MessagePort</dfn> {
<!-- v2-onclose readonly attribute boolean <span title="dom-MessagePort-active">active</span>;
---> void <span title="dom-MessagePort-postMessage">postMessage</span>(in any message, in optional sequence<<span>MessagePort</span>> ports);<!--
+--> void <span title="dom-MessagePort-postMessage">postMessage</span>(in any message, in optional sequence<<span>Transferable</span>> transfer);<!--
<span>MessagePort</span> <span title="dom-MessagePort-startConversation">startConversation</span>(in any message);-->
void <span title="dom-MessagePort-start">start</span>();
void <span title="dom-MessagePort-close">close</span>();
@@ -91464,7 +91541,8 @@
// event handlers
attribute <span>Function</span>? <span title="handler-MessagePort-onmessage">onmessage</span>;
};
-<span>MessagePort</span> implements <span>EventTarget</span>;</pre>
+<span>MessagePort</span> implements <span>EventTarget</span>;
+<span>MessagePort</span> implements <span>Transferable</span>;</pre>
<dl class="domintro">
<!-- v2-onclose
@@ -91476,16 +91554,18 @@
</dd>
-->
- <dt><var title="">port</var> . <code title="dom-MessagePort-poseMessage">postMessage</code>(<var title="">message</var> [, <var title="">ports</var>] )</dt>
+ <dt><var title="">port</var> . <code title="dom-MessagePort-postMessage">postMessage</code>(<var title="">message</var> [, <var title="">transfer</var>] )</dt>
<dd>
- <p>Posts a message through the channel, optionally with the given
- ports.</p>
+ <p>Posts a message through the channel. Objects listed in <var
+ title="">transfer</var> are transferred, not just cloned, meaning
+ that they are no longer usable on the sending side.</p>
- <p>Throws an <code>INVALID_STATE_ERR</code> if the <var
- title="">ports</var> array contains either duplicate ports, or the
- source or target port.</p>
+ <p>Throws a <code>DATA_CLONE_ERR</code> if <var
+ title="">transfer</var> array contains duplicate objects or the
+ source or target ports, or if <var title="">message</var> could
+ not be cloned.</p>
</dd>
@@ -91524,8 +91604,6 @@
instantiate a new <code>MessagePort</code> object, and let its owner
be <var title="">owner</var>.</p>
- <hr>
-
<p>When the user agent is to <dfn>entangle</dfn> two
<code>MessagePort</code> objects, it must run the following
steps:</p>
@@ -91551,8 +91629,6 @@
</ol>
- <hr>
-
<p>When the user agent is to <dfn>clone a port</dfn> <var
title="">original port</var>, with the clone being owned by <var
title="">owner</var>, it must run the following steps, which return
@@ -91595,6 +91671,13 @@
</ol>
+ <p id="transferMessagePort">To <span title="transfer a Transferable
+ object">transfer</span> a <code>MessagePort</code> object <var
+ title="">old</var> to a new owner <var title="">owner</var>, a user
+ agent must <span title="clone a port">clone</span> the <var
+ title="">old</var> object with the cloned being owned by <var
+ title="">owner</var>, and must return the resulting object.</p>
+
<hr>
<!-- v2-onclose
<p>The <dfn title="dom-MessagePort-active"><code>active</code></dfn>
@@ -91608,74 +91691,113 @@
method, when called on a port <var title="">source port</var>, must
cause the user agent to run the following steps:</p>
- <ol>
+ <ol> <!-- a lot of this is similar or identical to window.postMessage -->
<li><p>Let <var title="">target port</var> be the port with which
<var title="">source port</var> is entangled, if any.</p></li>
- <li><p>If the method was called with a second argument <var
- title="">ports</var>, then, if any <code>MessagePort</code> object
- is listed in <var title="">ports</var> more than once, if any of the
- <code>MessagePort</code> objects listed in <var title="">ports</var>
- have already been cloned once before, or if any of the entries
- in <var title="">ports</var> are either the <var title="">source
- port</var> or the <var title="">target port</var> (if any), then
- throw an <code>INVALID_STATE_ERR</code> exception.</p></li>
+ <li><p>Let <var title="">new owner</var> be the owner of <var
+ title="">target port</var>, if there is a <var title="">target
+ port</var>, or else some arbitrary owner. (This <var title="">new
+ owner</var> is used when transfering objects below. If there is no
+ <var title="">target port</var>, the <code>Transferable</code>
+ objects given in the second argument, if any, are still <span
+ title="transfer a Transferable object">transfered</span>, but since
+ they are then discarded, it doesn't matter where they are
+ transfered to.)</p></li>
- <li><p>Create an event that uses the <code>MessageEvent</code>
- interface, with the name <code
- title="event-message">message</code>, which does not bubble, is not
- cancelable, and has no default action.</p></li>
+ <li>
- <li><p>Let <var title="">message</var> be the method's first
- argument.</p></li>
+ <p>Let <var title="">new ports</var> be an empty array.</p>
- <li><p>Let <var title="">message clone</var> be the result of
- obtaining a <span>structured clone</span> of <var
- title="">message</var>. If this throws an exception, then throw
- that exception and abort these steps.</p></li>
+ </li>
- <li><p>Let the <code title="dom-MessageEvent-data">data</code>
- attribute of the event have the value of <var title="">message
- clone</var>.</p></li>
+ <li>
- <li><p>If the method was called with a second argument <var
- title="">ports</var>, then run the following substeps:</p>
+ <p>Let <var title="">transfer map</var> be an empty association
+ list of pairs of <code>Transferable</code> objects.</p>
+ </li>
+
+ <li>
+
+ <p>If the method was invoked with a second argument <var
+ title="">transfer</var>, run these substeps:</p>
+
<ol>
<li>
- <p>Let <var title="">new ports</var> be an empty array.</p>
+ <p>If any object is listed in <var title="">transfer</var> more
+ than once, or any of the <code>Transferable</code> objects
+ listed in <var title="">transfer</var> have already been <span
+ title="transfer a Transferable object">transfered</span> once
+ before, then throw a <code>DATA_CLONE_ERR</code> exception and
+ abort these steps.</p>
- <p>For each port in <var title="">ports</var> in turn,
- obtain a new port by <span title="clone a port">cloning</span>
- the port with the owner of the <var title="">target port</var>
- as the owner of the clone, and append the clone to the <var
- title="">new ports</var> array.</p>
+ </li>
- <p class="note">If the original <var title="">ports</var>
- array was empty, then the <var title="">new ports</var> array will
- also be empty.</p>
+ <li>
+ <p>If any of the objects in <var title="">transfer</var> are
+ either the <var title="">source port</var> or the <var
+ title="">target port</var> (if any), then throw a
+ <code>DATA_CLONE_ERR</code> exception and abort these
+ steps.</p></li>
+
</li>
<li>
- <p>Make <var title="">new ports</var> into a <span
- title="dfn-read-only-array">read only</span> array.</p>
+ <p>If the <var title="">transfer</var> argument is present, then
+ for each object in <var title="">transfer</var> in turn, obtain
+ a new object by <span title="transfer a Transferable
+ object">transferring</span> the object to <var title="">new
+ owner</var>, and add a mapping from the old object to the new
+ transferred object to <var title="">transfer map</var>. If the
+ objects are <code>MessagePort</code> objects, also append the
+ new transferred object to the <var title="">new ports</var>
+ array.</p>
</li>
- <li><p>Let the <code
- title="dom-MessageEvent-ports">ports</code>
- attribute of the event be the <var title="">new ports</var>
- array.</p></li>
-
</ol>
</li>
+ <li>
+
+ <p>Make <var title="">new ports</var> into a <span
+ title="dfn-read-only-array">read only</span> array.</p>
+
+ </li>
+
+ <li><p>Let <var title="">message</var> be the method's first
+ argument.</p></li>
+
+ <li>
+
+ <p>Let <var title="">message clone</var> be the result of
+ obtaining a <span>structured clone</span> of the <var
+ title="">message</var> argument, with <var title="">transfer
+ map</var> as the <i>transfer map</i>. If this throws an exception,
+ then throw that exception and abort these steps.</p>
+
+ </li>
+
+ <li><p>Create an event that uses the <code>MessageEvent</code>
+ interface, with the name <code
+ title="event-message">message</code>, which does not bubble, is not
+ cancelable, and has no default action.</p></li>
+
+ <li><p>Let the <code title="dom-MessageEvent-data">data</code>
+ attribute of the event have the value of <var title="">message
+ clone</var>.</p></li>
+
+ <li><p>Let the <code title="dom-MessageEvent-ports">ports</code>
+ attribute of the event be the <var title="">new ports</var>
+ array.</p></li>
+
<li><p>If there is no <var title="">target port</var> (i.e. if <var
title="">source port</var> is not entangled), then abort these
steps.</p></li> <!-- we don't raise an exception if there is no
More information about the Commit-Watchers
mailing list