[html5] r2885 - [] (0) postMessage() methods that take MessagePort objects now take MessagePortA [...]

whatwg at whatwg.org whatwg at whatwg.org
Fri Mar 20 14:09:40 PDT 2009


Author: ianh
Date: 2009-03-20 14:09:39 -0700 (Fri, 20 Mar 2009)
New Revision: 2885

Modified:
   index
   source
Log:
[] (0) postMessage() methods that take MessagePort objects now take MessagePortArray objects.

Modified: index
===================================================================
--- index	2009-03-20 20:03:52 UTC (rev 2884)
+++ index	2009-03-20 21:09:39 UTC (rev 2885)
@@ -38778,7 +38778,7 @@
 
   // <a href=#crossDocumentMessages>cross-document messaging</a>
   void <a href=#dom-window-postmessage-2 title=dom-window-postMessage-2>postMessage</a>(in any message, in DOMString targetOrigin);
-  void <a href=#dom-window-postmessage-3 title=dom-window-postMessage-3>postMessage</a>(in any message, in <a href=#messageport>MessagePort</a> messagePort, in DOMString targetOrigin);
+  void <a href=#dom-window-postmessage-3 title=dom-window-postMessage-3>postMessage</a>(in any message, in <span>MessagePortArray</span> ports, in DOMString targetOrigin);
 
   // <a href=#event-handler-dom-attributes>event handler DOM attributes</a>
            attribute <a href=#function>Function</a> <a href=#handler-onabort title=handler-onabort>onabort</a>;
@@ -49708,9 +49708,9 @@
   readonly attribute DOMString <a href=#dom-messageevent-origin title=dom-MessageEvent-origin>origin</a>;
   readonly attribute DOMString <a href=#dom-messageevent-lasteventid title=dom-MessageEvent-lastEventId>lastEventId</a>;
   readonly attribute <a href=#windowproxy>WindowProxy</a> <a href=#dom-messageevent-source title=dom-MessageEvent-source>source</a>;
-  readonly attribute <a href=#messageport>MessagePort</a> <a href=#dom-messageevent-messageport title=dom-MessageEvent-messagePort>messagePort</a>;
-  void <a href=#dom-messageevent-initmessageevent title=dom-MessageEvent-initMessageEvent>initMessageEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any dataArg, in DOMString originArg, in DOMString lastEventIdArg, in <a href=#windowproxy>WindowProxy</a> sourceArg, in <a href=#messageport>MessagePort</a> messagePortArg);
-  void <a href=#dom-messageevent-initmessageeventns title=dom-MessageEvent-initMessageEventNS>initMessageEventNS</a>(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any dataArg, in DOMString originArg, in DOMString lastEventIdArg, in <a href=#windowproxy>WindowProxy</a> sourceArg, in <a href=#messageport>MessagePort</a> messagePortArg);
+  readonly attribute <span>MessagePortArray</span> <a href=#dom-messageevent-ports title=dom-MessageEvent-ports>ports</a>;
+  void <a href=#dom-messageevent-initmessageevent title=dom-MessageEvent-initMessageEvent>initMessageEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any dataArg, in DOMString originArg, in DOMString lastEventIdArg, in <a href=#windowproxy>WindowProxy</a> sourceArg, in <span>MessagePortArray</span> portsArg);
+  void <a href=#dom-messageevent-initmessageeventns title=dom-MessageEvent-initMessageEventNS>initMessageEventNS</a>(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any dataArg, in DOMString originArg, in DOMString lastEventIdArg, in <a href=#windowproxy>WindowProxy</a> sourceArg, in <span>MessagePortArray</span> portsArg);
 };</pre>
 
   <dl class=domintro><dt><var title="">event</var> . <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code></dt>
@@ -49748,13 +49748,13 @@
 
    </dd>
 
-   <dt><var title="">event</var> . <code title=dom-MessageEvent-messagePort><a href=#dom-messageevent-messageport>messagePort</a></code></dt>
+   <dt><var title="">event</var> . <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code></dt>
 
    <dd>
 
