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

Side by Side Diff: Source/bindings/scripts/deprecated_code_generator_v8.pm

Issue 22687002: Treat non-callable input as null for EventHandler attributes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nit Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
5 # Copyright (C) 2006 Apple Computer, Inc. 5 # Copyright (C) 2006 Apple Computer, Inc.
6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc.
7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved.
9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 # Copyright (C) 2012 Ericsson AB. All rights reserved. 10 # Copyright (C) 2012 Ericsson AB. All rights reserved.
(...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 my $useExceptions = 1 if $attribute->extendedAttributes->{"SetterRaisesExcep tion"} || $attribute->extendedAttributes->{"RaisesException"}; 1845 my $useExceptions = 1 if $attribute->extendedAttributes->{"SetterRaisesExcep tion"} || $attribute->extendedAttributes->{"RaisesException"};
1846 1846
1847 if ($useExceptions) { 1847 if ($useExceptions) {
1848 AddToImplIncludes("bindings/v8/ExceptionState.h"); 1848 AddToImplIncludes("bindings/v8/ExceptionState.h");
1849 $code .= " ExceptionState es(info.GetIsolate());\n"; 1849 $code .= " ExceptionState es(info.GetIsolate());\n";
1850 } 1850 }
1851 1851
1852 if ($attribute->type eq "EventHandler") { 1852 if ($attribute->type eq "EventHandler") {
1853 my $implSetterFunctionName = FirstLetterToUpperCase($attrName); 1853 my $implSetterFunctionName = FirstLetterToUpperCase($attrName);
1854 AddToImplIncludes("bindings/v8/V8AbstractEventListener.h"); 1854 AddToImplIncludes("bindings/v8/V8AbstractEventListener.h");
1855 # Non callable input should be treated as null
1856 $code .= " if (!value->IsNull() && !value->IsFunction())\n";
1857 $code .= " value = v8::Null(info.GetIsolate());\n";
1855 if (!InheritsInterface($interface, "Node")) { 1858 if (!InheritsInterface($interface, "Node")) {
1856 my $attrImplName = GetImplName($attribute); 1859 my $attrImplName = GetImplName($attribute);
1857 $code .= " transferHiddenDependency(info.Holder(), imp->${attrImp lName}(isolatedWorldForIsolate(info.GetIsolate())), value, ${v8ClassName}::event ListenerCacheIndex, info.GetIsolate());\n"; 1860 $code .= " transferHiddenDependency(info.Holder(), imp->${attrImp lName}(isolatedWorldForIsolate(info.GetIsolate())), value, ${v8ClassName}::event ListenerCacheIndex, info.GetIsolate());\n";
1858 } 1861 }
1859 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); 1862 AddToImplIncludes("bindings/v8/V8EventListenerList.h");
1860 if (($interfaceName eq "Window" or $interfaceName eq "WorkerGlobalScope" ) and $attribute->name eq "onerror") { 1863 if (($interfaceName eq "Window" or $interfaceName eq "WorkerGlobalScope" ) and $attribute->name eq "onerror") {
1861 AddToImplIncludes("bindings/v8/V8ErrorHandler.h"); 1864 AddToImplIncludes("bindings/v8/V8ErrorHandler.h");
1862 $code .= " imp->set$implSetterFunctionName(V8EventListenerList::f indOrCreateWrapper<V8ErrorHandler>(value, true), isolatedWorldForIsolate(info.Ge tIsolate()));\n"; 1865 $code .= " imp->set$implSetterFunctionName(V8EventListenerList::f indOrCreateWrapper<V8ErrorHandler>(value, true), isolatedWorldForIsolate(info.Ge tIsolate()));\n";
1863 } else { 1866 } else {
1864 $code .= " imp->set$implSetterFunctionName(V8EventListenerList::g etEventListener(value, true, ListenerFindOrCreate), isolatedWorldForIsolate(info .GetIsolate()));\n"; 1867 $code .= " imp->set$implSetterFunctionName(V8EventListenerList::g etEventListener(value, true, ListenerFindOrCreate), isolatedWorldForIsolate(info .GetIsolate()));\n";
(...skipping 4151 matching lines...) Expand 10 before | Expand all | Expand 10 after
6016 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { 6019 if ($currentInterface->extendedAttributes->{$extendedAttribute}) {
6017 $found = 1; 6020 $found = 1;
6018 } 6021 }
6019 return 1 if $found; 6022 return 1 if $found;
6020 }, 0); 6023 }, 0);
6021 6024
6022 return $found; 6025 return $found;
6023 } 6026 }
6024 6027
6025 1; 6028 1;
OLDNEW
« no previous file with comments | « LayoutTests/fast/html/eventhandler-attribute-non-callable-expected.txt ('k') | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698