Closed Bug 1274364 Opened 4 years ago Closed 4 years ago

BroadcastChannel.postMessage should throw an InvalidStateError DOMException when channel is closed

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: mek, Assigned: baku)

Details

(Whiteboard: btpp-active)

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.36 Safari/537.36

Steps to reproduce:

Run the following javascript code:

let c = new BroadcastChannel("foo");
c.close();
c.postMessage("bar");


Actual results:

This throws Exception { message: "", result: 2147500037, name: "NS_ERROR_FAILURE", filename: "debugger eval code", lineNumber: 1, columnNumber: 0, data: null, stack: "@debugger eval code:1:7 " }


Expected results:

According to the spec [1] this should throw an InvalidStateError DOMException

[1]: https://html.spec.whatwg.org/multipage/comms.html#dom-broadcastchannel-postmessage
Flags: needinfo?(amarchesini)
Assignee: nobody → amarchesini
Flags: needinfo?(amarchesini)
Attached patch bc1.patchSplinter Review
Attachment #8754778 - Flags: review?(bugs)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: btpp-active
Comment on attachment 8754778 [details] [diff] [review]
bc1.patch

curious, can PostMessageInternal throw non-DOM errors?
Attachment #8754778 - Flags: review?(bugs) → review+
https://hg.mozilla.org/mozilla-central/rev/b3e9f93a67f4
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.