-    <p>Returns the <code><a href=#messageport>MessagePort</a></code> sent with the message, for
-    <a href=#crossDocumentMessages>cross-document messaging</a> and <a href=#channel-messaging>channel
-    messaging</a>.</p>
+    <p>Returns the <code>MessagePortArray</code> sent with the
+    message, for <a href=#crossDocumentMessages>cross-document messaging</a> and
+    <a href=#channel-messaging>channel messaging</a>.</p>
 
    </dd>
 
@@ -49784,18 +49784,18 @@
   <code><a href=#windowproxy>WindowProxy</a></code> of the <a href=#browsing-context>browsing context</a> of the
   <code><a href=#window>Window</a></code> object from which the message came.</p>
 
-  <p>The <dfn id=dom-messageevent-messageport title=dom-MessageEvent-messagePort><code>messagePort</code></dfn>
+  <p>The <dfn id=dom-messageevent-ports title=dom-MessageEvent-ports><code>ports</code></dfn>
   attribute represents, in <a href=#crossDocumentMessages>cross-document messaging</a> and
-  <a href=#channel-messaging>channel messaging</a> the <code><a href=#messageport>MessagePort</a></code> being
-  sent, if any.</p>
+  <a href=#channel-messaging>channel messaging</a> the <code>MessagePortArray</code>
+  being sent, if any.</p>
 
   <p>Unless otherwise specified, when the user agent creates and
   dispatches a <code title=event-message><a href=#event-message>message</a></code> event in the
   algorithms described in the following sections, the <code title=dom-MessageEvent-lastEventId><a href=#dom-messageevent-lasteventid>lastEventId</a></code> attribute
   must be the empty string, the <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute must be the
   empty string, the <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute must be
-  null, and the <code title=dom-MessageEvent-messagePort><a href=#dom-messageevent-messageport>messagePort</a></code>
-  attribute must be null.</p>
+  null, and the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute
+  must be null.</p>
 
   </div>
 
@@ -49911,17 +49911,22 @@
 
   <h4 id=posting-messages><span class=secno>7.2.3 </span>Posting messages</h4>
 
-  <dl class=domintro><dt><var title="">window</var> . <code title=dom-window-postMessage-2><a href=#dom-window-postmessage-2>postMessage</a></code>(<var title="">message</var>, [ <var title="">port</var>, ] <var title="">targetOrigin</var>)</dt>
+  <dl class=domintro><dt><var title="">window</var> . <code title=dom-window-postMessage-2><a href=#dom-window-postmessage-2>postMessage</a></code>(<var title="">message</var>, [ <var title="">ports</var>, ] <var title="">targetOrigin</var>)</dt>
 
    <dd>
 
-    <p>Posts a message, optionally with a port, to the given window.</p>
+    <p>Posts a message, optionally with an array of ports, to the
+    given window.</p>
 
     <p>If the origin of the target window doesn't match the given
     origin, the message is discarded, to avoid information leakage. To
     send the message to the target regardless of 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 is not null and it contains
+    either null entries, duplicate ports, or ports that are not
+    entangled.</p>
+
    </dd>
 
   </dl><div class=impl>
@@ -50000,7 +50005,7 @@
 
   <h4 id=posting-messages-with-message-ports><span class=secno>7.2.4 </span>Posting messages with message ports</h4>
 
