[html5] r5002 - [e] (0) Merge the two postMessage algorithsm back into one. Fixing http://www.w3 [...]

whatwg at whatwg.org whatwg at whatwg.org
Mon Apr 12 16:04:41 PDT 2010


Author: ianh
Date: 2010-04-12 16:04:40 -0700 (Mon, 12 Apr 2010)
New Revision: 5002

Modified:
   complete.html
   index
   source
Log:
[e] (0) Merge the two postMessage algorithsm back into one.
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=9395

Modified: complete.html
===================================================================
--- complete.html	2010-04-12 22:51:22 UTC (rev 5001)
+++ complete.html	2010-04-12 23:04:40 UTC (rev 5002)
@@ -1046,8 +1046,7 @@
       <ol>
        <li><a href=#authors><span class=secno>10.4.2.1 </span>Authors</a></li>
        <li><a href=#user-agents><span class=secno>10.4.2.2 </span>User agents</a></ol></li>
-     <li><a href=#posting-messages><span class=secno>10.4.3 </span>Posting messages</a></li>
-     <li><a href=#posting-messages-with-message-ports><span class=secno>10.4.4 </span>Posting messages with message ports</a></ol></li>
+     <li><a href=#posting-messages><span class=secno>10.4.3 </span>Posting messages</a></ol></li>
    <li><a href=#channel-messaging><span class=secno>10.5 </span>Channel messaging</a>
     <ol>
      <li><a href=#introduction-9><span class=secno>10.5.1 </span>Introduction</a></li>
@@ -53915,8 +53914,7 @@
   any <a href=#dom-showmodaldialog title=dom-showModalDialog>showModalDialog</a>(in DOMString url, in optional any argument<!--, in optional DOMString features-->);
 
   // <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 DOMString targetOrigin, in <a href=#messageportarray>MessagePortArray</a> ports);
+  void <a href=#dom-window-postmessage title=dom-window-postMessage>postMessage</a>(in any message, in DOMString targetOrigin, in optional <a href=#messageportarray>MessagePortArray</a> ports);
 
   // <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>;
@@ -54058,12 +54056,8 @@
 
   <ul><li>The <code title=dom-location><a href=#dom-location>location</a></code> object
 
-   <li>The <code title=dom-window-postMessage-2><a href=#dom-window-postmessage-2>postMessage()</a></code>
-   method with two arguments
+   <li>The <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> method
 
-   <li>The <code title=dom-window-postMessage-3><a href=#dom-window-postmessage-3>postMessage()</a></code>
-   method with three arguments
-
    <li>The <code title=dom-frames><a href=#dom-frames>frames</a></code> attribute
 
    <li>The <a href=#dynamic-nested-browsing-context-properties>dynamic nested browsing context properties</a>
@@ -54089,7 +54083,7 @@
 
    <p>For instance, if two frames containing <code><a href=#document>Document</a></code>s
    from different <a href=#origin title=origin>origins</a> access the same
-   <code><a href=#window>Window</a></code> object's <code title=dom-window-postMessage-2><a href=#dom-window-postmessage-2>postMessage()</a></code> method, they
+   <code><a href=#window>Window</a></code> object's <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> method, they
    will get distinct objects that are not equal.</p>
 
   </div>
@@ -71553,7 +71547,7 @@
 
    <p>For example, if document A contains an <code><a href=#the-iframe-element>iframe</a></code>
    element that contains document B, and script in document A calls
-   <code title=dom-window-postMessage-2><a href=#dom-window-postmessage-2>postMessage()</a></code> on the
+   <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> on the
    <code><a href=#window>Window</a></code> object of document B, then a message event will
    be fired on that object, marked as originating from the
    <code><a href=#window>Window</a></code> of document A. The script in document A might
@@ -71607,7 +71601,7 @@
   should also check that the data in question is of the expected
   format. Otherwise, if the source of the event has been attacked
   using a cross-site scripting flaw, further unchecked processing of
