Changeset 97955 in webkit


Ignore:
Timestamp:
Oct 20, 2011 2:57:28 AM (13 years ago)
Author:
haraken@chromium.org
Message:

Implement a MessageEvent constructor for V8
https://bugs.webkit.org/show_bug.cgi?id=70296

Reviewed by Adam Barth.

Source/WebCore:

Test: fast/events/constructors/message-event-constructor.html

  • bindings/v8/OptionsObject.cpp:

(WebCore::OptionsObject::getKeyValue): Returns RefPtr<DOMWindow> corresponding to a given key.
(WebCore::OptionsObject::getKeyValue): Returns MessagePortArray corresponding to a given key.

  • bindings/v8/OptionsObject.h:
  • bindings/v8/custom/V8EventConstructors.cpp: Added a MessageEvent constructor.
  • dom/MessageEvent.idl: Makes MessageEvent constructible for V8.

LayoutTests:

Enabled message-event-constructor.html for chromium,
since now V8 has the MessageEvent constructor.

  • platform/chromium/test_expectations.txt:
  • platform/chromium/fast/events/constructors/message-event-constructor-expected.txt: Added.
Location:
trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r97953 r97955  
     12011-10-20  Kentaro Hara  <haraken@chromium.org>
     2
     3        Implement a MessageEvent constructor for V8
     4        https://bugs.webkit.org/show_bug.cgi?id=70296
     5
     6        Reviewed by Adam Barth.
     7
     8        Enabled message-event-constructor.html for chromium,
     9        since now V8 has the MessageEvent constructor.
     10
     11        * platform/chromium/test_expectations.txt:
     12        * platform/chromium/fast/events/constructors/message-event-constructor-expected.txt: Added.
     13
    1142011-10-20  Philippe Normand  <pnormand@igalia.com>
    215
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r97950 r97955  
    7474BUGWK60877 SKIP : loader/navigation-while-deferring-loads.html = FAIL
    7575BUGWK60877 SKIP : loader/load-defer-resume-crash.html = FAIL
    76 
    77 // This will soon be fixed after implementing a MessageEvent constructor for V8.
    78 BUGWK68883 : fast/events/constructors/message-event-constructor.html = FAIL
    7976
    8077// CSS3 Selectors3 test suite
  • trunk/Source/WebCore/ChangeLog

    r97954 r97955  
     12011-10-20  Kentaro Hara  <haraken@chromium.org>
     2
     3        Implement a MessageEvent constructor for V8
     4        https://bugs.webkit.org/show_bug.cgi?id=70296
     5
     6        Reviewed by Adam Barth.
     7
     8        Test: fast/events/constructors/message-event-constructor.html
     9
     10        * bindings/v8/OptionsObject.cpp:
     11        (WebCore::OptionsObject::getKeyValue): Returns RefPtr<DOMWindow> corresponding to a given key.
     12        (WebCore::OptionsObject::getKeyValue): Returns MessagePortArray corresponding to a given key.
     13        * bindings/v8/OptionsObject.h:
     14        * bindings/v8/custom/V8EventConstructors.cpp: Added a MessageEvent constructor.
     15        * dom/MessageEvent.idl: Makes MessageEvent constructible for V8.
     16
    1172011-10-20  Peter Rybin  <peter.rybin@gmail.com>
    218
  • trunk/Source/WebCore/bindings/v8/OptionsObject.cpp

    r96208 r97955  
    2929#include "DOMStringList.h"
    3030#include "V8Binding.h"
     31#include "V8DOMWindow.h"
     32#include "V8MessagePortCustom.h"
    3133#include <limits>
    3234
     
    224226}
    225227
     228bool OptionsObject::getKeyValue(const String& key, RefPtr<DOMWindow>& value) const
     229{
     230    v8::Local<v8::Value> v8Value;
     231    if (!getKey(key, v8Value))
     232        return false;
     233
     234    DOMWindow* source = 0;
     235    if (v8Value->IsObject()) {
     236        v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value);
     237        v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), wrapper);
     238        if (!window.IsEmpty())
     239            source = V8DOMWindow::toNative(window);
     240    }
     241    value = source;
     242    return true;
     243}
     244
     245bool OptionsObject::getKeyValue(const String& key, MessagePortArray& value) const
     246{
     247    v8::Local<v8::Value> v8Value;
     248    if (!getKey(key, v8Value))
     249        return false;
     250
     251    return getMessagePortArray(v8Value, value);
     252}
     253
    226254} // namespace WebCore
  • trunk/Source/WebCore/bindings/v8/OptionsObject.h

    r96208 r97955  
    2727#define OptionsObject_h
    2828
     29#include "MessagePort.h"
    2930#include "PlatformString.h"
    3031#include "ScriptValue.h"
     
    3435
    3536class DOMStringList;
     37class DOMWindow;
    3638class IDBKeyRange;
    3739
     
    8183    bool getKeyValue(const String&, unsigned&) const;
    8284    bool getKeyValue(const String&, unsigned long long&) const;
     85    bool getKeyValue(const String& key, RefPtr<DOMWindow>& value) const;
     86    bool getKeyValue(const String& key, MessagePortArray& value) const;
    8387
    8488private:
  • trunk/Source/WebCore/bindings/v8/custom/V8EventConstructors.cpp

    r97839 r97955  
    3939#include "ErrorEvent.h"
    4040#include "HashChangeEvent.h"
     41#include "MessageEvent.h"
    4142#include "Node.h"
    4243#include "OverflowEvent.h"
     
    5758#include "V8Event.h"
    5859#include "V8HashChangeEvent.h"
     60#include "V8MessageEvent.h"
    5961#include "V8Node.h"
    6062#include "V8OverflowEvent.h"
     
    130132INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_BEFORE_LOAD_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY)
    131133INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_OVERFLOW_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY)
     134INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_MESSAGE_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY)
    132135
    133136
  • trunk/Source/WebCore/dom/MessageEvent.idl

    r97939 r97955  
    3131        NoStaticTables,
    3232        CanBeConstructed,
    33         JSCustomConstructor
     33        CustomConstructor
    3434    ] MessageEvent : Event {
    3535        readonly attribute DOMString origin;
Note: See TracChangeset for help on using the changeset viewer.