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

Unified Diff: Source/bindings/v8/custom/V8MessageEventCustom.cpp

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: Large set of fixes from adamk and haraken. 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/bindings/v8/custom/V8MessageEventCustom.cpp
diff --git a/Source/bindings/v8/custom/V8MessageEventCustom.cpp b/Source/bindings/v8/custom/V8MessageEventCustom.cpp
index 906ee9bae55de50670ae76e256caf6a34208e839..7a28b7884c2119aea427c12dfaaa90f7d784e3e1 100644
--- a/Source/bindings/v8/custom/V8MessageEventCustom.cpp
+++ b/Source/bindings/v8/custom/V8MessageEventCustom.cpp
@@ -32,6 +32,7 @@
#include "V8MessageEvent.h"
#include "bindings/v8/SerializedScriptValue.h"
+#include "bindings/v8/V8HiddenPropertyName.h"
#include "core/dom/MessageEvent.h"
#include "V8ArrayBuffer.h"
@@ -49,11 +50,7 @@ void V8MessageEvent::dataAttrGetterCustom(v8::Local<v8::String> name, const v8::
v8::Handle<v8::Value> result;
switch (event->dataType()) {
case MessageEvent::DataTypeScriptValue: {
- ScriptValue scriptValue = event->dataAsScriptValue();
- if (scriptValue.hasNoValue())
- result = v8Null(info.GetIsolate());
- else
- result = scriptValue.v8Value();
+ result = info.Holder()->GetHiddenValue(V8HiddenPropertyName::data());
break;
}
@@ -93,7 +90,7 @@ void V8MessageEvent::initMessageEventMethodCustom(const v8::FunctionCallbackInfo
String typeArg = toWebCoreString(args[0]);
bool canBubbleArg = args[1]->BooleanValue();
bool cancelableArg = args[2]->BooleanValue();
- ScriptValue dataArg = ScriptValue(args[3]);
+ v8::Handle<v8::Value> dataArg = args[3];
String originArg = toWebCoreString(args[4]);
String lastEventIdArg = toWebCoreString(args[5]);
@@ -111,7 +108,8 @@ void V8MessageEvent::initMessageEventMethodCustom(const v8::FunctionCallbackInfo
if (!getMessagePortArray(args[7], *portArray, args.GetIsolate()))
return;
}
- event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, dataArg, originArg, lastEventIdArg, sourceArg, portArray.release());
+ args.Holder()->SetHiddenValue(V8HiddenPropertyName::data(), dataArg);
+ event->initMessageEvent(typeArg, canBubbleArg, cancelableArg, originArg, lastEventIdArg, sourceArg, portArray.release());
}
void V8MessageEvent::webkitInitMessageEventMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)

Powered by Google App Engine
This is Rietveld 408576698