-  information sent using the <code title=dom-window-postMessage-2><a href=#dom-window-postmessage-2>postMessage()</a></code> method could
+  information sent using the <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> method could
   result in the attack being propagated into the receiver.</p>
 
   <p>Authors should not use the wildcard keyword (*) in the <var title="">targetOrigin</var> argument in messages that contain any
@@ -71636,7 +71630,7 @@
 
   <h4 id=posting-messages><span class=secno>10.4.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="">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="">ports</var> ])</dt>
 
    <dd>
 
@@ -71657,7 +71651,7 @@
 
   </dl><div class=impl>
 
-  <p>When a script invokes the <dfn id=dom-window-postmessage-2 title=dom-window-postMessage-2><code>postMessage(<var title="">message</var>, <var title="">targetOrigin</var>)</code></dfn> method (with only two
+  <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
   arguments) on a <code><a href=#window>Window</a></code> object, the user agent must
   follow these steps:
 
@@ -71683,123 +71677,35 @@
 
    <li>
 
-    <p>Return from the <code title=dom-window-postMessage-2><a href=#dom-window-postmessage-2>postMessage()</a></code> method, but
-    asynchronously continue running these steps.</p>
+    <p>If the <var title="">ports</var> argument is present but either
+    any of the entries in <var title="">ports</var> are null, or 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>
 
    </li>
 
    <li>
 
-    <p>If the <var title="">targetOrigin</var> argument is a single
-    literal U+002F SOLIDUS character (/), and the
-    <code><a href=#document>Document</a></code> of the <code><a href=#window>Window</a></code> object on which
-    the method was invoked does not have the <a href=#same-origin>same origin</a>
-    as the <a href=#entry-script>entry script</a>'s <a href="#script's-document" title="script's
-    document">document</a>, then abort these steps silently.</p>
+    <p>Let <var title="">new ports</var> be an empty array.</p>
 
-    <p>Otherwise, if the <var title="">targetOrigin</var> argument is
-    an <a href=#absolute-url>absolute URL</a>, and the <code><a href=#document>Document</a></code> of the
-    <code><a href=#window>Window</a></code> object on which the method was invoked does
-    not have the <a href=#same-origin>same origin</a> as <var title="">targetOrigin</var>, then abort these steps silently.</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>
 
-    <p>Otherwise, the <var title="">targetOrigin</var> argument is a
-    single literal U+002A ASTERISK character (*), and no origin check
-    is made.</p>
+    <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>
 
    <li>
 
-    <p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
-    interface, with the event name <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is
-    not cancelable, and has no default action. The <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute must be set to
-    the value of <var title="">message clone</var>, the <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute must be
-    set to the <a href=#unicode-serialization-of-an-origin title="Unicode serialization of an
-    origin">Unicode serialization</a> of the <a href=#origin>origin</a> of
-    the script that invoked the method, and the <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute must be
-    set to the <a href="#script's-global-object">script's global object</a>'s
-    <code><a href=#windowproxy>WindowProxy</a></code> object.</p> <!-- invariant: the global
-    object is always a Window if the script can see this method -->
-
-   </li>
-
-   <li>
-
-    <p><a href=#queue-a-task>Queue a task</a> to dispatch the event created in the
-    previous step at the <code><a href=#window>Window</a></code> object on which the
-    method was invoked. The <a href=#task-source>task source</a> for this <a href=#concept-task title=concept-task>task</a> is the <a href=#posted-message-task-source>posted message task
-    source</a>.</p>
-
-   </li>
-
-  </ol></div>
-
-
-  <div class=impl>
-
-  <h4 id=posting-messages-with-message-ports><span class=secno>10.4.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="">targetOrigin</var>, <var title="">ports</var>)</code></dfn> method (with three arguments) on
-  a <code><a href=#window>Window</a></code> object, the user agent must follow these
-  steps:
-
-  <ol><!-- EXCEPT WHERE NOTED, THESE STEPS ARE IDENTICAL TO THE PREVIOUS SECTION --><!-- one exception is the use of -3 instead of -2 in the xrefs --><li>
-
-    <p>If the value of the <var title="">targetOrigin</var> argument
-    is neither a single U+002A ASTERISK character (*), a single U+002F
-    SOLIDUS character (/), nor an <a href=#absolute-url>absolute URL</a> with a
-    <code title=url-host-specific><a href=#url-host-specific><host-specific></a></code>
-    component that is either empty or a single U+002F SOLIDUS
-    character (/), then throw a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception and
-    abort the overall set of steps.</p>
-
-   </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.</p>
-
-   </li>
-
-   <li> <!-- NEW STEP -->
-
-    <p>If the <var title="">ports</var> argument is empty<!-- or null
-    (if we make it nullable)-->, 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>
-
-   </li>
-
-   <li> <!-- NEW STEP -->
-
-    <p>If any of the entries in <var title="">ports</var> are null, 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
-    <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.</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
+    <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>
 
    </li>
