HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
2117Make postMessage() return void. (credit: js)2008-08-27 09:50
@@ -42299,22 +42299,22 @@ interface <dfn>MessageChannel</dfn> {
   <code>MessageChannel</code> object was created.</p>
 
 
   <h4>Message ports</h4>
 
   <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> {
   readonly attribute boolean <span title="dom-MessagePort-active">active</span>;
-  boolean <span title="dom-MessagePort-postMessage">postMessage</span>(in DOMString message);
-  boolean <span title="dom-MessagePort-postMessage">postMessage</span>(in DOMString message, in <span>MessagePort</span> messagePort);
+  void <span title="dom-MessagePort-postMessage">postMessage</span>(in DOMString message);
+  void <span title="dom-MessagePort-postMessage">postMessage</span>(in DOMString message, in <span>MessagePort</span> messagePort);
   <span>MessagePort</span> <span title="dom-MessagePort-startConversation">startConversation</span>(in DOMString message);
   void <span title="dom-MessagePort-start">start</span>();
   void <span title="dom-MessagePort-close">close</span>();
 
   // event handler attributes
            attribute <span>EventListener</span> <span title="handler-MessagePort-onmessage">onmessage</span>;
            attribute <span>EventListener</span> <span title="handler-MessagePort-onclose">onclose</span>;
 };</pre>
 
   <p>Objects implementing the <code>MessagePort</code> interface must
@@ -42411,25 +42411,25 @@ interface <dfn>MessageChannel</dfn> {
 
   <ol>
 
    <li><p>Let <var title="">message</var> be the method's first
    argument.</p></li>
 
    <li><p>Let <var title="">data port</var> be the method's second
    argument, if any.</p></li>
 
    <li><p>If the <var title="">source port</var> is not entangled with
-   another port, then return false and abort these steps.</p></li>
+   another port, then return and abort these steps.</p></li>
    <!-- we don't raise an exception because this can happen moment's
-   notice, but we return false so that the caller can check whether
-   the port was active at time of calling without a race
-   condition. -->
+   notice. listen to onclose if you want to know when things start
+   going wonky. (We don't return false because if the port is _about_
+   to be closed, the message might not be listened for anyway.) -->
 
    <li><p>Let <var title="">target port</var> be the port with which
    <var title="">source port</var> is entangled.</p></li>
 
    <li><p>Create an event that uses the <code>MessageEvent</code>
    interface, with the name <code
    title="event-message">message</code>, which does not bubble, is
    cancelable, and has no default action.</p></li>
 
    <li><p>Let the <code title="dom-MessageEvent-data">data</code>
@@ -42454,21 +42454,21 @@ interface <dfn>MessageChannel</dfn> {
      throw that exception and abort these steps.</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>
 
     </ol>
 
    </li>
 
-   <li><p>Return true from the method, but continue with these
+   <li><p>Return from the method, but continue with these
    steps.</p></li>
 
    <li><p>Add the event to the <span>port message queue</span> of <var
    title="">target port</var>.</p></li>
 
   </ol>
 
   <p class="big-issue">People often request the ability to send
   name/value pairs, arrays, and numbers using postMessage() instead of
   just strings.</p>
@@ -42482,49 +42482,51 @@ interface <dfn>MessageChannel</dfn> {
   invoking <code
   title="dom-MessagePort-postMessage">postMessage()</code> with one of
   the new ports. When invoked on a port <var title="">source
   port</var>, it must run the following steps:</p>
 
   <ol>
 
    <li><p>Let <var title="">message</var> be the method's first
    argument.</p></li>
 
+   <li><p><span>Create a new <code>MessagePort</code> object</span>
+   owned by the <span>script execution context</span>, and let <var
+   title="">port1</var> be that object.</p></li>
+
    <li><p>If the <var title="">source port</var> is not entangled with
-   another port, then return null and abort these steps.</p></li> <!--
-   we don't raise an exception because this can happen moment's
-   notice, but we return false so that the caller can check whether
-   the port was active at time of calling without a race
-   condition. -->
+   another port, then return <var title="">port1</var> and abort these
+   steps.</p></li>
+   <!-- we don't raise an exception because this can happen moment's
+   notice. listen to onclose if you want to know when things start
+   going wonky. (We don't return null because then we'd end up with
+   null derefs. better to just let the likely next postMessage call
+   fall on the floor) -->
 
    <li><p>Let <var title="">target port</var> be the port with which
    <var title="">source port</var> is entangled.</p></li>
 
+   <li><p><span>Create a new <code>MessagePort</code> object</span>
+   owned by the owner of the <var title="">target port</var>, and let
+   <var title="">port2</var> be that object.</p></li>
+
+   <li><p><span>Entangle</span> the <var title="">port1</var> and <var
+   title="">port2</var> objects.</p></li>
+
    <li><p>Create an event that uses the <code>MessageEvent</code>
    interface, with the name <code
    title="event-message">message</code>, which does not bubble, is
    cancelable, and has no default action.</p></li>
 
    <li><p>Let the <code title="dom-MessageEvent-data">data</code>
    attribute of the event have the value of <var
    title="">message</var>, the method's first argument.</p></li>
-
-   <li><p><span>Create a new <code>MessagePort</code> object</span>
-   owned by the <span>script execution context</span>, and let <var
-   title="">port1</var> be that object.</p></li>
-
-   <li><p><span>Create a new <code>MessagePort</code> object</span>
-   owned by the owner of the <var title="">target port</var>, and let
-   <var title="">port2</var> be that object.</p></li>
-
-   <li><p><span>Entangle</span> the <var title="">port1</var> and <var
-   title="">port2</var> objects.</p></li>
  
    <li><p>Let the <code
    title="dom-MessageEvent-messagePort">messagePort</code> attribute
    of the event be <var title="">port2</var>.</p></li>
 
    <li><p>Return <var title="">port1</var> from the method, but
    continue with these steps.</p></li>
 
    <li><p>Add the event to the <span>port message queue</span> of <var
    title="">target port</var>.</p></li>

|