[html5] r6690 - [giow] (1) Make postMessage() accept the second and third arguments in either or [...]

whatwg at whatwg.org whatwg at whatwg.org
Mon Oct 17 14:47:21 PDT 2011


Author: ianh
Date: 2011-10-17 14:47:19 -0700 (Mon, 17 Oct 2011)
New Revision: 6690

Modified:
   complete.html
   index
   source
Log:
[giow] (1) Make postMessage() accept the second and third arguments in either order. Compat with WebKit and hopefully solves the difficulty people have about remembering which goes first.
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=13967

Modified: complete.html
===================================================================
--- complete.html	2011-10-15 00:08:03 UTC (rev 6689)
+++ complete.html	2011-10-17 21:47:19 UTC (rev 6690)
@@ -240,7 +240,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 15 October 2011</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 17 October 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>
@@ -62527,6 +62527,7 @@
 
 <!--POSTMSG-->  // <a href=#web-messaging>cross-document messaging</a>
   void <a href=#dom-window-postmessage title=dom-window-postMessage>postMessage</a>(any message, DOMString targetOrigin, optional sequence<<a href=#transferable>Transferable</a>> transfer);
+  void <a href=#dom-window-postmessage title=dom-window-postMessage>postMessage</a>(any message, sequence<<a href=#transferable>Transferable</a>> transfer, DOMString targetOrigin);
 <!--POSTMSG-->
   // <a href=#event-handler-idl-attributes>event handler IDL attributes</a>
   [TreatNonCallableAsNull] attribute <a href=#function>Function</a>? <a href=#handler-onabort title=handler-onabort>onabort</a>;
@@ -81706,6 +81707,7 @@
   <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="">transfer</var> ])</dt>
+   <dt><var title="">window</var> . <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage</a></code>(<var title="">message</var> [, <var title="">transfer</var> ], <var title="">targetOrigin</var>)</dt>
 
    <dd>
 
@@ -81722,6 +81724,10 @@
     <p>Throws a <code><a href=#datacloneerror>DataCloneError</a></code> if <var title="">transfer</var> array contains duplicate objects or if
     <var title="">message</var> could not be cloned.</p>
 
+    <p>The second and third arguments can be given in either order,
+    and the <var title="">transfer</var> array can be omitted
+    entirely.</p>
+
    </dd>
 
   </dl><p class=note>When posting a message to a <code><a href=#window>Window</a></code> of a
@@ -81738,12 +81744,33 @@
 
   <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="">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:</p>
+  <p>When a script invokes the <dfn id=dom-window-postmessage title=dom-window-postMessage><code>postMessage()</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:</p>
 
   <ol><!-- a lot of this is similar or identical to port.postMessage --><li>
 
+    <p>Let <var title="">message</var> be the first argument.</p>
+
+   </li>
+
+   <li>
+
+    <p>Let <var title="">targetOrigin</var> be the second argument if
+    the second argument is a string, or else the third argument.</p>
+
+   </li>
+
+   <li>
+
+    <p>Let <var title="">transfer</var> be the second argument if the
+    second argument is an array of <code><a href=#transferable>Transferable</a></code> objects,
+    or else the third argument.</p>
+
+   </li>
+
+   <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>, then
@@ -81767,7 +81794,8 @@
 
    <li>
 
-    <p>If the method was invoked with a third argument <var title="">transfer</var>, run these substeps:</p>
+    <p>If the method was invoked with three arguments, run these
+    substeps:</p>
 
     <ol><li>
 

Modified: index
===================================================================
--- index	2011-10-15 00:08:03 UTC (rev 6689)
+++ index	2011-10-17 21:47:19 UTC (rev 6690)
@@ -240,7 +240,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 15 October 2011</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 17 October 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>
@@ -62527,6 +62527,7 @@
 
 <!--POSTMSG-->  // <a href=#web-messaging>cross-document messaging</a>
   void <a href=#dom-window-postmessage title=dom-window-postMessage>postMessage</a>(any message, DOMString targetOrigin, optional sequence<<a href=#transferable>Transferable</a>> transfer);
+  void <a href=#dom-window-postmessage title=dom-window-postMessage>postMessage</a>(any message, sequence<<a href=#transferable>Transferable</a>> transfer, DOMString targetOrigin);
 <!--POSTMSG-->
   // <a href=#event-handler-idl-attributes>event handler IDL attributes</a>
   [TreatNonCallableAsNull] attribute <a href=#function>Function</a>? <a href=#handler-onabort title=handler-onabort>onabort</a>;
@@ -81706,6 +81707,7 @@
   <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="">transfer</var> ])</dt>