@@ -71832,20 +71738,15 @@
     the value of <var title="">message clone</var>, the <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute must be
     set to the <a href=#unicode-serialization-of-an-origin title="Unicode serialization of an
     origin">Unicode serialization</a> of the <a href=#origin>origin</a> of
-    the script that invoked the method, and the <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute must be
+    the script that invoked the method, the <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute must be
     set to the <a href="#script's-global-object">script's global object</a>'s
-    <code><a href=#windowproxy>WindowProxy</a></code> object.</p> <!-- invariant: the global
-    object is always a Window if the script can see this method -->
+    <code><a href=#windowproxy>WindowProxy</a></code> object, and the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute must be set
+    to the <var title="">new ports</var> array.</p> <!-- invariant:
+    the global object is always a Window if the script can see this
+    method -->
 
    </li>
 
-   <li> <!-- NEW STEP -->
-
-    <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>
-
    <li>
 
     <p><a href=#queue-a-task>Queue a task</a> to dispatch the event created in the
@@ -71855,19 +71756,10 @@
 
    </li>
 
-  </ol><p class=note>These steps, with the exception of the third,
-  fourth, and fifth steps and the penultimate step, are identical to
-  those in the previous section.</p>
+  </ol></div>
 
-  <!-- v2: we can merge this section and the previous section when
-  implementations have shipped postMessage(). Anne asked that these
-  sections be kept separate so that implementors can avoid getting
-  confused with the 'port' step. -->
 
-  </div>
 
-
-
   <h3 id=channel-messaging><span class=secno>10.5 </span><dfn>Channel messaging</dfn></h3>
 
   <h4 id=introduction-9><span class=secno>10.5.1 </span>Introduction</h4>
@@ -71889,7 +71781,7 @@
   <pre>var channel = new MessageChannel();</pre>
 
   <p>One of the ports is kept as the local port, and the other port is
-  sent to the remote code, e.g. using <code title=dom-window-postMessage-3><a href=#dom-window-postmessage-3>postMessage()</a></code>:</p>
+  sent to the remote code, e.g. using <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code>:</p>
 
   <pre>otherWindow.postMessage('hello', 'http://example.com', [channel.port2]);</pre>
 

Modified: index
===================================================================
--- index	2010-04-12 22:51:22 UTC (rev 5001)
+++ index	2010-04-12 23:04:40 UTC (rev 5002)
@@ -940,8 +940,7 @@
       <ol>
        <li><a href=#authors><span class=secno>9.2.2.1 </span>Authors</a></li>
        <li><a href=#user-agents><span class=secno>9.2.2.2 </span>User agents</a></ol></li>
-     <li><a href=#posting-messages><span class=secno>9.2.3 </span>Posting messages</a></li>
-     <li><a href=#posting-messages-with-message-ports><span class=secno>9.2.4 </span>Posting messages with message ports</a></ol></li>
+     <li><a href=#posting-messages><span class=secno>9.2.3 </span>Posting messages</a></ol></li>
    <li><a href=#channel-messaging><span class=secno>9.3 </span>Channel messaging</a>
     <ol>
      <li><a href=#introduction-7><span class=secno>9.3.1 </span>Introduction</a></li>
