This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 7375 - Incorrect specification for window.postMessage()'s handling of unentangled ports
Summary: Incorrect specification for window.postMessage()'s handling of unentangled ports
Status: VERIFIED WORKSFORME
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: All All
: P3 normal
Target Milestone: LC
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords: NE, NoReply
Depends on:
Blocks:
 
Reported: 2009-08-19 22:13 UTC by Drew Wilson
Modified: 2010-10-04 13:56 UTC (History)
3 users (show)

See Also:


Attachments

Description Drew Wilson 2009-08-19 22:13:31 UTC
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.
Comment 1 Ian 'Hixie' Hickson 2009-09-19 22:08:13 UTC
I believe this was fixed a while back in response to an e-mail to this effect.
Comment 2 Maciej Stachowiak 2010-03-14 14:49:47 UTC
This bug predates the HTML Working Group Decision Policy.

If you are satisfied with the resolution of this bug, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
  http://dev.w3.org/html5/decision-policy/decision-policy.html

This bug is now being moved to VERIFIED. Please respond within two weeks. If this bug is not closed, reopened or escalated within two weeks, it may be marked as NoReply and will no longer be considered a pending comment.