Implement a MessageEvent constructor for JSC
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Sep 2011 02:02:18 +0000 (02:02 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Sep 2011 02:02:18 +0000 (02:02 +0000)
commitefdbea3b8099ee700f0eff19fceebca935c5766f
treeebc98de9f91d598d9517bf90e743666a1b9679ee
parentfaff028262afc0e757ab8692432195a977811b9f
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: https://svn.webkit.org/repository/webkit/trunk@96179 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt
LayoutTests/fast/events/constructors/message-event-constructor-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/constructors/message-event-constructor.html [new file with mode: 0644]
LayoutTests/platform/chromium/test_expectations.txt
Source/WebCore/ChangeLog
Source/WebCore/bindings/generic/EventConstructors.h
Source/WebCore/bindings/js/JSDictionary.cpp
Source/WebCore/bindings/js/JSDictionary.h
Source/WebCore/bindings/js/JSEventConstructors.cpp
Source/WebCore/dom/MessageEvent.cpp
Source/WebCore/dom/MessageEvent.h
Source/WebCore/dom/MessageEvent.idl