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

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

Issue 187313004: Merge 166999 "Add cross-origin BindingsSecurity checks to 'Event..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/1750/
Patch Set: Created 6 years, 10 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
« no previous file with comments | « LayoutTests/http/tests/security/cross-frame-access-dispatchEvent-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/code_generator_v8.pm
===================================================================
--- Source/bindings/scripts/code_generator_v8.pm (revision 168442)
+++ Source/bindings/scripts/code_generator_v8.pm (working copy)
@@ -2362,6 +2362,7 @@
# We throw exceptions using 'ExceptionState' if the function explicitly claims that exceptions
# may be raised, or for event listeners, or for security-checking, and for weird SVG stuff.
my $isEventListener = $name eq "addEventListener" || $name eq "removeEventListener";
+ my $isEventDispatcher = $name eq "dispatchEvent";
my $isSecurityCheckNecessary = $interface->extendedAttributes->{"CheckSecurity"} && !$function->extendedAttributes->{"DoNotCheckSecurity"};
my $raisesExceptions = $function->extendedAttributes->{"RaisesException"};
my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($interfaceName);
@@ -2373,11 +2374,7 @@
$hasExceptionState = 1;
}
- if ($isEventListener) {
- my $lookupType = ($name eq "addEventListener") ? "OrCreate" : "Only";
- my $passRefPtrHandling = ($name eq "addEventListener") ? "" : ".get()";
- my $hiddenDependencyAction = ($name eq "addEventListener") ? "create" : "remove";
-
+ if ($isEventListener || $isEventDispatcher) {
AddToImplIncludes("bindings/v8/BindingSecurity.h");
AddToImplIncludes("bindings/v8/V8EventListenerList.h");
AddToImplIncludes("core/frame/DOMWindow.h");
@@ -2391,6 +2388,14 @@
if (!window->document())
return;
}
+END
+ }
+ if ($isEventListener) {
+ my $lookupType = ($name eq "addEventListener") ? "OrCreate" : "Only";
+ my $passRefPtrHandling = ($name eq "addEventListener") ? "" : ".get()";
+ my $hiddenDependencyAction = ($name eq "addEventListener") ? "create" : "remove";
+
+ $code .= <<END;
RefPtr<EventListener> listener = V8EventListenerList::getEventListener(info[1], false, ListenerFind${lookupType});
if (listener) {
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, eventName, info[0]);
« no previous file with comments | « LayoutTests/http/tests/security/cross-frame-access-dispatchEvent-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698