@@ -53816,8 +53815,7 @@
   any <a href=#dom-showmodaldialog title=dom-showModalDialog>showModalDialog</a>(in DOMString url, in optional any argument<!--, in optional DOMString features-->);
 
   // <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 DOMString targetOrigin, in <a href=#messageportarray>MessagePortArray</a> ports);
+  void <a href=#dom-window-postmessage title=dom-window-postMessage>postMessage</a>(in any message, in DOMString targetOrigin, in optional <a href=#messageportarray>MessagePortArray</a> ports);
 
   // <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>;
@@ -53959,12 +53957,8 @@
 
   <ul><li>The <code title=dom-location><a href=#dom-location>location</a></code> object
 
-   <li>The <code title=dom-window-postMessage-2><a href=#dom-window-postmessage-2>postMessage()</a></code>
-   method with two arguments
+   <li>The <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> method
 
-   <li>The <code title=dom-window-postMessage-3><a href=#dom-window-postmessage-3>postMessage()</a></code>
-   method with three arguments
-
    <li>The <code title=dom-frames><a href=#dom-frames>frames</a></code> attribute
 
    <li>The <a href=#dynamic-nested-browsing-context-properties>dynamic nested browsing context properties</a>
@@ -53990,7 +53984,7 @@
 
    <p>For instance, if two frames containing <code><a href=#document>Document</a></code>s
    from different <a href=#origin title=origin>origins</a> access the same
-   <code><a href=#window>Window</a></code> object's <code title=dom-window-postMessage-2><a href=#dom-window-postmessage-2>postMessage()</a></code> method, they
+   <code><a href=#window>Window</a></code> object's <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> method, they
    will get distinct objects that are not equal.</p>
 
   </div>
@@ -65530,7 +65524,7 @@
 
    <p>For example, if document A contains an <code><a href=#the-iframe-element>iframe</a></code>
    element that contains document B, and script in document A calls
-   <code title=dom-window-postMessage-2><a href=#dom-window-postmessage-2>postMessage()</a></code> on the
+   <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> on the
    <code><a href=#window>Window</a></code> object of document B, then a message event will
    be fired on that object, marked as originating from the
    <code><a href=#window>Window</a></code> of document A. The script in document A might
@@ -65584,7 +65578,7 @@
   should also check that the data in question is of the expected
   format. Otherwise, if the source of the event has been attacked
   using a cross-site scripting flaw, further unchecked processing of
-  information sent using the <code title=dom-window-postMessage-2><a href=#dom-window-postmessage-2>postMessage()</a></code> method could
+  information sent using the <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code> method could
   result in the attack being propagated into the receiver.</p>
 
   <p>Authors should not use the wildcard keyword (*) in the <var title="">targetOrigin</var> argument in messages that contain any
@@ -65613,7 +65607,7 @@
 
   <h4 id=posting-messages><span class=secno>9.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="">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="">ports</var> ])</dt>
 
    <dd>
 
@@ -65634,7 +65628,7 @@
 
   </dl><div class=impl>
 
-  <p>When a script invokes the <dfn id=dom-window-postmessage-2 title=dom-window-postMessage-2><code>postMessage(<var title="">message</var>, <var title="">targetOrigin</var>)</code></dfn> method (with only two
+  <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
   arguments) on a <code><a href=#window>Window</a></code> object, the user agent must
   follow these steps:
 
@@ -65660,123 +65654,35 @@
 
    <li>
 
-    <p>Return from the <code title=dom-window-postMessage-2><a href=#dom-window-postmessage-2>postMessage()</a></code> method, but
-    asynchronously continue running these steps.</p>
+    <p>If the <var title="">ports</var> argument is present but either
+    any of the entries in <var title="">ports</var> are null, or 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>
 
    </li>
 
    <li>
 
