Allow cloning and posting of closed ports. (credit: dw) (whatwg r3346)

Allow cloning and posting of closed ports. (credit: dw) (whatwg r3346)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.2484&r2=1.2485&f=h
http://html5.org/tools/web-apps-tracker?from=3345&to=3346

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.2484
retrieving revision 1.2485
diff -u -d -r1.2484 -r1.2485
--- Overview.html 1 Jul 2009 02:23:13 -0000 1.2484
+++ Overview.html 1 Jul 2009 03:55:07 -0000 1.2485
@@ -51635,9 +51635,8 @@
     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>
+    <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 or duplicate ports.</p>
 
    </dd>
 
@@ -51749,10 +51748,8 @@
 
    <li> <!-- NEW STEP -->
 
-    <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
+    <p>If any of the entries in <var title="">ports</var> are null, 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>
@@ -51920,9 +51917,8 @@
     <p>Posts a message through the channel, optionally with the given
     ports.</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>
+    <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 the source or target port.</p>
 
    </dd>
 
@@ -51984,17 +51980,10 @@
    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
-  either a new <code><a href="#messageport">MessagePort</a></code> object or an exception for the
-  caller to raise. These steps must be run atomically.</p>
-
-  <ol><li><p>If the <var title="">original port</var> is not entangled
-   without another port, then return an <code><a href="#invalid_state_err">INVALID_STATE_ERR</a></code>
-   exception and abort all these steps.</li>
-
-   <li><p>Let the <var title="">remote port</var> be the port with
-   which the <var title="">original port</var> is entangled.</li>
+  a new <code><a href="#messageport">MessagePort</a></code> object. These steps must be run
+  atomically.</p>
 
-   <li><p><a href="#create-a-new-messageport-object">Create a new <code>MessagePort</code> object</a>
+  <ol><li><p><a href="#create-a-new-messageport-object">Create a new <code>MessagePort</code> object</a>
    owned by <var title="">owner</var>, and let <var title="">new
    port</var> be that object.</li>
 
@@ -52004,9 +51993,19 @@
    <var title="">new port</var>'s <a href="#port-message-queue">port message queue</a> in
    its initial disabled state.</li>
 
-   <li><p><a href="#entangle">Entangle</a> the <var title="">remote port</var>
-   and <var title="">new port</var> objects. The <var title="">original port</var> object will be disentangled by this
-   process.</li>
+   <li>
+
+    <p>If the <var title="">original port</var> is entangled with
+    another port, then run these substeps:</p>
+
+    <ol><li><p>Let the <var title="">remote port</var> be the port with
+     which the <var title="">original port</var> is entangled.</li>
+
+     <li><p><a href="#entangle">Entangle</a> the <var title="">remote port</var>
+     and <var title="">new port</var> objects. The <var title="">original port</var> object will be disentangled by this
+     process.</li>
+
+    </ol></li>
 
    <li><p>Return <var title="">new port</var>. It is the
    clone.</li>
@@ -52021,48 +52020,43 @@
   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="">message</var> be the method's first
-   argument.</li>
-
-   <li><p>Let <var title="">data port</var> be the method's second
-   argument, if any.</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. If this throws an exception, then
-   throw that exception and abort these steps.</li>
+  <ol><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 <var title="">source port</var> is not entangled with
-   another port, then return and abort these steps.</li>
-   <!-- we don't raise an exception because this can happen moment's
-   notice. we don't return false because if the port is _about_
-   to be closed, the message might not be listened for anyway. -->
+   <li><p>If the method was called with a second argument <var title="">ports</var> and that argument isn't null, then, if any of
+   the entries in <var title="">ports</var> are null, or if any
+   <code><a href="#messageport">MessagePort</a></code> object is listed in <var title="">ports</var> more than once, 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="">target port</var> be the port with which
-   <var title="">source port</var> is entangled.</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 return false because
+   if the port is _about_ to be closed, the message might not be
+   listened for anyway. -->
 
    <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 <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 <var title="">message</var>. If this throws an exception, then throw
+   that exception and abort these steps.</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>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>
+   <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 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,
@@ -52082,9 +52076,6 @@
 
     </ol></li>
 
-   <li><p>Return from the method, but continue with these
-   steps.</li>
-
    <li><p>Add the event to the <a href="#port-message-queue">port message queue</a> of <var title="">target port</var>.</li>
 
   </ol><!--

Received on Wednesday, 1 July 2009 03:56:07 UTC