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

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

Issue 144463014: Add [StrictTypeChecking] to the SVGGeometryElement interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 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 2764 matching lines...) Expand 10 before | Expand all | Expand 10 after
2775 if ($hasExceptionState) { 2775 if ($hasExceptionState) {
2776 $parameterCheckString .= " exceptionState.throwTypeEr ror(\"parameter $humanFriendlyIndex (\'\" + string + \"\') is not a valid enum v alue.\");\n"; 2776 $parameterCheckString .= " exceptionState.throwTypeEr ror(\"parameter $humanFriendlyIndex (\'\" + string + \"\') is not a valid enum v alue.\");\n";
2777 $parameterCheckString .= " exceptionState.throwIfNeed ed();\n"; 2777 $parameterCheckString .= " exceptionState.throwIfNeed ed();\n";
2778 } else { 2778 } else {
2779 $parameterCheckString .= " throwTypeError(ExceptionMe ssages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter $huma nFriendlyIndex (\'\" + string + \"\') is not a valid enum value.\"), info.GetIso late());\n"; 2779 $parameterCheckString .= " throwTypeError(ExceptionMe ssages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter $huma nFriendlyIndex (\'\" + string + \"\') is not a valid enum value.\"), info.GetIso late());\n";
2780 } 2780 }
2781 $parameterCheckString .= " return;\n"; 2781 $parameterCheckString .= " return;\n";
2782 $parameterCheckString .= " }\n"; 2782 $parameterCheckString .= " }\n";
2783 } 2783 }
2784 } else { 2784 } else {
2785 # If the "StrictTypeChecking" extended attribute is present, and the argument's type is an 2785 # If the "StrictTypeChecking" extended attribute is present, and the argument's type is an
Nils Barth (inactive) 2014/02/12 01:15:45 Could you rewrite this comment to be explicit abou
fs 2014/02/12 10:07:27 Done.
2786 # interface type, then if the incoming value does not implement that interface, a TypeError 2786 # interface type, then if the incoming value does not implement that interface, a TypeError
2787 # is thrown rather than silently passing NULL to the C++ code. 2787 # is thrown rather than silently passing NULL to the C++ code.
2788 # Per the Web IDL and ECMAScript specifications, incoming values can always be converted 2788 # Per the Web IDL and ECMAScript specifications, incoming values can always be converted
2789 # to both strings and numbers, so do not throw TypeError if the argu ment is of these 2789 # to both strings and numbers, so do not throw TypeError if the argu ment is of these
2790 # types. 2790 # types.
2791 if ($function->extendedAttributes->{"StrictTypeChecking"} || $interf ace->extendedAttributes->{"StrictTypeChecking"}) { 2791 if ($function->extendedAttributes->{"StrictTypeChecking"} || $interf ace->extendedAttributes->{"StrictTypeChecking"}) {
2792 my $argValue = "info[$paramIndex]"; 2792 my $argValue = "info[$paramIndex]";
2793 my $argType = $parameter->type; 2793 my $argType = $parameter->type;
2794 if (IsWrapperType($argType)) { 2794 if (IsWrapperType($argType)) {
2795 my $undefinedNullCheck = $parameter->isNullable ? "isUndefin edOrNull($argValue)" : "${argValue}->IsUndefined()"; 2795 my $undefinedNullCheck = $parameter->isNullable ? "!isUndefi nedOrNull($argValue) &&" : "isUndefinedOrNull($argValue) ||";
2796 $parameterCheckString .= " if (info.Length() > $paramInde x && !$undefinedNullCheck && !V8${argType}::hasInstance($argValue, info.GetIsola te())) {\n"; 2796 $parameterCheckString .= " if (info.Length() > $paramInde x && ($undefinedNullCheck !V8${argType}::hasInstance($argValue, info.GetIsolate( )))) {\n";
2797 if ($hasExceptionState) { 2797 if ($hasExceptionState) {
2798 $parameterCheckString .= " exceptionState.throwTy peError(\"parameter $humanFriendlyIndex is not of type \'$argType\'.\");\n"; 2798 $parameterCheckString .= " exceptionState.throwTy peError(\"parameter $humanFriendlyIndex is not of type \'$argType\'.\");\n";
2799 $parameterCheckString .= " exceptionState.throwIf Needed();\n"; 2799 $parameterCheckString .= " exceptionState.throwIf Needed();\n";
2800 }else { 2800 }else {
2801 $parameterCheckString .= " throwTypeError(Excepti onMessages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter $ humanFriendlyIndex is not of type \'$argType\'.\"), info.GetIsolate());\n"; 2801 $parameterCheckString .= " throwTypeError(Excepti onMessages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter $ humanFriendlyIndex is not of type \'$argType\'.\"), info.GetIsolate());\n";
2802 } 2802 }
2803 $parameterCheckString .= " return;\n"; 2803 $parameterCheckString .= " return;\n";
2804 $parameterCheckString .= " }\n"; 2804 $parameterCheckString .= " }\n";
2805 } 2805 }
2806 } 2806 }
(...skipping 3672 matching lines...) Expand 10 before | Expand all | Expand 10 after
6479 if ($parameter->type eq "SerializedScriptValue") { 6479 if ($parameter->type eq "SerializedScriptValue") {
6480 return 1; 6480 return 1;
6481 } elsif (IsIntegerType($parameter->type)) { 6481 } elsif (IsIntegerType($parameter->type)) {
6482 return 1; 6482 return 1;
6483 } 6483 }
6484 } 6484 }
6485 return 0; 6485 return 0;
6486 } 6486 }
6487 6487
6488 1; 6488 1;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698