-    <p>If the <var title="">targetOrigin</var> argument is a single
-    literal U+002F SOLIDUS character (/), and the
-    <code><a href=#document>Document</a></code> of the <code><a href=#window>Window</a></code> object on which
-    the method was invoked does not have the <a href=#same-origin>same origin</a>
-    as the <a href=#entry-script>entry script</a>'s <a href="#script's-document" title="script's
-    document">document</a>, then abort these steps silently.</p>
+    <p>Let <var title="">new ports</var> be an empty array.</p>
 
-    <p>Otherwise, if the <var title="">targetOrigin</var> argument is
-    an <a href=#absolute-url>absolute URL</a>, and the <code><a href=#document>Document</a></code> of the
-    <code><a href=#window>Window</a></code> object on which the method was invoked does
-    not have the <a href=#same-origin>same origin</a> as <var title="">targetOrigin</var>, then abort these steps silently.</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>
 
-    <p>Otherwise, the <var title="">targetOrigin</var> argument is a
-    single literal U+002A ASTERISK character (*), and no origin check
-    is made.</p>
+    <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>
 
    <li>
 
-    <p>Create an event that uses the <code><a href=#messageevent>MessageEvent</a></code>
-    interface, with the event name <code title=event-message><a href=#event-message>message</a></code>, which does not bubble, is
-    not cancelable, and has no default action. The <code title=dom-MessageEvent-data><a href=#dom-messageevent-data>data</a></code> attribute must be set to
-    the value of <var title="">message clone</var>, the <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute must be
-    set to the <a href=#unicode-serialization-of-an-origin title="Unicode serialization of an
-    origin">Unicode serialization</a> of the <a href=#origin>origin</a> of
-    the script that invoked the method, and the <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute must be
-    set to the <a href="#script's-global-object">script's global object</a>'s
-    <code><a href=#windowproxy>WindowProxy</a></code> object.</p> <!-- invariant: the global
-    object is always a Window if the script can see this method -->
-
-   </li>
-
-   <li>
-
-    <p><a href=#queue-a-task>Queue a task</a> to dispatch the event created in the
-    previous step at the <code><a href=#window>Window</a></code> object on which the
-    method was invoked. The <a href=#task-source>task source</a> for this <a href=#concept-task title=concept-task>task</a> is the <a href=#posted-message-task-source>posted message task
-    source</a>.</p>
-
-   </li>
-
-  </ol></div>
-
-
-  <div class=impl>
-
-  <h4 id=posting-messages-with-message-ports><span class=secno>9.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="">targetOrigin</var>, <var title="">ports</var>)</code></dfn> method (with three arguments) on
-  a <code><a href=#window>Window</a></code> object, the user agent must follow these
-  steps:
-
-  <ol><!-- EXCEPT WHERE NOTED, THESE STEPS ARE IDENTICAL TO THE PREVIOUS SECTION --><!-- one exception is the use of -3 instead of -2 in the xrefs --><li>
-
-    <p>If the value of the <var title="">targetOrigin</var> argument
-    is neither a single U+002A ASTERISK character (*), a single U+002F
-    SOLIDUS character (/), nor an <a href=#absolute-url>absolute URL</a> with a
-    <code title=url-host-specific><a href=#url-host-specific><host-specific></a></code>
-    component that is either empty or a single U+002F SOLIDUS
-    character (/), then throw a <code><a href=#syntax_err>SYNTAX_ERR</a></code> exception and
-    abort the overall set of steps.</p>
-
-   </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.</p>
-
-   </li>
-
-   <li> <!-- NEW STEP -->
-
-    <p>If the <var title="">ports</var> argument is empty<!-- or null
-    (if we make it nullable)-->, 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>
-
-   </li>
-
-   <li> <!-- NEW STEP -->
-
-    <p>If any of the entries in <var title="">ports</var> are null, 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
-    <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.</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
+    <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>
 
    </li>