-  <p>When a script invokes the <dfn id=dom-window-postmessage-3 title=dom-window-postMessage-3><code>postMessage(<var title="">message</var>, <var title="">messagePort</var>, <var title="">targetOrigin</var>)</code></dfn> method (with three
+  <p>When a script invokes the <dfn id=dom-window-postmessage-3 title=dom-window-postMessage-3><code>postMessage(<var title="">message</var>, <var title="">ports</var>, <var title="">targetOrigin</var>)</code></dfn> method (with three
   arguments) on a <code><a href=#window>Window</a></code> object, the user agent must
   follow these steps:
 
@@ -50027,7 +50032,7 @@
 
    <li> <!-- NEW STEP -->
 
-    <p>If the <var title="">messagePort</var> argument is null, then
+    <p>If the <var title="">ports</var> argument is null, then
     act as if the method had just been <a href=#dom-window-postmessage-2 title=dom-window-postMessage-2>called with two arguments</a>,
     <var title="">message</var> and <var title="">targetOrigin</var>.</p>
 
@@ -50035,13 +50040,30 @@
 
    <li> <!-- NEW STEP -->
 
-    <p>Try to obtain a <var title="">new port</var> by <a href=#clone-a-port title="clone a port">cloning</a> the <var title="">messagePort</var> argument with the <code><a href=#window>Window</a></code>
-    object on which the method was invoked as the owner of the
-    clone. If this returns an exception, then throw that exception and
-    abort these steps.</p>
+    <p>If any of the entries in <var title="">ports</var> are
+    null, if any of the entries in <var title="">ports</var>
+    are not entangled <code><a href=#messageport>MessagePort</a></code> objects, or if any
+    <code><a href=#messageport>MessagePort</a></code> object is listed in <var title="">ports</var> more than once, then throw an
+    <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</p>
 
    </li>
 
+   <li> <!-- NEW STEP -->
+
+    <p>Let <var title="">new ports</var> be an empty array.</p>
+
+    <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 <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>
+
+    <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>
+
    <li>
 
     <p>Return from the <code title=dom-window-postMessage-3><a href=#dom-window-postmessage-3>postMessage()</a></code> method, but
@@ -50077,8 +50099,8 @@
 
    <li> <!-- NEW STEP -->
  
-    <p>Let the <code title=dom-MessageEvent-messagePort><a href=#dom-messageevent-messageport>messagePort</a></code> attribute
-    of the event be the <var title="">new port</var>.</p>
+    <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.</p>
 
    </li>
 
@@ -50185,9 +50207,11 @@
   <p>Each channel has two message ports. Data sent through one port is
   received by the other port, and vice versa.</p>
 
-  <pre class=idl>interface <dfn id=messageport>MessagePort</dfn> {
+  <pre class=idl>typedef sequence<MessagePort> MessagePortArray;
+
+interface <dfn id=messageport>MessagePort</dfn> {
   readonly attribute boolean <a href=#dom-messageport-active title=dom-MessagePort-active>active</a>;
-  void <a href=#dom-messageport-postmessage title=dom-MessagePort-postMessage>postMessage</a>(in any message, [Optional] in <a href=#messageport>MessagePort</a> messagePort);<!--
+  void <a href=#dom-messageport-postmessage title=dom-MessagePort-postMessage>postMessage</a>(in any message, [Optional] in <span>MessagePortArray</span> ports);<!--
   <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>();
@@ -50204,14 +50228,16 @@
 
    </dd>
 
-   <dt><var title="">port</var> . <code title=dom-MessagePort-poseMessage>postMessage</code>(<var title="">message</var> [, <var title="">port</var>] )</dt>
+   <dt><var title="">port</var> . <code title=dom-MessagePort-poseMessage>postMessage</code>(<var title="">message</var> [, <var title="">ports</var>] )</dt>
 
    <dd>
 
-    <p>Posts a message through the channel, optionally with the given port.</p>
+    <p>Posts a message through the channel, optionally with the given
+    ports.</p>
 
-    <p>Throws an <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code> if the port to be
-    sent is one of the ports involved in the communication.</p>
+    <p>Throws an <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> if the <var title="">ports</var> array is not null and it contains
+    either null entries, duplicate ports, ports that are not
+    entangled, or the source or target port.</p>
 
    </dd>
 
@@ -50332,20 +50358,37 @@
    attribute of the event have the value of <var title="">message
    clone</var>.</li>
 
-   <li><p>If the method was called with a second argument <var title="">data port</var> and that argument isn't null, then run the
-   following substeps:</p>
+   <li><p>If the method was called with a second argument <var title="">ports</var> and that argument isn't null, then run
+   the following substeps:</p>
 
-    <ol><li><p>If the <var title="">data port</var> is the <var title="">source port</var> or the <var title="">target
-     port</var>, then throw an <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code>
-     exception and abort all these steps.</li>
+    <ol><li>
 
-     <li><p>Try to obtain a <var title="">new data port</var> by <a href=#clone-a-port title="clone a port">cloning</a> the <var title="">data
-     port</var> with the owner of the <var title="">target port</var>
-     as the owner of the clone. If this returns an exception, then
-     throw that exception and abort these steps.</li>
+      <p>If any of the entries in <var title="">ports</var> are
+      null, if any of the entries in <var title="">ports</var>
+      are not entangled <code><a href=#messageport>MessagePort</a></code> objects, or if any
+      <code><a href=#messageport>MessagePort</a></code> object is listed in <var title="">ports</var> more than once, then throw an
+      <code><a href=#invalid_state_err>INVALID_STATE_ERR</a></code> exception.</p>
+
+     </li>
+
+     <li>
+
+      <p>Let <var title="">new ports</var> be an empty array.</p>
+
+      <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 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>
  
-     <li><p>Let the <code title=dom-MessageEvent-messagePort><a href=#dom-messageevent-messageport>messagePort</a></code> attribute
-     of the event be the <var title="">new data port</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>
 
     </ol></li>
 
@@ -50403,8 +50446,9 @@
    title="">message</var>, the method's first argument.</p></li>
  
    <li><p>Let the <code
-   title="dom-MessageEvent-messagePort">messagePort</code> attribute
-   of the event be <var title="">port2</var>.</p></li>
+   title="dom-MessageEvent-ports">ports</code> attribute
+   of the event be an array containing only <var
+   title="">port2</var>.</p></li>
 
    <li><p>Return <var title="">port1</var> from the method, but
    continue with these steps.</p></li>
@@ -50484,6 +50528,9 @@
   <!-- we might not need to explicitly say the first part of DOM
   Events is fixed to say that events on a task queue prevent GC -->
 
+  <!-- XXX what about ports in the ports attribute of a MessageEvent
+  that isn't dispatched yet? -->
+
   </div>
 
 

Modified: source
===================================================================
--- source	2009-03-20 20:03:52 UTC (rev 2884)
+++ source	2009-03-20 21:09:39 UTC (rev 2885)
@@ -43946,7 +43946,7 @@
 
   // <span>cross-document messaging</span>
   void <span title="dom-window-postMessage-2">postMessage</span>(in any message, in DOMString targetOrigin);
-  void <span title="dom-window-postMessage-3">postMessage</span>(in any message, in <span>MessagePort</span> messagePort, in DOMString targetOrigin);
+  void <span title="dom-window-postMessage-3">postMessage</span>(in any message, in <span>MessagePortArray</span> ports, in DOMString targetOrigin);
 
   // <span>event handler DOM attributes</span>
            attribute <span>Function</span> <span title="handler-onabort">onabort</span>;
@@ -58294,7 +58294,7 @@
 
   <!-- the XXX below is for collapsing this interface onto WorkerGlobalScope so it looks like just one interface - the inheritance is a spec fiction only -->
   <pre class="idl">[NoInterfaceObject, XXX] interface <dfn>DedicatedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope</span> {
-  void <span title="dom-DedicatedWorkerGlobalScope-postMessage">postMessage</span>(in any message, [Optional] in <span>MessagePort</span> messagePort);<!--
+  void <span title="dom-DedicatedWorkerGlobalScope-postMessage">postMessage</span>(in any message, [Optional] in <span>MessagePortArray</span> ports);<!--
   <span>MessagePort</span> <span title="dom-DedicatedWorkerGlobalScope-startConversation">startConversation</span>(in any message);-->
            attribute <span>EventListener</span> <span title="handler-DedicatedWorkerGlobalScope-onmessage">onmessage</span>;
 };</pre>
@@ -58881,7 +58881,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, [Optional] in <span>MessagePort</span> messagePort);<!--
+  void <span title="dom-Worker-postMessage">postMessage</span>(in any message, [Optional] in <span>MessagePortArray</span> ports);<!--
   <span>MessagePort</span> <span title="dom-Worker-startConversation">startConversation</span>(in any message);-->
            attribute <span>EventListener</span> <span title="handler-Worker-onmessage">onmessage</span>;
 };</pre>
@@ -59086,10 +59086,10 @@
        cancelable, has no default action, has a <code
        title="dom-MessageEvent-data">data</code> attribute whose value
        is the empty string and has a <code
-       title="dom-MessageEvent-messagePort">messagePort</code>
-       attribute whose value is the newly created port, and
-       <span>queue a task</span> to dispatch the event at <var
-       title="">worker global scope</var>.</p></li>
+       title="dom-MessageEvent-ports">ports</code>
+       attribute whose value is an array containing only the newly
+       created port, and <span>queue a task</span> to dispatch the
+       event at <var title="">worker global scope</var>.</p></li>
 
        <li><p>Abort all these steps.</p></li>
 
@@ -59129,10 +59129,10 @@
    cancelable, has no default action, has a <code
    title="dom-MessageEvent-data">data</code> attribute whose value is
    the empty string and has a <code
-   title="dom-MessageEvent-messagePort">messagePort</code> attribute
-   whose value is the newly created port, and <span>queue a
-   task</span> to dispatch the event at <var title="">worker global
-   scope</var>.</p></li>
+   title="dom-MessageEvent-ports">ports</code> attribute
+   whose value is an array containing only the newly created port, and
+   <span>queue a task</span> to dispatch the event at <var
+   title="">worker global scope</var>.</p></li>
 
    <li>
 
@@ -59414,9 +59414,9 @@
   readonly attribute DOMString <span title="dom-MessageEvent-origin">origin</span>;
   readonly attribute DOMString <span title="dom-MessageEvent-lastEventId">lastEventId</span>;
   readonly attribute <span>WindowProxy</span> <span title="dom-MessageEvent-source">source</span>;
-  readonly attribute <span>MessagePort</span> <span title="dom-MessageEvent-messagePort">messagePort</span>;
-  void <span title="dom-MessageEvent-initMessageEvent">initMessageEvent</span>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any dataArg, in DOMString originArg, in DOMString lastEventIdArg, in <span>WindowProxy</span> sourceArg, in <span>MessagePort</span> messagePortArg);
-  void <span title="dom-MessageEvent-initMessageEventNS">initMessageEventNS</span>(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any dataArg, in DOMString originArg, in DOMString lastEventIdArg, in <span>WindowProxy</span> sourceArg, in <span>MessagePort</span> messagePortArg);
+  readonly attribute <span>MessagePortArray</span> <span title="dom-MessageEvent-ports">ports</span>;
+  void <span title="dom-MessageEvent-initMessageEvent">initMessageEvent</span>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any dataArg, in DOMString originArg, in DOMString lastEventIdArg, in <span>WindowProxy</span> sourceArg, in <span>MessagePortArray</span> portsArg);
+  void <span title="dom-MessageEvent-initMessageEventNS">initMessageEventNS</span>(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any dataArg, in DOMString originArg, in DOMString lastEventIdArg, in <span>WindowProxy</span> sourceArg, in <span>MessagePortArray</span> portsArg);
 };</pre>
 
   <dl class="domintro">
