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

Unified Diff: Source/bindings/v8/custom/V8CustomEventCustom.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/V8CustomEventCustom.cpp
diff --git a/Source/bindings/v8/custom/V8CustomEventCustom.cpp b/Source/bindings/v8/custom/V8CustomEventCustom.cpp
index ff0f9b355c75a404d34f7125047a40ec5070b14d..53cda603055f29922d3fa50bf5c7f8893bf18b0a 100644
--- a/Source/bindings/v8/custom/V8CustomEventCustom.cpp
+++ b/Source/bindings/v8/custom/V8CustomEventCustom.cpp
@@ -48,6 +48,7 @@ namespace WebCore {
void V8CustomEvent::detailAttrGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
CustomEvent* imp = V8CustomEvent::toNative(info.Holder());
+ ASSERT(!imp->serializedScriptValue().get());
RefPtr<SerializedScriptValue> serialized = imp->serializedScriptValue();
if (serialized) {
v8::Handle<v8::Value> value = info.Holder()->GetHiddenValue(V8HiddenPropertyName::detail());
@@ -58,7 +59,19 @@ void V8CustomEvent::detailAttrGetterCustom(v8::Local<v8::String> name, const v8:
v8SetReturnValue(info, value);
return;
}
- v8SetReturnValue(info, imp->detail().v8Value());
+ v8SetReturnValue(info, info.Holder()->GetHiddenValue(V8HiddenPropertyName::detail()));
+}
+
+void V8CustomEvent::initCustomEventMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
+{
+ CustomEvent* event = V8CustomEvent::toNative(args.Holder());
+ String typeArg = toWebCoreString(args[0]);
+ bool canBubbleArg = args[1]->BooleanValue();
+ bool cancelableArg = args[2]->BooleanValue();
+ v8::Handle<v8::Value> detailsArg = args[3];
+
+ args.Holder()->SetHiddenValue(V8HiddenPropertyName::detail(), detailsArg);
+ event->initEvent(typeArg, canBubbleArg, cancelableArg);
}
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698