@@ -65809,20 +65715,15 @@
     the value of <var title="">message clone</var>, the <code title=dom-MessageEvent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute must be
     set to the <a href=#unicode-serialization-of-an-origin title="Unicode serialization of an
     origin">Unicode serialization</a> of the <a href=#origin>origin</a> of
-    the script that invoked the method, and the <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute must be
+    the script that invoked the method, the <code title=dom-MessageEvent-source><a href=#dom-messageevent-source>source</a></code> attribute must be
     set to the <a href="#script's-global-object">script's global object</a>'s
-    <code><a href=#windowproxy>WindowProxy</a></code> object.</p> <!-- invariant: the global
-    object is always a Window if the script can see this method -->
+    <code><a href=#windowproxy>WindowProxy</a></code> object, and the <code title=dom-MessageEvent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute must be set
+    to the <var title="">new ports</var> array.</p> <!-- invariant:
+    the global object is always a Window if the script can see this
+    method -->
 
    </li>
 
-   <li> <!-- NEW STEP -->
-
-    <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>
-
    <li>
 
     <p><a href=#queue-a-task>Queue a task</a> to dispatch the event created in the
@@ -65832,19 +65733,10 @@
 
    </li>
 
-  </ol><p class=note>These steps, with the exception of the third,
-  fourth, and fifth steps and the penultimate step, are identical to
-  those in the previous section.</p>
+  </ol></div>
 
-  <!-- v2: we can merge this section and the previous section when
-  implementations have shipped postMessage(). Anne asked that these
-  sections be kept separate so that implementors can avoid getting
-  confused with the 'port' step. -->
 
-  </div>
 
-
-
   <h3 id=channel-messaging><span class=secno>9.3 </span><dfn>Channel messaging</dfn></h3>
 
   <h4 id=introduction-7><span class=secno>9.3.1 </span>Introduction</h4>
@@ -65866,7 +65758,7 @@
   <pre>var channel = new MessageChannel();</pre>
 
   <p>One of the ports is kept as the local port, and the other port is
-  sent to the remote code, e.g. using <code title=dom-window-postMessage-3><a href=#dom-window-postmessage-3>postMessage()</a></code>:</p>
+  sent to the remote code, e.g. using <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage()</a></code>:</p>
 
   <pre>otherWindow.postMessage('hello', 'http://example.com', [channel.port2]);</pre>
 

Modified: source
===================================================================
--- source	2010-04-12 22:51:22 UTC (rev 5001)
+++ source	2010-04-12 23:04:40 UTC (rev 5002)
@@ -60628,8 +60628,7 @@
   any <span title="dom-showModalDialog">showModalDialog</span>(in DOMString url, in optional any argument<!--, in optional DOMString features-->);
 
 <!--END w3c-html-->  // <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 DOMString targetOrigin, in <span>MessagePortArray</span> ports);
+  void <span title="dom-window-postMessage">postMessage</span>(in any message, in DOMString targetOrigin, in optional <span>MessagePortArray</span> ports);
 <!--START w3c-html-->
   // <span>event handler IDL attributes</span>
            attribute <span>Function</span> <span title="handler-onabort">onabort</span>;
@@ -60780,12 +60779,8 @@
 
    <li>The <code title="dom-location">location</code> object
 
-   <li>The <code title="dom-window-postMessage-2">postMessage()</code>
-   method with two arguments
+   <li>The <code title="dom-window-postMessage">postMessage()</code> method
 
-   <li>The <code title="dom-window-postMessage-3">postMessage()</code>
-   method with three arguments
-
    <li>The <code title="dom-frames">frames</code> attribute
 
    <li>The <span>dynamic nested browsing context properties</span>
@@ -60814,7 +60809,7 @@
    <p>For instance, if two frames containing <code>Document</code>s
    from different <span title="origin">origins</span> access the same
    <code>Window</code> object's <code
