Closed Bug 624506 Opened 14 years ago Closed 14 years ago

postMessage() should not accept non-string messages if it doesn't support them

Categories

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

defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 553125

People

(Reporter: david, Unassigned)

Details

The postMessage() implementation in Firefox 4b8 accepts any value as the first argument to postMessage(), but apparently just converts it to a string and sends the string as the message instead of using the structured clone algorithm as required by HTML5.

If you're not going to implement this completely in FF4, I think it would be better for compatibility if FF threw an error if the argument was anything other than a string.  Otherwise you run the risk of sites coming to rely on the toString() behavior and failing when the spec is properly implemented.

(This bug is probably mis-categorized: I put it in "DOM: Mozilla Extensions" only because that is where the only other postMessage() bug report I could find is.)
postMesage on a worker does the structured clone thing.  It's only postMessage on Window objects that ends up doing toString.

Ben, is there a reason we don't do structured cloning for postMessage on windows?  Or does that just predate the structured clone spec changes?
blocking2.0: --- → ?
Component: DOM: Mozilla Extensions → DOM
It just predates. There's probably another bug open.
Ah, indeed.
Status: NEW → RESOLVED
blocking2.0: ? → ---
Closed: 14 years ago
Resolution: --- → DUPLICATE
Sorry for the dup.  I'm very surprised that searching Bugzilla for the string "postMessage" does not match "window.postMessage"!
It did for me once I did the search...  Might depend on the exact search box you're using, though.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.