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 13967 - Webkit implementation swaps second argument 'targetOrigin' with third argument 'ports'
Summary: Webkit implementation swaps second argument 'targetOrigin' with third argumen...
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: Web Messaging (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: public-webapps-bugzilla
Depends on:
Reported: 2011-08-30 04:28 UTC by contributor
Modified: 2011-10-17 22:21 UTC (History)
5 users (show)

See Also:


Description contributor 2011-08-30 04:28:14 UTC

Webkit implementation does not use the second argument 'targetOrigin',

Posted from:
User agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.862.0 Safari/535.2
Comment 1 johnjbarton 2011-08-30 04:38:41 UTC
Bug 63141 - Wrong argument order in window.postMessage
Comment 2 johnjbarton 2011-08-30 15:53:49 UTC
Corrected the title and offering an opinion:

I think the spec should prefer the arguments for MessageChannel postMessage and window postMessage to be the same:
  otherWindow.postMessage(message, targetOrigin, ports);
Spec can allow implementations to allow type detection on the arguments such that
  otherWindow.postMessage(message, ports, targetOrigin);
is allowed.  The argument |port| must be typeof object and |targetOrigin| must be typeof string.

Unfortunately this issue is important for MessageChannel primarily because the spec seems to be the only documentation currently available.
Comment 3 Ian 'Hixie' Hickson 2011-10-17 21:50:08 UTC
Looks like only WebKit implements MessagePort through postMessage() correctly enough for this to matter, and WebKit allows the second and third arguments in either order. So I've changed the spec to match that.

EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, 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:

Status: Accepted
Change Description: see diff given below
Rationale: Concurred with reporter's comments.
Comment 4 contributor 2011-10-17 21:51:04 UTC
Checked in as WHATWG revision r6690.
Check-in comment: 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.
Comment 5 Olli Pettay 2011-10-17 22:02:40 UTC
Webkit's behavior makes no sense. We shouldn't define implementation bugs in the
specs if just possible.
Comment 6 contributor 2011-10-17 22:13:38 UTC
Checked in as WHATWG revision r6691.
Check-in comment: Revert last checkin. My testing was bogus.
Comment 7 Ian 'Hixie' Hickson 2011-10-17 22:15:14 UTC
Yeah my testing was bogus, WebKit doesn't do that. (Though I kinda wish it did. I don't think it's as bad as you and zcorpan seem to think.)
Comment 8 Ian 'Hixie' Hickson 2011-10-17 22:21:19 UTC
Ok so the situation here is that Opera does what the spec says today and WebKit does what the spec used to say. The proposal in comment 2, to support either order, got a pretty negative reaction as soon as I put it in, from both Olli and Simon. So...

Unless there's a compat need due to WebKit having long shipped with the arguments the other way around, we should stick to the order we have now.