OLD | NEW |
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 Loading... |
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, type |
2786 # interface type, then if the incoming value does not implement that
interface, a TypeError | 2786 # check interface type arguments for correct type and nullability. |
2787 # is thrown rather than silently passing NULL to the C++ code. | 2787 # |
2788 # Per the Web IDL and ECMAScript specifications, incoming values can
always be converted | 2788 # If the argument is passed, and is not |undefined| or |null|, then |
2789 # to both strings and numbers, so do not throw TypeError if the argu
ment is of these | 2789 # it must implement the interface type, otherwise throw a TypeError |
2790 # types. | 2790 # If the parameter is nullable, then both |undefined| and |null| |
| 2791 # pass a NULL pointer to the C++ code, otherwise these also throw. |
| 2792 # Without [StrictTypeChecking], in all these cases NULL is silently |
| 2793 # passed to the C++ code. |
| 2794 # |
| 2795 # Per the Web IDL and ECMAScript specifications, incoming values |
| 2796 # can always be converted to primitive types and strings (including |
| 2797 # |undefined| and |null|), so do not throw TypeError for these. |
2791 if ($function->extendedAttributes->{"StrictTypeChecking"} || $interf
ace->extendedAttributes->{"StrictTypeChecking"}) { | 2798 if ($function->extendedAttributes->{"StrictTypeChecking"} || $interf
ace->extendedAttributes->{"StrictTypeChecking"}) { |
2792 my $argValue = "info[$paramIndex]"; | 2799 my $argValue = "info[$paramIndex]"; |
2793 my $argType = $parameter->type; | 2800 my $argType = $parameter->type; |
2794 if (IsWrapperType($argType)) { | 2801 if (IsWrapperType($argType)) { |
2795 my $undefinedNullCheck = $parameter->isNullable ? "isUndefin
edOrNull($argValue)" : "${argValue}->IsUndefined()"; | 2802 my $undefinedNullCheck = $parameter->isNullable ? " !isUndef
inedOrNull($argValue) &&" : ""; |
2796 $parameterCheckString .= " if (info.Length() > $paramInde
x && !$undefinedNullCheck && !V8${argType}::hasInstance($argValue, info.GetIsola
te())) {\n"; | 2803 $parameterCheckString .= " if (info.Length() > $paramInde
x &&$undefinedNullCheck !V8${argType}::hasInstance($argValue, info.GetIsolate())
) {\n"; |
2797 if ($hasExceptionState) { | 2804 if ($hasExceptionState) { |
2798 $parameterCheckString .= " exceptionState.throwTy
peError(\"parameter $humanFriendlyIndex is not of type \'$argType\'.\");\n"; | 2805 $parameterCheckString .= " exceptionState.throwTy
peError(\"parameter $humanFriendlyIndex is not of type \'$argType\'.\");\n"; |
2799 $parameterCheckString .= " exceptionState.throwIf
Needed();\n"; | 2806 $parameterCheckString .= " exceptionState.throwIf
Needed();\n"; |
2800 }else { | 2807 }else { |
2801 $parameterCheckString .= " throwTypeError(Excepti
onMessages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter $
humanFriendlyIndex is not of type \'$argType\'.\"), info.GetIsolate());\n"; | 2808 $parameterCheckString .= " throwTypeError(Excepti
onMessages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter $
humanFriendlyIndex is not of type \'$argType\'.\"), info.GetIsolate());\n"; |
2802 } | 2809 } |
2803 $parameterCheckString .= " return;\n"; | 2810 $parameterCheckString .= " return;\n"; |
2804 $parameterCheckString .= " }\n"; | 2811 $parameterCheckString .= " }\n"; |
2805 } | 2812 } |
2806 } | 2813 } |
(...skipping 3675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6482 if ($parameter->type eq "SerializedScriptValue") { | 6489 if ($parameter->type eq "SerializedScriptValue") { |
6483 return 1; | 6490 return 1; |
6484 } elsif (IsIntegerType($parameter->type)) { | 6491 } elsif (IsIntegerType($parameter->type)) { |
6485 return 1; | 6492 return 1; |
6486 } | 6493 } |
6487 } | 6494 } |
6488 return 0; | 6495 return 0; |
6489 } | 6496 } |
6490 | 6497 |
6491 1; | 6498 1; |
OLD | NEW |