@@ -59456,13 +59456,13 @@
 
    </dd>
 
-   <dt><var title="">event</var> . <code title="dom-MessageEvent-messagePort">messagePort</code></dt>
+   <dt><var title="">event</var> . <code title="dom-MessageEvent-ports">ports</code></dt>
 
    <dd>
 
-    <p>Returns the <code>MessagePort</code> sent with the message, for
-    <span>cross-document messaging</span> and <span>channel
-    messaging</span>.</p>
+    <p>Returns the <code>MessagePortArray</code> sent with the
+    message, for <span>cross-document messaging</span> and
+    <span>channel messaging</span>.</p>
 
    </dd>
 
@@ -59502,10 +59502,10 @@
   <code>Window</code> object from which the message came.</p>
 
   <p>The <dfn
-  title="dom-MessageEvent-messagePort"><code>messagePort</code></dfn>
+  title="dom-MessageEvent-ports"><code>ports</code></dfn>
   attribute represents, in <span>cross-document messaging</span> and
-  <span>channel messaging</span> the <code>MessagePort</code> being
-  sent, if any.</p>
+  <span>channel messaging</span> the <code>MessagePortArray</code>
+  being sent, if any.</p>
 
   <p>Unless otherwise specified, when the user agent creates and
   dispatches a <code title="event-message">message</code> event in the
