Bug 94310 - [JSC] window.postMessage() throws wrong exception types
Summary: [JSC] window.postMessage() throws wrong exception types
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: http://www.w3.org/TR/html5/comms.html...
Keywords:
Depends on: 94493 94581
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-17 01:09 PDT by Chris Dumez
Modified: 2012-09-03 01:09 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2012-08-17 01:09:19 PDT
According the HTML5 communication spec (http://www.w3.org/TR/html5/comms.html#dom-window-postmessage-2), window.postMessage() "Throws an INVALID_STATE_ERR if the ports array is not null and it contains either null entries or duplicate ports." but we currently throw a TypeError in this case.

According to the structured clone spec (http://www.w3.org/TR/html5/common-dom-interfaces.html#structured-clone), we are supposed to throw a DATA_CLONE_ERR exception and abort the overall structured clone algorithm if the input is an unsupported native object type (e.g. Error, Function) or a host object (e.g. a DOM node). We currently throw a TypeError in this case as well.

The V8 implementation behaves according to specification.

This is already tested by:
  fast/dom/Window/window-postmessage-clone-really-deep-array.html
  fast/events/message-port-multi.html
Comment 1 Chris Dumez 2012-09-03 01:09:59 PDT
Dependencies have landed. Closing this bug.