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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 30 matching lines...) Expand all
41 #include "core/dom/ContextFeatures.h" 41 #include "core/dom/ContextFeatures.h"
42 #include "core/dom/ExceptionCode.h" 42 #include "core/dom/ExceptionCode.h"
43 #include "core/page/Frame.h" 43 #include "core/page/Frame.h"
44 #include "RuntimeEnabledFeatures.h" 44 #include "RuntimeEnabledFeatures.h"
45 45
46 namespace WebCore { 46 namespace WebCore {
47 47
48 void V8CustomEvent::detailAttrGetterCustom(v8::Local<v8::String> name, const v8: :PropertyCallbackInfo<v8::Value>& info) 48 void V8CustomEvent::detailAttrGetterCustom(v8::Local<v8::String> name, const v8: :PropertyCallbackInfo<v8::Value>& info)
49 { 49 {
50 CustomEvent* imp = V8CustomEvent::toNative(info.Holder()); 50 CustomEvent* imp = V8CustomEvent::toNative(info.Holder());
51 ASSERT(!imp->serializedScriptValue().get());
51 RefPtr<SerializedScriptValue> serialized = imp->serializedScriptValue(); 52 RefPtr<SerializedScriptValue> serialized = imp->serializedScriptValue();
52 if (serialized) { 53 if (serialized) {
53 v8::Handle<v8::Value> value = info.Holder()->GetHiddenValue(V8HiddenProp ertyName::detail()); 54 v8::Handle<v8::Value> value = info.Holder()->GetHiddenValue(V8HiddenProp ertyName::detail());
54 if (value.IsEmpty()) { 55 if (value.IsEmpty()) {
55 value = serialized->deserialize(); 56 value = serialized->deserialize();
56 info.Holder()->SetHiddenValue(V8HiddenPropertyName::detail(), value) ; 57 info.Holder()->SetHiddenValue(V8HiddenPropertyName::detail(), value) ;
57 } 58 }
58 v8SetReturnValue(info, value); 59 v8SetReturnValue(info, value);
59 return; 60 return;
60 } 61 }
61 v8SetReturnValue(info, imp->detail().v8Value()); 62 v8SetReturnValue(info, info.Holder()->GetHiddenValue(V8HiddenPropertyName::d etail()));
63 }
64
65 void V8CustomEvent::initCustomEventMethodCustom(const v8::FunctionCallbackInfo<v 8::Value>& args)
66 {
67 CustomEvent* event = V8CustomEvent::toNative(args.Holder());
68 String typeArg = toWebCoreString(args[0]);
69 bool canBubbleArg = args[1]->BooleanValue();
70 bool cancelableArg = args[2]->BooleanValue();
71 v8::Handle<v8::Value> detailsArg = args[3];
72
73 args.Holder()->SetHiddenValue(V8HiddenPropertyName::detail(), detailsArg);
74 event->initEvent(typeArg, canBubbleArg, cancelableArg);
62 } 75 }
63 76
64 } // namespace WebCore 77 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698