Diff
Modified: trunk/LayoutTests/ChangeLog (97724 => 97725)
--- trunk/LayoutTests/ChangeLog 2011-10-18 06:39:31 UTC (rev 97724)
+++ trunk/LayoutTests/ChangeLog 2011-10-18 07:20:17 UTC (rev 97725)
@@ -1,3 +1,14 @@
+2011-10-18 Kentaro Hara <[email protected]>
+
+ Unreviewed, rolling out r97697.
+ http://trac.webkit.org/changeset/97697
+ https://bugs.webkit.org/show_bug.cgi?id=68978
+
+ some tests are broken
+
+ * fast/events/constructors/message-event-constructor-expected.txt:
+ * fast/events/constructors/message-event-constructor.html:
+
2011-10-17 Sheriff Bot <[email protected]>
Unreviewed, rolling out r97669.
Modified: trunk/LayoutTests/fast/events/constructors/message-event-constructor-expected.txt (97724 => 97725)
--- trunk/LayoutTests/fast/events/constructors/message-event-constructor-expected.txt 2011-10-18 06:39:31 UTC (rev 97724)
+++ trunk/LayoutTests/fast/events/constructors/message-event-constructor-expected.txt 2011-10-18 07:20:17 UTC (rev 97725)
@@ -14,8 +14,7 @@
PASS new MessageEvent('eventType', { bubbles: true }).bubbles is true
PASS new MessageEvent('eventType', { cancelable: false }).cancelable is false
PASS new MessageEvent('eventType', { cancelable: true }).cancelable is true
-PASS new MessageEvent('eventType', { data: test_object }).data is test_object
-PASS new MessageEvent('eventType', { data: document }).data is document
+FAIL new MessageEvent('eventType', { data: test_object }).data should be [object Object]. Was [object Object].
PASS new MessageEvent('eventType', { data: undefined }).data is undefined
PASS new MessageEvent('eventType', { data: null }).data is null
PASS new MessageEvent('eventType', { data: false }).data is false
@@ -95,7 +94,7 @@
PASS new MessageEvent('eventType', { ports: {valueOf: function () { return [channel.port1, channel.port2, channel.port2]; } } }).ports[0] threw exception TypeError: Type error.
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
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
-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
+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].
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"
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"
PASS new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel.port2] }).source is window
Modified: trunk/LayoutTests/fast/events/constructors/message-event-constructor.html (97724 => 97725)
--- trunk/LayoutTests/fast/events/constructors/message-event-constructor.html 2011-10-18 06:39:31 UTC (rev 97724)
+++ trunk/LayoutTests/fast/events/constructors/message-event-constructor.html 2011-10-18 07:20:17 UTC (rev 97725)
@@ -29,8 +29,10 @@
shouldBe("new MessageEvent('eventType', { cancelable: true }).cancelable", "true");
// data is passed.
+// FIXME(haraken): This fails because MessageEvent.data cannot handle ScriptValue.
shouldBe("new MessageEvent('eventType', { data: test_object }).data", "test_object");
-shouldBe("new MessageEvent('eventType', { data: document }).data", "document");
+// FIXME(haraken): When we pass a DOM object, it crashes in DRT (it returns TypeError in non-DRT build).
+// shouldBe("new MessageEvent('eventType', { data: document }).data", "document");
shouldBe("new MessageEvent('eventType', { data: undefined }).data", "undefined");
shouldBe("new MessageEvent('eventType', { data: null }).data", "null");
shouldBe("new MessageEvent('eventType', { data: false }).data", "false");
@@ -118,6 +120,7 @@
// All initializers are passed.
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");
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");
+// FIXME(haraken): This fails because MessageEvent.data cannot handle ScriptValue.
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");
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");
shouldBeEqualToString("new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel.port2] }).lastEventId", "excellent");
Modified: trunk/Source/WebCore/ChangeLog (97724 => 97725)
--- trunk/Source/WebCore/ChangeLog 2011-10-18 06:39:31 UTC (rev 97724)
+++ trunk/Source/WebCore/ChangeLog 2011-10-18 07:20:17 UTC (rev 97725)
@@ -1,3 +1,29 @@
+2011-10-18 Kentaro Hara <[email protected]>
+
+ Unreviewed, rolling out r97697.
+ http://trac.webkit.org/changeset/97697
+ https://bugs.webkit.org/show_bug.cgi?id=68978
+
+ some tests are broken
+
+ * bindings/js/JSMessageEventCustom.cpp:
+ (WebCore::JSMessageEvent::data):
+ * bindings/v8/custom/V8MessageEventCustom.cpp:
+ (WebCore::V8MessageEvent::dataAccessorGetter):
+ (WebCore::V8MessageEvent::portsAccessorGetter):
+ (WebCore::V8MessageEvent::initMessageEventCallback):
+ * dom/MessageEvent.cpp:
+ (WebCore::MessageEventInit::MessageEventInit):
+ (WebCore::MessageEvent::MessageEvent):
+ (WebCore::MessageEvent::isMessageEvent):
+ * dom/MessageEvent.h:
+ (WebCore::MessageEvent::create):
+ (WebCore::MessageEvent::dataAsSerializedScriptValue):
+ (WebCore::MessageEvent::dataAsString):
+ (WebCore::MessageEvent::dataAsBlob):
+ (WebCore::MessageEvent::dataAsArrayBuffer):
+ * dom/MessageEvent.idl:
+
2011-10-17 Antti Koivisto <[email protected]>
r97638 caused 3 printing crashes
Modified: trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp (97724 => 97725)
--- trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp 2011-10-18 06:39:31 UTC (rev 97724)
+++ trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp 2011-10-18 07:20:17 UTC (rev 97725)
@@ -52,15 +52,6 @@
MessageEvent* event = static_cast<MessageEvent*>(impl());
JSValue result;
switch (event->dataType()) {
- case MessageEvent::DataTypeScriptValue: {
- ScriptValue scriptValue = event->dataAsScriptValue();
- if (scriptValue.hasNoValue())
- result = jsNull();
- else
- result = scriptValue.jsValue();
- break;
- }
-
case MessageEvent::DataTypeSerializedScriptValue:
if (SerializedScriptValue* serializedValue = event->dataAsSerializedScriptValue()) {
MessagePortArray* ports = static_cast<MessageEvent*>(impl())->ports();
Modified: trunk/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp (97724 => 97725)
--- trunk/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp 2011-10-18 06:39:31 UTC (rev 97724)
+++ trunk/Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp 2011-10-18 07:20:17 UTC (rev 97725)
@@ -51,15 +51,6 @@
v8::Handle<v8::Value> result;
switch (event->dataType()) {
- case MessageEvent::DataTypeScriptValue: {
- ScriptValue scriptValue = event->dataAsScriptValue();
- if (scriptValue.hasNoValue())
- result = v8::Null();
- else
- result = scriptValue.v8Value();
- break;
- }
-
case MessageEvent::DataTypeSerializedScriptValue:
if (SerializedScriptValue* serializedValue = event->dataAsSerializedScriptValue())
result = serializedValue->deserialize(event->ports());
@@ -97,7 +88,7 @@
MessagePortArray* ports = event->ports();
if (!ports)
return v8::Array::New(0);
-
+
MessagePortArray portsCopy(*ports);
v8::Local<v8::Array> portArray = v8::Array::New(portsCopy.size());
@@ -114,7 +105,7 @@
String typeArg = v8ValueToWebCoreString(args[0]);
bool canBubbleArg = args[1]->BooleanValue();
bool cancelableArg = args[2]->BooleanValue();
- ScriptValue dataArg = ScriptValue(args[3]);
+ RefPtr<SerializedScriptValue> dataArg = SerializedScriptValue::create(args[3]);
String originArg = v8ValueToWebCoreString(args[4]);
String lastEventIdArg = v8ValueToWebCoreString(args[5]);
@@ -132,7 +123,7 @@
if (!getMessagePortArray(args[7], *portArray))
return v8::Undefined();
}
- event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, dataArg, originArg, lastEventIdArg, sourceArg, portArray.release());
+ event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, dataArg.release(), originArg, lastEventIdArg, sourceArg, portArray.release());
v8::PropertyAttribute dataAttr = static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly);
SerializedScriptValue::deserializeAndSetProperty(args.Holder(), "data", dataAttr, event->dataAsSerializedScriptValue());
return v8::Undefined();
Modified: trunk/Source/WebCore/dom/MessageEvent.cpp (97724 => 97725)
--- trunk/Source/WebCore/dom/MessageEvent.cpp 2011-10-18 06:39:31 UTC (rev 97724)
+++ trunk/Source/WebCore/dom/MessageEvent.cpp 2011-10-18 07:20:17 UTC (rev 97725)
@@ -34,18 +34,20 @@
namespace WebCore {
MessageEventInit::MessageEventInit()
+ : data(SerializedScriptValue::create())
{
}
MessageEvent::MessageEvent()
- : m_dataType(DataTypeScriptValue)
+ : m_dataType(DataTypeSerializedScriptValue)
+ , m_dataAsSerializedScriptValue(SerializedScriptValue::create())
{
}
MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& initializer)
: Event(type, initializer)
- , m_dataType(DataTypeScriptValue)
- , m_dataAsScriptValue(initializer.data)
+ , m_dataType(DataTypeSerializedScriptValue)
+ , m_dataAsSerializedScriptValue(initializer.data)
, m_origin(initializer.origin)
, m_lastEventId(initializer.lastEventId)
, m_source(initializer.source)
@@ -53,17 +55,6 @@
{
}
-MessageEvent::MessageEvent(const ScriptValue& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray> ports)
- : Event(eventNames().messageEvent, false, false)
- , m_dataType(DataTypeScriptValue)
- , m_dataAsScriptValue(data)
- , m_origin(origin)
- , m_lastEventId(lastEventId)
- , m_source(source)
- , m_ports(ports)
-{
-}
-
MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray> ports)
: Event(eventNames().messageEvent, false, false)
, m_dataType(DataTypeSerializedScriptValue)
@@ -106,21 +97,6 @@
{
}
-void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const ScriptValue& data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports)
-{
- if (dispatched())
- return;
-
- initEvent(type, canBubble, cancelable);
-
- m_dataType = DataTypeScriptValue;
- m_dataAsScriptValue = data;
- m_origin = origin;
- m_lastEventId = lastEventId;
- m_source = source;
- m_ports = ports;
-}
-
void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports)
{
if (dispatched())
@@ -153,7 +129,6 @@
return (*m_ports)[0].get();
}
-// FIXME: remove this when we update the ObjC bindings (bug #28774).
void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort* port)
{
OwnPtr<MessagePortArray> ports;
@@ -164,7 +139,7 @@
initMessageEvent(type, canBubble, cancelable, data, origin, lastEventId, source, ports.release());
}
-bool MessageEvent::isMessageEvent() const
+bool MessageEvent::isMessageEvent() const
{
return true;
}
Modified: trunk/Source/WebCore/dom/MessageEvent.h (97724 => 97725)
--- trunk/Source/WebCore/dom/MessageEvent.h 2011-10-18 06:39:31 UTC (rev 97724)
+++ trunk/Source/WebCore/dom/MessageEvent.h 2011-10-18 07:20:17 UTC (rev 97725)
@@ -33,7 +33,6 @@
#include "DOMWindow.h"
#include "Event.h"
#include "MessagePort.h"
-#include "ScriptValue.h"
#include "SerializedScriptValue.h"
namespace WebCore {
@@ -43,7 +42,7 @@
struct MessageEventInit : public EventInit {
MessageEventInit();
- ScriptValue data;
+ RefPtr<SerializedScriptValue> data;
String origin;
String lastEventId;
RefPtr<DOMWindow> source;
@@ -56,14 +55,10 @@
{
return adoptRef(new MessageEvent);
}
- static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, const ScriptValue& data = "" const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0)
+ static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data = "" const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0)
{
return adoptRef(new MessageEvent(data, origin, lastEventId, source, ports));
}
- static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data, const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0)
- {
- return adoptRef(new MessageEvent(data, origin, lastEventId, source, ports));
- }
static PassRefPtr<MessageEvent> create(const String& data)
{
return adoptRef(new MessageEvent(data));
@@ -82,7 +77,6 @@
}
virtual ~MessageEvent();
- void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const ScriptValue& data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>);
void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>);
const String& origin() const { return m_origin; }
@@ -92,6 +86,7 @@
// FIXME: Remove this when we have custom ObjC binding support.
SerializedScriptValue* data() const;
+
// FIXME: remove this when we update the ObjC bindings (bug #28774).
MessagePort* messagePort();
// FIXME: remove this when we update the ObjC bindings (bug #28774).
@@ -100,23 +95,20 @@
virtual bool isMessageEvent() const;
enum DataType {
- DataTypeScriptValue,
DataTypeSerializedScriptValue,
DataTypeString,
DataTypeBlob,
DataTypeArrayBuffer
};
DataType dataType() const { return m_dataType; }
- ScriptValue dataAsScriptValue() const { ASSERT(m_dataType == DataTypeScriptValue); return m_dataAsScriptValue; }
- SerializedScriptValue* dataAsSerializedScriptValue() const { ASSERT(m_dataType == DataTypeSerializedScriptValue); return m_dataAsSerializedScriptValue.get(); }
- String dataAsString() const { ASSERT(m_dataType == DataTypeString); return m_dataAsString; }
- Blob* dataAsBlob() const { ASSERT(m_dataType == DataTypeBlob); return m_dataAsBlob.get(); }
- ArrayBuffer* dataAsArrayBuffer() const { ASSERT(m_dataType == DataTypeArrayBuffer); return m_dataAsArrayBuffer.get(); }
+ SerializedScriptValue* dataAsSerializedScriptValue() const { return m_dataAsSerializedScriptValue.get(); }
+ String dataAsString() const { return m_dataAsString; }
+ Blob* dataAsBlob() const { return m_dataAsBlob.get(); }
+ ArrayBuffer* dataAsArrayBuffer() const { return m_dataAsArrayBuffer.get(); }
private:
MessageEvent();
MessageEvent(const AtomicString&, const MessageEventInit&);
- MessageEvent(const ScriptValue& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>);
MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>);
explicit MessageEvent(const String& data);
@@ -124,7 +116,6 @@
explicit MessageEvent(PassRefPtr<ArrayBuffer> data);
DataType m_dataType;
- ScriptValue m_dataAsScriptValue;
RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue;
String m_dataAsString;
RefPtr<Blob> m_dataAsBlob;
Modified: trunk/Source/WebCore/dom/MessageEvent.idl (97724 => 97725)
--- trunk/Source/WebCore/dom/MessageEvent.idl 2011-10-18 06:39:31 UTC (rev 97724)
+++ trunk/Source/WebCore/dom/MessageEvent.idl 2011-10-18 07:20:17 UTC (rev 97725)
@@ -36,13 +36,13 @@
readonly attribute DOMString lastEventId;
readonly attribute DOMWindow source;
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
- readonly attribute [CachedAttribute, CustomGetter] DOMObject data;
+ readonly attribute [CachedAttribute, CustomGetter] any data;
readonly attribute [CustomGetter] Array ports;
[Custom] void initMessageEvent(in [Optional=CallWithDefaultValue] DOMString typeArg,
in [Optional=CallWithDefaultValue] boolean canBubbleArg,
in [Optional=CallWithDefaultValue] boolean cancelableArg,
- in [Optional=CallWithDefaultValue] DOMObject dataArg,
+ in [Optional=CallWithDefaultValue] SerializedScriptValue dataArg,
in [Optional=CallWithDefaultValue] DOMString originArg,
in [Optional=CallWithDefaultValue] DOMString lastEventIdArg,
in [Optional=CallWithDefaultValue] DOMWindow sourceArg,
@@ -51,7 +51,7 @@
[Custom] void webkitInitMessageEvent(in [Optional=CallWithDefaultValue] DOMString typeArg,
in [Optional=CallWithDefaultValue] boolean canBubbleArg,
in [Optional=CallWithDefaultValue] boolean cancelableArg,
- in [Optional=CallWithDefaultValue] DOMObject dataArg,
+ in [Optional=CallWithDefaultValue] SerializedScriptValue dataArg,
in [Optional=CallWithDefaultValue] DOMString originArg,
in [Optional=CallWithDefaultValue] DOMString lastEventIdArg,
in [Optional=CallWithDefaultValue] DOMWindow sourceArg,