+   <dt><var title="">window</var> . <code title=dom-window-postMessage><a href=#dom-window-postmessage>postMessage</a></code>(<var title="">message</var> [, <var title="">transfer</var> ], <var title="">targetOrigin</var>)</dt>
 
    <dd>
 
@@ -81722,6 +81724,10 @@
     <p>Throws a <code><a href=#datacloneerror>DataCloneError</a></code> if <var title="">transfer</var> array contains duplicate objects or if
     <var title="">message</var> could not be cloned.</p>
 
+    <p>The second and third arguments can be given in either order,
+    and the <var title="">transfer</var> array can be omitted
+    entirely.</p>
+
    </dd>
 
   </dl><p class=note>When posting a message to a <code><a href=#window>Window</a></code> of a
@@ -81738,12 +81744,33 @@
 
   <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="">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:</p>
+  <p>When a script invokes the <dfn id=dom-window-postmessage title=dom-window-postMessage><code>postMessage()</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:</p>
 
   <ol><!-- a lot of this is similar or identical to port.postMessage --><li>
 
+    <p>Let <var title="">message</var> be the first argument.</p>
+
+   </li>
+
+   <li>
+
+    <p>Let <var title="">targetOrigin</var> be the second argument if
+    the second argument is a string, or else the third argument.</p>
+
+   </li>
+
+   <li>
+
+    <p>Let <var title="">transfer</var> be the second argument if the
+    second argument is an array of <code><a href=#transferable>Transferable</a></code> objects,
+    or else the third argument.</p>
+
+   </li>
+
+   <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>, then
@@ -81767,7 +81794,8 @@
 
    <li>
 
-    <p>If the method was invoked with a third argument <var title="">transfer</var>, run these substeps:</p>
+    <p>If the method was invoked with three arguments, run these
+    substeps:</p>
 
     <ol><li>
 

Modified: source
===================================================================
--- source	2011-10-15 00:08:03 UTC (rev 6689)
+++ source	2011-10-17 21:47:19 UTC (rev 6690)
@@ -70997,6 +70997,7 @@
 
 <!--END w3c-html--><!--POSTMSG-->  // <span>cross-document messaging</span>
   void <span title="dom-window-postMessage">postMessage</span>(any message, DOMString targetOrigin, optional sequence<<span>Transferable</span>> transfer);
+  void <span title="dom-window-postMessage">postMessage</span>(any message, sequence<<span>Transferable</span>> transfer, DOMString targetOrigin);
 <!--START w3c-html--><!--POSTMSG-->
   // <span>event handler IDL attributes</span>
   [TreatNonCallableAsNull] attribute <span>Function</span>? <span title="handler-onabort">onabort</span>;
@@ -92580,6 +92581,7 @@
   <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="">transfer</var> ])</dt>
+   <dt><var title="">window</var> . <code title="dom-window-postMessage">postMessage</code>(<var title="">message</var> [, <var title="">transfer</var> ], <var title="">targetOrigin</var>)</dt>
 
    <dd>
 
@@ -92599,6 +92601,10 @@
     title="">transfer</var> array contains duplicate objects or if
     <var title="">message</var> could not be cloned.</p>
 
+    <p>The second and third arguments can be given in either order,
+    and the <var title="">transfer</var> array can be omitted
+    entirely.</p>
+
    </dd>
 
   </dl>
@@ -92618,16 +92624,35 @@
   <div class="impl">
 
   <p>When a script invokes the <dfn
-  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>Window</code> object, the user agent must
-  follow these steps:</p>
+  title="dom-window-postMessage"><code>postMessage()</code></dfn>
+  method (with two or three arguments) on a <code>Window</code>
+  object, the user agent must follow these steps:</p>
 
   <ol> <!-- a lot of this is similar or identical to port.postMessage -->
 
    <li>
 
+    <p>Let <var title="">message</var> be the first argument.</p>
+
+   </li>
+
+   <li>
+
+    <p>Let <var title="">targetOrigin</var> be the second argument if
+    the second argument is a string, or else the third argument.</p>
+
+   </li>
+
+   <li>
+
+    <p>Let <var title="">transfer</var> be the second argument if the
+    second argument is an array of <code>Transferable</code> objects,
+    or else the third argument.</p>
+
+   </li>
+
+   <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>, then
@@ -92651,8 +92676,8 @@
 
    <li>
 
-    <p>If the method was invoked with a third argument <var
-    title="">transfer</var>, run these substeps:</p>
+    <p>If the method was invoked with three arguments, run these
+    substeps:</p>
 
     <ol>
 




More information about the Commit-Watchers mailing list