@@ -59515,8 +59515,9 @@
   title="dom-MessageEvent-origin">origin</code> attribute must be the
   empty string, the <code
   title="dom-MessageEvent-source">source</code> attribute must be
-  null, and the <code title="dom-MessageEvent-messagePort">messagePort</code>
-  attribute must be null.</p>
+  null, and the <code
+  title="dom-MessageEvent-ports">ports</code> attribute
+  must be null.</p>
 
   </div>
 
@@ -61359,17 +61360,23 @@
 
   <dl class="domintro">
 
-   <dt><var title="">window</var> . <code title="dom-window-postMessage-2">postMessage</code>(<var title="">message</var>, [ <var title="">port</var>, ] <var title="">targetOrigin</var>)</dt>
+   <dt><var title="">window</var> . <code title="dom-window-postMessage-2">postMessage</code>(<var title="">message</var>, [ <var title="">ports</var>, ] <var title="">targetOrigin</var>)</dt>
 
    <dd>
 
-    <p>Posts a message, optionally with a port, to the given window.</p>
+    <p>Posts a message, optionally with an array of ports, to the
+    given window.</p>
 
     <p>If the origin of the target window doesn't match the given
     origin, the message is discarded, to avoid information leakage. To
     send the message to the target regardless of 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 is not null and it contains
