[Bug 7375] New: Incorrect specification for window.postMessage()'s handling of unentangled ports

http://www.w3.org/Bugs/Public/show_bug.cgi?id=7375

           Summary: Incorrect specification for window.postMessage()'s
                    handling of unentangled ports
           Product: HTML WG
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: HTML5 spec bugs
        AssignedTo: dave.null@w3.org
        ReportedBy: atwilson@google.com
         QAContact: public-html-bugzilla@w3.org
                CC: ian@hixie.ch, mike@w3.org, public-html@w3.org


Currently, the checks specified for MessagePort.postMessage() are different
from the checks done in window.postMessage() (as described in section 7.2.4
"Posting messages with message ports").

In particular, step 4 of section 7.2.4 says:

If any of the entries in ports are null, if any of the entries in ports are not
entangled MessagePort objects, or if any MessagePort object is listed in ports
more than once, then throw an INVALID_STATE_ERR exception.

The spec for MessagePort.postMessage() does not throw an exception if any of
the entries in ports are not entangled (per this thread). We should probably
update the spec for window.postMessage() to define the same behavior there as
well.

Also, as written, the spec now incorrectly lets us send a cloned port multiple
times. So code like this would not generate an error:

var channel = new MessageChannel();
otherWindow.postMessage("message1", channel.port1);
otherWindow.postMessage("message2", channel.port1);   // Sent the same port
again

The current WebKit behavior is to throw an INVALID_STATE_ERR in this case,
while still allowing closed ports to be sent, which I believe is the intended
behavior based on previous discussions. If this is correct, we should update
the spec to prohibit resending cloned ports.


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Wednesday, 19 August 2009 22:13:40 UTC