Changeset 97725 in webkit
- Timestamp:
- Oct 18, 2011 12:20:17 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r97721 r97725 1 2011-10-18 Kentaro Hara <haraken@chromium.org> 2 3 Unreviewed, rolling out r97697. 4 http://trac.webkit.org/changeset/97697 5 https://bugs.webkit.org/show_bug.cgi?id=68978 6 7 some tests are broken 8 9 * fast/events/constructors/message-event-constructor-expected.txt: 10 * fast/events/constructors/message-event-constructor.html: 11 1 12 2011-10-17 Sheriff Bot <webkit.review.bot@gmail.com> 2 13 -
trunk/LayoutTests/fast/events/constructors/message-event-constructor-expected.txt
r97697 r97725 15 15 PASS new MessageEvent('eventType', { cancelable: false }).cancelable is false 16 16 PASS new MessageEvent('eventType', { cancelable: true }).cancelable is true 17 PASS new MessageEvent('eventType', { data: test_object }).data is test_object 18 PASS new MessageEvent('eventType', { data: document }).data is document 17 FAIL new MessageEvent('eventType', { data: test_object }).data should be [object Object]. Was [object Object]. 19 18 PASS new MessageEvent('eventType', { data: undefined }).data is undefined 20 19 PASS new MessageEvent('eventType', { data: null }).data is null … … 96 95 PASS new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel.port2] }).bubbles is true 97 96 PASS new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel.port2] }).cancelable is true 98 PASS new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel.port2] }).data is test_object 97 FAIL new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel.port2] }).data should be [object Object]. Was [object Object]. 99 98 PASS new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel.port2] }).origin is "wonderful" 100 99 PASS new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel.port2] }).lastEventId is "excellent" -
trunk/LayoutTests/fast/events/constructors/message-event-constructor.html
r97697 r97725 30 30 31 31 // data is passed. 32 // FIXME(haraken): This fails because MessageEvent.data cannot handle ScriptValue. 32 33 shouldBe("new MessageEvent('eventType', { data: test_object }).data", "test_object"); 33 shouldBe("new MessageEvent('eventType', { data: document }).data", "document"); 34 // FIXME(haraken): When we pass a DOM object, it crashes in DRT (it returns TypeError in non-DRT build). 35 // shouldBe("new MessageEvent('eventType', { data: document }).data", "document"); 34 36 shouldBe("new MessageEvent('eventType', { data: undefined }).data", "undefined"); 35 37 shouldBe("new MessageEvent('eventType', { data: null }).data", "null"); … … 119 121 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel.port2] }).bubbles", "true"); 120 122 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel.port2] }).cancelable", "true"); 123 // FIXME(haraken): This fails because MessageEvent.data cannot handle ScriptValue. 121 124 shouldBe("new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel.port2] }).data", "test_object"); 122 125 shouldBeEqualToString("new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel.port2] }).origin", "wonderful"); -
trunk/Source/WebCore/ChangeLog
r97724 r97725 1 2011-10-18 Kentaro Hara <haraken@chromium.org> 2 3 Unreviewed, rolling out r97697. 4 http://trac.webkit.org/changeset/97697 5 https://bugs.webkit.org/show_bug.cgi?id=68978 6 7 some tests are broken 8 9 * bindings/js/JSMessageEventCustom.cpp: 10 (WebCore::JSMessageEvent::data): 11 * bindings/v8/custom/V8MessageEventCustom.cpp: 12 (WebCore::V8MessageEvent::dataAccessorGetter): 13 (WebCore::V8MessageEvent::portsAccessorGetter): 14 (WebCore::V8MessageEvent::initMessageEventCallback): 15 * dom/MessageEvent.cpp: 16 (WebCore::MessageEventInit::MessageEventInit): 17 (WebCore::MessageEvent::MessageEvent): 18 (WebCore::MessageEvent::isMessageEvent): 19 * dom/MessageEvent.h: 20 (WebCore::MessageEvent::create): 21 (WebCore::MessageEvent::dataAsSerializedScriptValue): 22 (WebCore::MessageEvent::dataAsString): 23 (WebCore::MessageEvent::dataAsBlob): 24 (WebCore::MessageEvent::dataAsArrayBuffer): 25 * dom/MessageEvent.idl: 26 1 27 2011-10-17 Antti Koivisto <antti@apple.com> 2 28 -
trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp
r97697 r97725 53 53 JSValue result; 54 54 switch (event->dataType()) { 55 case MessageEvent::DataTypeScriptValue: {56 ScriptValue scriptValue = event->dataAsScriptValue();57 if (scriptValue.hasNoValue())58 result = jsNull();59 else60 result = scriptValue.jsValue();61 break;62 }63 64 55 case MessageEvent::DataTypeSerializedScriptValue: 65 56 if (SerializedScriptValue* serializedValue = event->dataAsSerializedScriptValue()) { -
trunk/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
r97697 r97725 52 52 v8::Handle<v8::Value> result; 53 53 switch (event->dataType()) { 54 case MessageEvent::DataTypeScriptValue: {55 ScriptValue scriptValue = event->dataAsScriptValue();56 if (scriptValue.hasNoValue())57 result = v8::Null();58 else59 result = scriptValue.v8Value();60 break;61 }62 63 54 case MessageEvent::DataTypeSerializedScriptValue: 64 55 if (SerializedScriptValue* serializedValue = event->dataAsSerializedScriptValue()) … … 98 89 if (!ports) 99 90 return v8::Array::New(0); 100 91 101 92 MessagePortArray portsCopy(*ports); 102 93 … … 115 106 bool canBubbleArg = args[1]->BooleanValue(); 116 107 bool cancelableArg = args[2]->BooleanValue(); 117 ScriptValue dataArg = ScriptValue(args[3]);108 RefPtr<SerializedScriptValue> dataArg = SerializedScriptValue::create(args[3]); 118 109 String originArg = v8ValueToWebCoreString(args[4]); 119 110 String lastEventIdArg = v8ValueToWebCoreString(args[5]); … … 133 124 return v8::Undefined(); 134 125 } 135 event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, dataArg , originArg, lastEventIdArg, sourceArg, portArray.release());126 event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, dataArg.release(), originArg, lastEventIdArg, sourceArg, portArray.release()); 136 127 v8::PropertyAttribute dataAttr = static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly); 137 128 SerializedScriptValue::deserializeAndSetProperty(args.Holder(), "data", dataAttr, event->dataAsSerializedScriptValue()); -
trunk/Source/WebCore/dom/MessageEvent.cpp
r97697 r97725 35 35 36 36 MessageEventInit::MessageEventInit() 37 : data(SerializedScriptValue::create()) 37 38 { 38 39 } 39 40 40 41 MessageEvent::MessageEvent() 41 : m_dataType(DataTypeScriptValue) 42 : m_dataType(DataTypeSerializedScriptValue) 43 , m_dataAsSerializedScriptValue(SerializedScriptValue::create()) 42 44 { 43 45 } … … 45 47 MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& initializer) 46 48 : Event(type, initializer) 47 , m_dataType(DataTypeS criptValue)48 , m_dataAsS criptValue(initializer.data)49 , m_dataType(DataTypeSerializedScriptValue) 50 , m_dataAsSerializedScriptValue(initializer.data) 49 51 , m_origin(initializer.origin) 50 52 , m_lastEventId(initializer.lastEventId) 51 53 , m_source(initializer.source) 52 54 , m_ports(adoptPtr(new MessagePortArray(initializer.ports))) 53 {54 }55 56 MessageEvent::MessageEvent(const ScriptValue& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray> ports)57 : Event(eventNames().messageEvent, false, false)58 , m_dataType(DataTypeScriptValue)59 , m_dataAsScriptValue(data)60 , m_origin(origin)61 , m_lastEventId(lastEventId)62 , m_source(source)63 , m_ports(ports)64 55 { 65 56 } … … 107 98 } 108 99 109 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const ScriptValue& data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports)110 {111 if (dispatched())112 return;113 114 initEvent(type, canBubble, cancelable);115 116 m_dataType = DataTypeScriptValue;117 m_dataAsScriptValue = data;118 m_origin = origin;119 m_lastEventId = lastEventId;120 m_source = source;121 m_ports = ports;122 }123 124 100 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports) 125 101 { … … 154 130 } 155 131 156 // FIXME: remove this when we update the ObjC bindings (bug #28774).157 132 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort* port) 158 133 { … … 165 140 } 166 141 167 bool MessageEvent::isMessageEvent() const 142 bool MessageEvent::isMessageEvent() const 168 143 { 169 144 return true; -
trunk/Source/WebCore/dom/MessageEvent.h
r97697 r97725 34 34 #include "Event.h" 35 35 #include "MessagePort.h" 36 #include "ScriptValue.h"37 36 #include "SerializedScriptValue.h" 38 37 … … 44 43 MessageEventInit(); 45 44 46 ScriptValuedata;45 RefPtr<SerializedScriptValue> data; 47 46 String origin; 48 47 String lastEventId; … … 57 56 return adoptRef(new MessageEvent); 58 57 } 59 static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, const ScriptValue& data = ScriptValue(), const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0) 60 { 61 return adoptRef(new MessageEvent(data, origin, lastEventId, source, ports)); 62 } 63 static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data, const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0) 58 static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data = 0, const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0) 64 59 { 65 60 return adoptRef(new MessageEvent(data, origin, lastEventId, source, ports)); … … 83 78 virtual ~MessageEvent(); 84 79 85 void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const ScriptValue& data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>);86 80 void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>); 87 81 … … 93 87 // FIXME: Remove this when we have custom ObjC binding support. 94 88 SerializedScriptValue* data() const; 89 95 90 // FIXME: remove this when we update the ObjC bindings (bug #28774). 96 91 MessagePort* messagePort(); … … 101 96 102 97 enum DataType { 103 DataTypeScriptValue,104 98 DataTypeSerializedScriptValue, 105 99 DataTypeString, … … 108 102 }; 109 103 DataType dataType() const { return m_dataType; } 110 ScriptValue dataAsScriptValue() const { ASSERT(m_dataType == DataTypeScriptValue); return m_dataAsScriptValue; } 111 SerializedScriptValue* dataAsSerializedScriptValue() const { ASSERT(m_dataType == DataTypeSerializedScriptValue); return m_dataAsSerializedScriptValue.get(); } 112 String dataAsString() const { ASSERT(m_dataType == DataTypeString); return m_dataAsString; } 113 Blob* dataAsBlob() const { ASSERT(m_dataType == DataTypeBlob); return m_dataAsBlob.get(); } 114 ArrayBuffer* dataAsArrayBuffer() const { ASSERT(m_dataType == DataTypeArrayBuffer); return m_dataAsArrayBuffer.get(); } 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(); } 115 108 116 109 private: 117 110 MessageEvent(); 118 111 MessageEvent(const AtomicString&, const MessageEventInit&); 119 MessageEvent(const ScriptValue& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>);120 112 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>); 121 113 … … 125 117 126 118 DataType m_dataType; 127 ScriptValue m_dataAsScriptValue;128 119 RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue; 129 120 String m_dataAsString; -
trunk/Source/WebCore/dom/MessageEvent.idl
r97697 r97725 37 37 readonly attribute DOMWindow source; 38 38 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT 39 readonly attribute [CachedAttribute, CustomGetter] DOMObjectdata;39 readonly attribute [CachedAttribute, CustomGetter] any data; 40 40 readonly attribute [CustomGetter] Array ports; 41 41 … … 43 43 in [Optional=CallWithDefaultValue] boolean canBubbleArg, 44 44 in [Optional=CallWithDefaultValue] boolean cancelableArg, 45 in [Optional=CallWithDefaultValue] DOMObjectdataArg,45 in [Optional=CallWithDefaultValue] SerializedScriptValue dataArg, 46 46 in [Optional=CallWithDefaultValue] DOMString originArg, 47 47 in [Optional=CallWithDefaultValue] DOMString lastEventIdArg, … … 52 52 in [Optional=CallWithDefaultValue] boolean canBubbleArg, 53 53 in [Optional=CallWithDefaultValue] boolean cancelableArg, 54 in [Optional=CallWithDefaultValue] DOMObjectdataArg,54 in [Optional=CallWithDefaultValue] SerializedScriptValue dataArg, 55 55 in [Optional=CallWithDefaultValue] DOMString originArg, 56 56 in [Optional=CallWithDefaultValue] DOMString lastEventIdArg,
Note: See TracChangeset
for help on using the changeset viewer.