+    either null entries, duplicate ports, or ports that are not
+    entangled.</p>
+
    </dd>
 
   </dl>
@@ -61467,7 +61474,7 @@
 
   <p>When a script invokes the <dfn
   title="dom-window-postMessage-3"><code>postMessage(<var
-  title="">message</var>, <var title="">messagePort</var>, <var
+  title="">message</var>, <var title="">ports</var>, <var
   title="">targetOrigin</var>)</code></dfn> method (with three
   arguments) on a <code>Window</code> object, the user agent must
   follow these steps:
@@ -61502,7 +61509,7 @@
 
    <li> <!-- NEW STEP -->
 
-    <p>If the <var title="">messagePort</var> argument is null, then
+    <p>If the <var title="">ports</var> argument is null, then
     act as if the method had just been <span
     title="dom-window-postMessage-2">called with two arguments</span>,
     <var title="">message</var> and <var
@@ -61512,15 +61519,31 @@
 
    <li> <!-- NEW STEP -->
 
-    <p>Try to obtain a <var title="">new port</var> by <span
-    title="clone a port">cloning</span> the <var
-    title="">messagePort</var> argument with the <code>Window</code>
-    object on which the method was invoked as the owner of the
-    clone. If this returns an exception, then throw that exception and
-    abort these steps.</p>
+    <p>If any of the entries in <var title="">ports</var> are
+    null, if any of the entries in <var title="">ports</var>
+    are not entangled <code>MessagePort</code> objects, or if any
+    <code>MessagePort</code> object is listed in <var
+    title="">ports</var> more than once, then throw an
+    <code>INVALID_STATE_ERR</code> exception.</p>
 
    </li>
 
+   <li> <!-- NEW STEP -->
+
+    <p>Let <var title="">new ports</var> be an empty array.</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 <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>
+
+    <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>
+
    <li>
 
     <p>Return from the <code
@@ -61562,8 +61585,8 @@
    <li> <!-- NEW STEP -->
  
     <p>Let the <code
-    title="dom-MessageEvent-messagePort">messagePort</code> attribute
-    of the event be the <var title="">new port</var>.</p>
+    title="dom-MessageEvent-ports">ports</code> attribute
+    of the event be the <var title="">new ports</var> array.</p>
 
    </li>
 
@@ -61687,9 +61710,11 @@
   <p>Each channel has two message ports. Data sent through one port is
   received by the other port, and vice versa.</p>
 
