Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(855)

Unified Diff: Source/core/dom/MessageEvent.h

Issue 17063016: Remove leak of objects between isolated worlds on custom events. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added GC test Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/MessageEvent.h
diff --git a/Source/core/dom/MessageEvent.h b/Source/core/dom/MessageEvent.h
index 5912f8ff0cb9c1bd5cf9e37341c0d7fef00a80d6..2553a3f5790dcc4c30f1adf13c0802e7d21439f8 100644
--- a/Source/core/dom/MessageEvent.h
+++ b/Source/core/dom/MessageEvent.h
@@ -28,7 +28,6 @@
#ifndef MessageEvent_h
#define MessageEvent_h
-#include "bindings/v8/ScriptValue.h"
#include "bindings/v8/SerializedScriptValue.h"
#include "core/dom/Event.h"
#include "core/dom/MessagePort.h"
@@ -43,11 +42,12 @@ class DOMWindow;
struct MessageEventInit : public EventInit {
MessageEventInit();
- ScriptValue data;
String origin;
String lastEventId;
RefPtr<DOMWindow> source;
MessagePortArray ports;
+
+ bool dataIsSet;
};
class MessageEvent : public Event {
@@ -56,9 +56,9 @@ public:
{
return adoptRef(new MessageEvent);
}
- static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, const ScriptValue& data = ScriptValue(), const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0)
+ static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0)
{
- return adoptRef(new MessageEvent(data, origin, lastEventId, source, ports));
+ return adoptRef(new MessageEvent(origin, lastEventId, source, ports));
}
static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data, const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0)
{
@@ -82,7 +82,7 @@ public:
}
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, 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; }
@@ -100,16 +100,17 @@ public:
DataTypeArrayBuffer
};
DataType dataType() const { return m_dataType; }
- const ScriptValue& dataAsScriptValue() const { ASSERT(m_dataType == DataTypeScriptValue); return m_dataAsScriptValue; }
PassRefPtr<SerializedScriptValue> dataAsSerializedScriptValue() const { ASSERT(m_dataType == DataTypeSerializedScriptValue); return m_dataAsSerializedScriptValue; }
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(); }
+ bool isDataSet() const { return m_dataIsSet; }
+
private:
MessageEvent();
MessageEvent(const AtomicString&, const MessageEventInit&);
- MessageEvent(const ScriptValue& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>);
+ MessageEvent(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, const String& origin);
@@ -117,7 +118,6 @@ private:
explicit MessageEvent(PassRefPtr<ArrayBuffer> data, const String& origin);
DataType m_dataType;
- ScriptValue m_dataAsScriptValue;
RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue;
String m_dataAsString;
RefPtr<Blob> m_dataAsBlob;
@@ -126,6 +126,8 @@ private:
String m_lastEventId;
RefPtr<DOMWindow> m_source;
OwnPtr<MessagePortArray> m_ports;
+
+ bool m_dataIsSet;
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698