-   title="dom-window-postMessage-2">postMessage()</code> method, they
+   title="dom-window-postMessage">postMessage()</code> method, they
    will get distinct objects that are not equal.</p>
 
   </div>
@@ -80346,7 +80341,7 @@
 
    <p>For example, if document A contains an <code>iframe</code>
    element that contains document B, and script in document A calls
-   <code title="dom-window-postMessage-2">postMessage()</code> on the
+   <code title="dom-window-postMessage">postMessage()</code> on the
    <code>Window</code> object of document B, then a message event will
    be fired on that object, marked as originating from the
    <code>Window</code> of document A. The script in document A might
@@ -80403,7 +80398,7 @@
   format. Otherwise, if the source of the event has been attacked
   using a cross-site scripting flaw, further unchecked processing of
   information sent using the <code
-  title="dom-window-postMessage-2">postMessage()</code> method could
+  title="dom-window-postMessage">postMessage()</code> method could
   result in the attack being propagated into the receiver.</p>
 
   <p>Authors should not use the wildcard keyword (*) in the <var
@@ -80436,7 +80431,7 @@
 
   <dl class="domintro">
 
-   <dt><var title="">window</var> . <code title="dom-window-postMessage-2">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="">ports</var> ])</dt>
 
    <dd>
 
@@ -80462,9 +80457,9 @@
   <div class="impl">
 
   <p>When a script invokes the <dfn
-  title="dom-window-postMessage-2"><code>postMessage(<var
-  title="">message</var>, <var
-  title="">targetOrigin</var>)</code></dfn> method (with only two
+  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
   arguments) on a <code>Window</code> object, the user agent must
   follow these steps:
 
@@ -80493,145 +80488,38 @@
 
    <li>
 
-    <p>Return from the <code
-    title="dom-window-postMessage-2">postMessage()</code> method, but
-    asynchronously continue running these steps.</p>
+    <p>If the <var title="">ports</var> argument is present but either
+    any of the entries in <var title="">ports</var> are null, or 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>
 
    </li>
 
    <li>
 
-    <p>If the <var title="">targetOrigin</var> argument is a single
-    literal U+002F SOLIDUS character (/), and the
-    <code>Document</code> of the <code>Window</code> object on which
-    the method was invoked does not have the <span>same origin</span>
-    as the <span>entry script</span>'s <span title="script's
-    document">document</span>, then abort these steps silently.</p>
+    <p>Let <var title="">new ports</var> be an empty array.</p>
 
-    <p>Otherwise, if the <var title="">targetOrigin</var> argument is
-    an <span>absolute URL</span>, and the <code>Document</code> of the
-    <code>Window</code> object on which the method was invoked does
-    not have the <span>same origin</span> as <var
-    title="">targetOrigin</var>, then abort these steps silently.</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>
 
-    <p>Otherwise, the <var title="">targetOrigin</var> argument is a
-    single literal U+002A ASTERISK character (*), and no origin check
-    is made.</p>
+    <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>
 
    <li>
 