-  <pre class="idl">interface <dfn>MessagePort</dfn> {
+  <pre class="idl">typedef sequence<MessagePort> MessagePortArray;
+
+interface <dfn>MessagePort</dfn> {
   readonly attribute boolean <span title="dom-MessagePort-active">active</span>;
-  void <span title="dom-MessagePort-postMessage">postMessage</span>(in any message, [Optional] in <span>MessagePort</span> messagePort);<!--
+  void <span title="dom-MessagePort-postMessage">postMessage</span>(in any message, [Optional] in <span>MessagePortArray</span> ports);<!--
   <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>();
@@ -61708,14 +61733,17 @@
 
    </dd>
 
-   <dt><var title="">port</var> . <code title="dom-MessagePort-poseMessage">postMessage</code>(<var title="">message</var> [, <var title="">port</var>] )</dt>
+   <dt><var title="">port</var> . <code title="dom-MessagePort-poseMessage">postMessage</code>(<var title="">message</var> [, <var title="">ports</var>] )</dt>
 
    <dd>
 
-    <p>Posts a message through the channel, optionally with the given port.</p>
+    <p>Posts a message through the channel, optionally with the given
+    ports.</p>
 
-    <p>Throws an <code>INVALID_ACCESS_ERR</code> if the port to be
-    sent is one of the ports involved in the communication.</p>
+    <p>Throws an <code>INVALID_STATE_ERR</code> if the <var
+    title="">ports</var> array is not null and it contains
+    either null entries, duplicate ports, ports that are not
+    entangled, or the source or target port.</p>
 
    </dd>
 
@@ -61863,25 +61891,42 @@
    clone</var>.</p></li>
 
    <li><p>If the method was called with a second argument <var
-   title="">data port</var> and that argument isn't null, then run the
-   following substeps:</p>
+   title="">ports</var> and that argument isn't null, then run
+   the following substeps:</p>
 
     <ol>
 
-     <li><p>If the <var title="">data port</var> is the <var
-     title="">source port</var> or the <var title="">target
-     port</var>, then throw an <code>INVALID_ACCESS_ERR</code>
-     exception and abort all these steps.</p></li>
+     <li>
 
-     <li><p>Try to obtain a <var title="">new data port</var> by <span
-     title="clone a port">cloning</span> the <var title="">data
-     port</var> with the owner of the <var title="">target port</var>
-     as the owner of the clone. If this returns an exception, then
-     throw that exception and abort these steps.</p></li>
+      <p>If any of the entries in <var title="">ports</var> are
+      null, if any of the entries in <var title="">ports</var>
+      are not entangled <code>MessagePort</code> objects, or if any
+      <code>MessagePort</code> object is listed in <var
+      title="">ports</var> more than once, then throw an
+      <code>INVALID_STATE_ERR</code> exception.</p>
+
+     </li>
+
+     <li>
+
+      <p>Let <var title="">new ports</var> be an empty array.</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>
+
+      <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>
  
      <li><p>Let the <code
-     title="dom-MessageEvent-messagePort">messagePort</code> attribute
-     of the event be the <var title="">new data port</var>.</p></li>
+     title="dom-MessageEvent-ports">ports</code>
+     attribute of the event be the <var title="">new ports</var>
+     array.</p></li>
 
     </ol>
 
@@ -61944,8 +61989,9 @@
    title="">message</var>, the method's first argument.</p></li>
  
    <li><p>Let the <code
-   title="dom-MessageEvent-messagePort">messagePort</code> attribute
-   of the event be <var title="">port2</var>.</p></li>
+   title="dom-MessageEvent-ports">ports</code> attribute
+   of the event be an array containing only <var
+   title="">port2</var>.</p></li>
 
    <li><p>Return <var title="">port1</var> from the method, but
    continue with these steps.</p></li>
@@ -62039,6 +62085,9 @@
   <!-- we might not need to explicitly say the first part of DOM
   Events is fixed to say that events on a task queue prevent GC -->
 
+  <!-- XXX what about ports in the ports attribute of a MessageEvent
+  that isn't dispatched yet? -->
+
   </div>
 
 




More information about the Commit-Watchers mailing list