Changeset 96179 in webkit
- Timestamp:
- Sep 27, 2011 7:02:18 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r96177 r96179 1 2011-09-27 Kentaro Hara <haraken@chromium.org> 2 3 Implement a MessageEvent constructor for JSC 4 https://bugs.webkit.org/show_bug.cgi?id=68883 5 6 Reviewed by Adam Barth. 7 8 message-event-constructor.html checks the behavior of the MessageEvent constructor. 9 10 * fast/dom/constructed-objects-prototypes-expected.txt: Now window has MessageEvent. 11 * fast/events/constructors/message-event-constructor-expected.txt: Added. 12 * fast/events/constructors/message-event-constructor.html: Added. 13 * platform/chromium/test_expectations.txt: Skipped message-event-constructor.html, since V8 does not yet have the MessageEvent constructor. 14 1 15 2011-09-27 Eric Uhrhane <ericu@chromium.org> 2 16 -
trunk/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt
r95931 r96179 24 24 PASS (new inner.MessageChannel()).isInner is true 25 25 PASS (new inner.MessageChannel()).constructor.isInner is true 26 PASS (new inner.MessageEvent()).isInner is true 27 PASS (new inner.MessageEvent()).constructor.isInner is true 26 28 PASS (new inner.Option()).isInner is true 27 29 PASS (new inner.Option()).constructor.isInner is true -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r96158 r96179 81 81 BUGWK60877 SKIP : loader/navigation-while-deferring-loads.html = FAIL 82 82 BUGWK60877 SKIP : loader/load-defer-resume-crash.html = FAIL 83 84 // This will soon be fixed after implementing a MessageEvent constructor for V8. 85 BUGWK68883 : fast/events/constructors/message-event-constructor.html = FAIL 83 86 84 87 // CSS3 Selectors3 test suite -
trunk/Source/WebCore/ChangeLog
r96177 r96179 1 2011-09-27 Kentaro Hara <haraken@chromium.org> 2 3 Implement a MessageEvent constructor for JSC 4 https://bugs.webkit.org/show_bug.cgi?id=68883 5 6 Reviewed by Adam Barth. 7 8 The spec for MessageEvent is here: 9 http://www.whatwg.org/specs/web-apps/current-work/#messageevent 10 11 Currently, some tests in fast/events/constructors/message-event-constructor.html 12 are failing or crashing in DRT, as we commented in the test file. 13 This is because MessageEvent.data is implemented as SerializedScriptValue, 14 and thus it cannot keep ScriptValue passed by JavaScript. 15 This is the same issue as the bug (https://bugs.webkit.org/show_bug.cgi?id=68345). 16 We will soon make a follow-up patch to fix these failures, after this 17 patch is landed. 18 19 Test: fast/events/constructors/message-event-constructor.html 20 21 * bindings/generic/EventConstructors.h: Added a definition for the MessageEvent constructor. 22 * bindings/js/JSDictionary.cpp: 23 (WebCore::JSDictionary::convertValue): Generates MessagePortArray from the list of message ports in the format of JSValues. 24 * bindings/js/JSDictionary.h: 25 * bindings/js/JSEventConstructors.cpp: Added #includes for MessageEvent. 26 * dom/MessageEvent.cpp: 27 (WebCore::MessageEventInit::MessageEventInit): 28 (WebCore::MessageEvent::MessageEvent): 29 (WebCore::MessageEvent::initMessageEvent): 30 * dom/MessageEvent.h: Added a definition for MessageEvent. Removed an extra leading spaces. 31 (WebCore::MessageEvent::create): 32 (WebCore::MessageEvent::origin): 33 (WebCore::MessageEvent::lastEventId): 34 (WebCore::MessageEvent::source): 35 (WebCore::MessageEvent::ports): 36 (WebCore::MessageEvent::dataType): 37 (WebCore::MessageEvent::dataAsSerializedScriptValue): 38 (WebCore::MessageEvent::dataAsString): 39 (WebCore::MessageEvent::dataAsBlob): 40 (WebCore::MessageEvent::dataAsArrayBuffer): 41 * dom/MessageEvent.idl: Makes MessageEvent constructible. 42 1 43 2011-09-27 Eric Uhrhane <ericu@chromium.org> 2 44 -
trunk/Source/WebCore/bindings/generic/EventConstructors.h
r95931 r96179 100 100 DICTIONARY_END(CloseEvent) 101 101 102 #define INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_MESSAGE_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \ 103 \ 104 DICTIONARY_START(MessageEvent) \ 105 FILL_PARENT_PROPERTIES(Event) \ 106 FILL_PROPERTY(data) \ 107 FILL_PROPERTY(origin) \ 108 FILL_PROPERTY(lastEventId) \ 109 FILL_PROPERTY(source) \ 110 FILL_PROPERTY(ports) \ 111 DICTIONARY_END(MessageEvent) 112 102 113 103 114 #define INSTANTIATE_ALL_EVENT_INITIALIZING_CONSTRUCTORS(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \ … … 111 122 INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_ERROR_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \ 112 123 INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_CLOSE_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \ 124 INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_MESSAGE_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \ 113 125 114 126 } // namespace WebCore -
trunk/Source/WebCore/bindings/js/JSDictionary.cpp
r95901 r96179 1 2 1 /* 3 2 * Copyright (C) 2011 Apple Inc. All rights reserved. … … 30 29 #include "JSDOMWindow.h" 31 30 #include "JSEventTarget.h" 31 #include "JSMessagePortCustom.h" 32 32 #include "JSNode.h" 33 33 #include "SerializedScriptValue.h" … … 120 120 } 121 121 122 void JSDictionary::convertValue(ExecState* exec, JSValue value, MessagePortArray& result) 123 { 124 fillMessagePortArray(exec, value, result); 125 } 126 122 127 } // namespace WebCore -
trunk/Source/WebCore/bindings/js/JSDictionary.h
r95901 r96179 27 27 #define JSDictionary_h 28 28 29 #include "MessagePort.h" 29 30 #include <interpreter/CallFrame.h> 30 31 #include <wtf/Forward.h> … … 72 73 static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<EventTarget>& result); 73 74 static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<Node>& result); 75 static void convertValue(JSC::ExecState*, JSC::JSValue, MessagePortArray& result); 74 76 75 77 JSC::ExecState* m_exec; -
trunk/Source/WebCore/bindings/js/JSEventConstructors.cpp
r95931 r96179 38 38 #include "JSEvent.h" 39 39 #include "JSHashChangeEvent.h" 40 #include "JSMessageEvent.h" 40 41 #include "JSPageTransitionEvent.h" 41 42 #include "JSPopStateEvent.h" 42 43 #include "JSProgressEvent.h" 43 44 #include "JSWebKitAnimationEvent.h" 45 #include "MessageEvent.h" 44 46 #include "PageTransitionEvent.h" 45 47 #include "PopStateEvent.h" -
trunk/Source/WebCore/dom/MessageEvent.cpp
r94161 r96179 34 34 namespace WebCore { 35 35 36 MessageEventInit::MessageEventInit() 37 : data(SerializedScriptValue::create()) 38 { 39 } 40 36 41 MessageEvent::MessageEvent() 37 42 : m_dataType(DataTypeSerializedScriptValue) 38 43 , m_dataAsSerializedScriptValue(SerializedScriptValue::create()) 44 { 45 } 46 47 MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& initializer) 48 : Event(type, initializer) 49 , m_dataType(DataTypeSerializedScriptValue) 50 , m_dataAsSerializedScriptValue(initializer.data) 51 , m_origin(initializer.origin) 52 , m_lastEventId(initializer.lastEventId) 53 , m_source(initializer.source) 54 , m_ports(adoptPtr(new MessagePortArray(initializer.ports))) 39 55 { 40 56 } … … 86 102 if (dispatched()) 87 103 return; 88 104 89 105 initEvent(type, canBubble, cancelable); 90 106 -
trunk/Source/WebCore/dom/MessageEvent.h
r94161 r96179 38 38 namespace WebCore { 39 39 40 40 class DOMWindow; 41 41 42 class MessageEvent : public Event { 43 public: 44 static PassRefPtr<MessageEvent> create() 45 { 46 return adoptRef(new MessageEvent); 47 } 48 static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data = 0, const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0) 49 { 50 return adoptRef(new MessageEvent(data, origin, lastEventId, source, ports)); 51 } 52 static PassRefPtr<MessageEvent> create(const String& data) 53 { 54 return adoptRef(new MessageEvent(data)); 55 } 56 static PassRefPtr<MessageEvent> create(PassRefPtr<Blob> data) 57 { 58 return adoptRef(new MessageEvent(data)); 59 } 60 static PassRefPtr<MessageEvent> create(PassRefPtr<ArrayBuffer> data) 61 { 62 return adoptRef(new MessageEvent(data)); 63 } 64 virtual ~MessageEvent(); 42 struct MessageEventInit : public EventInit { 43 MessageEventInit(); 65 44 66 void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>); 45 RefPtr<SerializedScriptValue> data; 46 String origin; 47 String lastEventId; 48 RefPtr<DOMWindow> source; 49 MessagePortArray ports; 50 }; 67 51 68 const String& origin() const { return m_origin; } 69 const String& lastEventId() const { return m_lastEventId; } 70 DOMWindow* source() const { return m_source.get(); } 71 MessagePortArray* ports() const { return m_ports.get(); } 52 class MessageEvent : public Event { 53 public: 54 static PassRefPtr<MessageEvent> create() 55 { 56 return adoptRef(new MessageEvent); 57 } 58 static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data = 0, const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0) 59 { 60 return adoptRef(new MessageEvent(data, origin, lastEventId, source, ports)); 61 } 62 static PassRefPtr<MessageEvent> create(const String& data) 63 { 64 return adoptRef(new MessageEvent(data)); 65 } 66 static PassRefPtr<MessageEvent> create(PassRefPtr<Blob> data) 67 { 68 return adoptRef(new MessageEvent(data)); 69 } 70 static PassRefPtr<MessageEvent> create(PassRefPtr<ArrayBuffer> data) 71 { 72 return adoptRef(new MessageEvent(data)); 73 } 74 static PassRefPtr<MessageEvent> create(const AtomicString& type, const MessageEventInit& initializer) 75 { 76 return adoptRef(new MessageEvent(type, initializer)); 77 } 78 virtual ~MessageEvent(); 72 79 73 // FIXME: Remove this when we have custom ObjC binding support. 74 SerializedScriptValue* data() const; 80 void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>); 75 81 76 // FIXME: remove this when we update the ObjC bindings (bug #28774).77 MessagePort* messagePort();78 // FIXME: remove this when we update the ObjC bindings (bug #28774).79 void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort*);82 const String& origin() const { return m_origin; } 83 const String& lastEventId() const { return m_lastEventId; } 84 DOMWindow* source() const { return m_source.get(); } 85 MessagePortArray* ports() const { return m_ports.get(); } 80 86 81 virtual bool isMessageEvent() const; 87 // FIXME: Remove this when we have custom ObjC binding support. 88 SerializedScriptValue* data() const; 82 89 83 enum DataType { 84 DataTypeSerializedScriptValue, 85 DataTypeString, 86 DataTypeBlob, 87 DataTypeArrayBuffer 88 }; 89 DataType dataType() const { return m_dataType; } 90 SerializedScriptValue* dataAsSerializedScriptValue() const { return m_dataAsSerializedScriptValue.get(); } 91 String dataAsString() const { return m_dataAsString; } 92 Blob* dataAsBlob() const { return m_dataAsBlob.get(); } 93 ArrayBuffer* dataAsArrayBuffer() const { return m_dataAsArrayBuffer.get(); } 90 // FIXME: remove this when we update the ObjC bindings (bug #28774). 91 MessagePort* messagePort(); 92 // FIXME: remove this when we update the ObjC bindings (bug #28774). 93 void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort*); 94 94 95 private: 96 MessageEvent(); 97 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>); 98 explicit MessageEvent(const String& data); 99 explicit MessageEvent(PassRefPtr<Blob> data); 100 explicit MessageEvent(PassRefPtr<ArrayBuffer> data); 95 virtual bool isMessageEvent() const; 101 96 102 DataType m_dataType; 103 RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue; 104 String m_dataAsString; 105 RefPtr<Blob> m_dataAsBlob; 106 RefPtr<ArrayBuffer> m_dataAsArrayBuffer; 107 String m_origin; 108 String m_lastEventId; 109 RefPtr<DOMWindow> m_source; 110 OwnPtr<MessagePortArray> m_ports; 97 enum DataType { 98 DataTypeSerializedScriptValue, 99 DataTypeString, 100 DataTypeBlob, 101 DataTypeArrayBuffer 111 102 }; 103 DataType dataType() const { return m_dataType; } 104 SerializedScriptValue* dataAsSerializedScriptValue() const { return m_dataAsSerializedScriptValue.get(); } 105 String dataAsString() const { return m_dataAsString; } 106 Blob* dataAsBlob() const { return m_dataAsBlob.get(); } 107 ArrayBuffer* dataAsArrayBuffer() const { return m_dataAsArrayBuffer.get(); } 108 109 private: 110 MessageEvent(); 111 MessageEvent(const AtomicString&, const MessageEventInit&); 112 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>); 113 114 explicit MessageEvent(const String& data); 115 explicit MessageEvent(PassRefPtr<Blob> data); 116 explicit MessageEvent(PassRefPtr<ArrayBuffer> data); 117 118 DataType m_dataType; 119 RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue; 120 String m_dataAsString; 121 RefPtr<Blob> m_dataAsBlob; 122 RefPtr<ArrayBuffer> m_dataAsArrayBuffer; 123 String m_origin; 124 String m_lastEventId; 125 RefPtr<DOMWindow> m_source; 126 OwnPtr<MessagePortArray> m_ports; 127 }; 112 128 113 129 } // namespace WebCore -
trunk/Source/WebCore/dom/MessageEvent.idl
r95362 r96179 29 29 30 30 interface [ 31 NoStaticTables 31 NoStaticTables, 32 CanBeConstructed, 33 CustomConstructFunction 32 34 ] MessageEvent : Event { 33 35 readonly attribute DOMString origin;
Note: See TracChangeset
for help on using the changeset viewer.