RESOLVED FIXED 158540
First parameter to MessagePort / DedicatedWorkerGlobalScope.postMessage() should be mandatory
https://bugs.webkit.org/show_bug.cgi?id=158540
Summary First parameter to MessagePort / DedicatedWorkerGlobalScope.postMessage() sho...
Chris Dumez
Reported 2016-06-08 14:12:40 PDT
First parameter to MessagePort / DedicatedWorkerGlobalScope.postMessage() should be mandatory: - https://html.spec.whatwg.org/multipage/comms.html#messageport - https://html.spec.whatwg.org/multipage/workers.html#dedicated-workers-and-the-dedicatedworkerglobalscope-interface Currently, WebKit send a bogus MessageEvent whose data attribute is undefined. This causes a testharness error when running the following W3C test: http://w3c-test.org/workers/interfaces.worker
Attachments
Patch (7.53 KB, patch)
2016-06-08 14:37 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2016-06-08 14:18:42 PDT
Firefox and Chrome already behave this way. Also note that we already throw when calling window.postMessage() without parameter.
Chris Dumez
Comment 2 2016-06-08 14:37:29 PDT
Geoffrey Garen
Comment 3 2016-06-08 14:40:59 PDT
Comment on attachment 280841 [details] Patch r=me
WebKit Commit Bot
Comment 4 2016-06-08 15:13:27 PDT
Comment on attachment 280841 [details] Patch Clearing flags on attachment: 280841 Committed r201835: <http://trac.webkit.org/changeset/201835>
WebKit Commit Bot
Comment 5 2016-06-08 15:13:31 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 6 2016-06-09 20:08:41 PDT
Comment on attachment 280841 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=280841&action=review > Source/WebCore/bindings/js/JSMessagePortCustom.h:54 > + if (UNLIKELY(state.argumentCount() < 1)) > + return state.vm().throwException(&state, createNotEnoughArgumentsError(&state)); What is correct behavior when there is one argument but it is undefined? I’d like to see test coverage for that case.
Note You need to log in before you can comment on or make changes to this bug.