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

Unified Diff: Source/bindings/scripts/deprecated_code_generator_v8.pm

Issue 18112019: Have Window inherit EventTarget interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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/scripts/deprecated_code_generator_v8.pm
diff --git a/Source/bindings/scripts/deprecated_code_generator_v8.pm b/Source/bindings/scripts/deprecated_code_generator_v8.pm
index e67a0618faecb2372f06cf49d04e3fa6b2146ca0..5ab2224c012ed97f12a06a6106bd36cc9bd9696f 100644
--- a/Source/bindings/scripts/deprecated_code_generator_v8.pm
+++ b/Source/bindings/scripts/deprecated_code_generator_v8.pm
@@ -2174,12 +2174,23 @@ sub GenerateFunction
my $passRefPtrHandling = ($name eq "addEventListener") ? "" : ".get()";
my $hiddenDependencyAction = ($name eq "addEventListener") ? "create" : "remove";
+ AddToImplIncludes("bindings/v8/BindingSecurity.h");
AddToImplIncludes("bindings/v8/V8EventListenerList.h");
+ AddToImplIncludes("core/page/DOMWindow.h");
$code .= <<END;
+ EventTarget* impl = ${v8ClassName}::toNative(args.Holder());
+ if (DOMWindow* window = impl->toDOMWindow()) {
+ if (!BindingSecurity::shouldAllowAccessToFrame(window->frame()))
+ return;
+
+ if (!window->document())
+ return;
+ }
+
RefPtr<EventListener> listener = V8EventListenerList::getEventListener(args[1], false, ListenerFind${lookupType});
if (listener) {
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, stringResource, args[0]);
- ${v8ClassName}::toNative(args.Holder())->${implName}(stringResource, listener${passRefPtrHandling}, args[2]->BooleanValue());
+ impl->${implName}(stringResource, listener${passRefPtrHandling}, args[2]->BooleanValue());
END
if (!InheritsInterface($interface, "Node")) {
$code .= <<END;

Powered by Google App Engine
This is Rietveld 408576698