-    <p>Create an event that uses the <code>MessageEvent</code>
-    interface, with the event name <code
-    title="event-message">message</code>, which does not bubble, is
-    not cancelable, and has no default action. The <code
-    title="dom-MessageEvent-data">data</code> attribute must be set to
-    the value of <var title="">message clone</var>, the <code
-    title="dom-MessageEvent-origin">origin</code> attribute must be
-    set to the <span title="Unicode serialization of an
-    origin">Unicode serialization</span> of the <span>origin</span> of
-    the script that invoked the method, and the <code
-    title="dom-MessageEvent-source">source</code> attribute must be
-    set to the <span>script's global object</span>'s
-    <code>WindowProxy</code> object.</p> <!-- invariant: the global
-    object is always a Window if the script can see this method -->
-
-   </li>
-
-   <li>
-
-    <p><span>Queue a task</span> to dispatch the event created in the
-    previous step at the <code>Window</code> object on which the
-    method was invoked. The <span>task source</span> for this <span
-    title="concept-task">task</span> is the <span>posted message task
-    source</span>.</p>
-
-   </li>
-
-  </ol>
-
-  </div>
-
-
-  <div class="impl">
-
-  <h4>Posting messages with message ports</h4>
-
-  <p>When a script invokes the <dfn
-  title="dom-window-postMessage-3"><code>postMessage(<var
-  title="">message</var>, <var title="">targetOrigin</var>, <var
-  title="">ports</var>)</code></dfn> method (with three arguments) on
-  a <code>Window</code> object, the user agent must follow these
-  steps:
-
-  <ol>
-
-   <!-- EXCEPT WHERE NOTED, THESE STEPS ARE IDENTICAL TO THE PREVIOUS SECTION -->
-   <!-- one exception is the use of -3 instead of -2 in the xrefs -->
-
-   <li>
-
-    <p>If the value of the <var title="">targetOrigin</var> argument
-    is neither a single U+002A ASTERISK character (*), a single U+002F
-    SOLIDUS character (/), nor an <span>absolute URL</span> with a
-    <code title="url-host-specific"><host-specific></code>
-    component that is either empty or a single U+002F SOLIDUS
-    character (/), then throw a <code>SYNTAX_ERR</code> exception and
-    abort the overall set of steps.</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. If this throws an exception, then
-    throw that exception and abort these steps.</p>
-
-   </li>
-
-   <li> <!-- NEW STEP -->
-
-    <p>If the <var title="">ports</var> argument is empty<!-- or null
-    (if we make it nullable)-->, 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
-    title="">targetOrigin</var>.</p>
-
-   </li>
-
-   <li> <!-- NEW STEP -->
-
-    <p>If any of the entries in <var title="">ports</var> are null, if
-    any <code>MessagePort</code> object is listed in <var
-    title="">ports</var> more than once, or if 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.</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
-    title="dom-window-postMessage-3">postMessage()</code> method, but
+    title="dom-window-postMessage">postMessage()</code> method, but
     asynchronously continue running these steps.</p>
 
    </li>
@@ -80668,22 +80556,17 @@
     title="dom-MessageEvent-origin">origin</code> attribute must be
     set to the <span title="Unicode serialization of an
     origin">Unicode serialization</span> of the <span>origin</span> of
-    the script that invoked the method, and the <code
+    the script that invoked the method, the <code
     title="dom-MessageEvent-source">source</code> attribute must be
     set to the <span>script's global object</span>'s
-    <code>WindowProxy</code> object.</p> <!-- invariant: the global
-    object is always a Window if the script can see this method -->
+    <code>WindowProxy</code> object, and the <code
+    title="dom-MessageEvent-ports">ports</code> attribute must be set
+    to the <var title="">new ports</var> array.</p> <!-- invariant:
+    the global object is always a Window if the script can see this
+    method -->
 
    </li>
 
-   <li> <!-- NEW STEP -->
-
-    <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><span>Queue a task</span> to dispatch the event created in the
@@ -80696,15 +80579,6 @@
 
   </ol>
 
-  <p class="note">These steps, with the exception of the third,
-  fourth, and fifth steps and the penultimate step, are identical to
-  those in the previous section.</p>
-
-  <!-- v2: we can merge this section and the previous section when
-  implementations have shipped postMessage(). Anne asked that these
-  sections be kept separate so that implementors can avoid getting
-  confused with the 'port' step. -->
-
   </div>
 
 
@@ -80732,7 +80606,7 @@
 
   <p>One of the ports is kept as the local port, and the other port is
   sent to the remote code, e.g. using <code
-  title="dom-window-postMessage-3">postMessage()</code>:</p>
+  title="dom-window-postMessage">postMessage()</code>:</p>
 
   <pre>otherWindow.postMessage('hello', 'http://example.com', [channel.port2]);</pre>
 




More information about the Commit-Watchers mailing list