Implement a MessageEvent constructor for JSC
https://bugs.webkit.org/show_bug.cgi?id=68883
Patch by Kentaro Hara <haraken@chromium.org> on 2011-09-27
Reviewed by Adam Barth.
Source/WebCore:
The spec for MessageEvent is here:
http://www.whatwg.org/specs/web-apps/current-work/#messageevent
Currently, some tests in fast/events/constructors/message-event-constructor.html
are failing or crashing in DRT, as we commented in the test file.
This is because MessageEvent.data is implemented as SerializedScriptValue,
and thus it cannot keep ScriptValue passed by JavaScript.
This is the same issue as the bug (https://bugs.webkit.org/show_bug.cgi?id=68345).
We will soon make a follow-up patch to fix these failures, after this
patch is landed.
Test: fast/events/constructors/message-event-constructor.html
* bindings/generic/EventConstructors.h: Added a definition for the MessageEvent constructor.
* bindings/js/JSDictionary.cpp:
(WebCore::JSDictionary::convertValue): Generates MessagePortArray from the list of message ports in the format of JSValues.
* bindings/js/JSDictionary.h:
* bindings/js/JSEventConstructors.cpp: Added #includes for MessageEvent.
* dom/MessageEvent.cpp:
(WebCore::MessageEventInit::MessageEventInit):
(WebCore::MessageEvent::MessageEvent):
(WebCore::MessageEvent::initMessageEvent):
* dom/MessageEvent.h: Added a definition for MessageEvent. Removed an extra leading spaces.
(WebCore::MessageEvent::create):
(WebCore::MessageEvent::origin):
(WebCore::MessageEvent::lastEventId):
(WebCore::MessageEvent::source):
(WebCore::MessageEvent::ports):
(WebCore::MessageEvent::dataType):
(WebCore::MessageEvent::dataAsSerializedScriptValue):
(WebCore::MessageEvent::dataAsString):
(WebCore::MessageEvent::dataAsBlob):
(WebCore::MessageEvent::dataAsArrayBuffer):
* dom/MessageEvent.idl: Makes MessageEvent constructible.
LayoutTests:
message-event-constructor.html checks the behavior of the MessageEvent constructor.
* fast/dom/constructed-objects-prototypes-expected.txt: Now window has MessageEvent.
* fast/events/constructors/message-event-constructor-expected.txt: Added.
* fast/events/constructors/message-event-constructor.html: Added.
* platform/chromium/test_expectations.txt: Skipped message-event-constructor.html, since V8 does not yet have the MessageEvent constructor.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96179
268f45cc-cd09-0410-ab3c-
d52691b4dbfc