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

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

Issue 150203016: Add cross-origin BindingsSecurity checks to 'EventTarget::dispatchEvent'. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Doctype + rebaseline. 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
diff --git a/Source/bindings/scripts/code_generator_v8.pm b/Source/bindings/scripts/code_generator_v8.pm
index 1207addbfb84546e62149957d31408972b2356ce..697cdff44c0ed7252dfb820d64d8273ae8826e2b 100644
--- a/Source/bindings/scripts/code_generator_v8.pm
+++ b/Source/bindings/scripts/code_generator_v8.pm
@@ -2468,6 +2468,7 @@ sub GenerateFunction
# - takes a parameter that might raise an exception on conversion.
#
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);
@@ -2478,11 +2479,7 @@ sub GenerateFunction
$code .= " ExceptionState exceptionState(ExceptionState::ExecutionContext, \"${unoverloadedName}\", \"${interfaceName}\", info.Holder(), info.GetIsolate());\n";
}
- if ($isEventListener) {
- my $lookupType = ($name eq "addEventListener") ? "OrCreate" : "Only";
- my $passRefPtrHandling = ($name eq "addEventListener") ? "" : ".get()";
- my $hiddenValueAction = ($name eq "addEventListener") ? "addHiddenValueToArray" : "removeHiddenValueFromArray";
-
+ if ($isEventListener || $isEventDispatcher) {
AddToImplIncludes("bindings/v8/BindingSecurity.h");
AddToImplIncludes("bindings/v8/V8EventListenerList.h");
AddToImplIncludes("core/frame/DOMWindow.h");
@@ -2496,6 +2493,14 @@ sub GenerateFunction
if (!window->document())
return;
}
+END
+ }
+ if ($isEventListener) {
+ my $lookupType = ($name eq "addEventListener") ? "OrCreate" : "Only";
+ my $passRefPtrHandling = ($name eq "addEventListener") ? "" : ".get()";
+ my $hiddenValueAction = ($name eq "addEventListener") ? "addHiddenValueToArray" : "removeHiddenValueFromArray";
+
+ $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