| 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 # Default includes | 430 # Default includes |
| 431 if ($type eq "SerializedScriptValue") { | 431 if ($type eq "SerializedScriptValue") { |
| 432 AddToImplIncludes("bindings/v8/SerializedScriptValue.h"); | 432 AddToImplIncludes("bindings/v8/SerializedScriptValue.h"); |
| 433 } elsif ($type eq "any" || IsCallbackFunctionType($type)) { | 433 } elsif ($type eq "any" || IsCallbackFunctionType($type)) { |
| 434 AddToImplIncludes("bindings/v8/ScriptValue.h"); | 434 AddToImplIncludes("bindings/v8/ScriptValue.h"); |
| 435 } elsif ($type eq "Promise") { | 435 } elsif ($type eq "Promise") { |
| 436 AddToImplIncludes("bindings/v8/ScriptPromise.h"); | 436 AddToImplIncludes("bindings/v8/ScriptPromise.h"); |
| 437 } elsif ($type eq "EventHandler") { | 437 } elsif ($type eq "EventHandler") { |
| 438 AddToImplIncludes("bindings/v8/V8AbstractEventListener.h"); | 438 AddToImplIncludes("bindings/v8/V8AbstractEventListener.h"); |
| 439 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); | 439 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); |
| 440 } elsif ($type eq "Dictionary") { |
| 441 AddToImplIncludes("bindings/v8/Dictionary.h"); |
| 440 } elsif (IsTypedArrayType($type)) { | 442 } elsif (IsTypedArrayType($type)) { |
| 441 AddToImplIncludes("bindings/v8/custom/V8${type}Custom.h"); | 443 AddToImplIncludes("bindings/v8/custom/V8${type}Custom.h"); |
| 442 } elsif (my $arrayType = GetArrayType($type)) { | 444 } elsif (my $arrayType = GetArrayType($type)) { |
| 443 AddIncludesForType($arrayType); | 445 AddIncludesForType($arrayType); |
| 444 } else { | 446 } else { |
| 445 AddToImplIncludes("V8${type}.h"); | 447 AddToImplIncludes("V8${type}.h"); |
| 446 } | 448 } |
| 447 } | 449 } |
| 448 | 450 |
| 449 sub HeaderFilesForInterface | 451 sub HeaderFilesForInterface |
| (...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2593 $parameterCheckString .= " }\n"; | 2595 $parameterCheckString .= " }\n"; |
| 2594 $parameterCheckString .= " $parameterName.append(V8${argT
ype}::toNative(v8::Handle<v8::Object>::Cast(info[i])));\n"; | 2596 $parameterCheckString .= " $parameterName.append(V8${argT
ype}::toNative(v8::Handle<v8::Object>::Cast(info[i])));\n"; |
| 2595 $parameterCheckString .= " }\n"; | 2597 $parameterCheckString .= " }\n"; |
| 2596 } else { | 2598 } else { |
| 2597 $parameterCheckString .= " V8TRYCATCH_VOID(Vector<$nativeElem
entType>, $parameterName, toNativeArguments<$nativeElementType>(info, $paramInde
x));\n"; | 2599 $parameterCheckString .= " V8TRYCATCH_VOID(Vector<$nativeElem
entType>, $parameterName, toNativeArguments<$nativeElementType>(info, $paramInde
x));\n"; |
| 2598 } | 2600 } |
| 2599 } elsif ($nativeType =~ /^V8StringResource/) { | 2601 } elsif ($nativeType =~ /^V8StringResource/) { |
| 2600 my $default = defined $parameter->extendedAttributes->{"Default"} ?
$parameter->extendedAttributes->{"Default"} : ""; | 2602 my $default = defined $parameter->extendedAttributes->{"Default"} ?
$parameter->extendedAttributes->{"Default"} : ""; |
| 2601 my $jsValue = $parameter->isOptional && $default eq "NullString" ? "
argumentOrNull(info, $paramIndex)" : "info[$paramIndex]"; | 2603 my $jsValue = $parameter->isOptional && $default eq "NullString" ? "
argumentOrNull(info, $paramIndex)" : "info[$paramIndex]"; |
| 2602 my $stringResourceParameterName = $parameterName; | 2604 my $stringResourceParameterName = $parameterName; |
| 2603 my $isNullable = $parameter->isNullable && !IsRefPtrType($parameter-
>type); | 2605 my $isNullable = IsNullableParameter($parameter); |
| 2604 if ($isNullable) { | 2606 if ($isNullable) { |
| 2605 $parameterCheckString .= " bool ${parameterName}IsNull = $jsV
alue->IsNull();\n"; | 2607 $parameterCheckString .= " bool ${parameterName}IsNull = $jsV
alue->IsNull();\n"; |
| 2606 $stringResourceParameterName .= "StringResource"; | 2608 $stringResourceParameterName .= "StringResource"; |
| 2607 } | 2609 } |
| 2608 $parameterCheckString .= JSValueToNativeStatement($parameter->type,
$parameter->extendedAttributes, $humanFriendlyIndex, $jsValue, $stringResourcePa
rameterName, " ", "info.GetIsolate()"); | 2610 $parameterCheckString .= JSValueToNativeStatement($parameter->type,
$parameter->extendedAttributes, $humanFriendlyIndex, $jsValue, $stringResourcePa
rameterName, " ", "info.GetIsolate()"); |
| 2609 $parameterCheckString .= " String $parameterName = $stringResourc
eParameterName;\n" if $isNullable; | 2611 $parameterCheckString .= " String $parameterName = $stringResourc
eParameterName;\n" if $isNullable; |
| 2610 if (IsEnumType($parameter->type)) { | 2612 if (IsEnumType($parameter->type)) { |
| 2611 my @enumValues = ValidEnumValues($parameter->type); | 2613 my @enumValues = ValidEnumValues($parameter->type); |
| 2612 my @validEqualities = (); | 2614 my @validEqualities = (); |
| 2613 foreach my $enumValue (@enumValues) { | 2615 foreach my $enumValue (@enumValues) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2632 my $argType = $parameter->type; | 2634 my $argType = $parameter->type; |
| 2633 if (IsWrapperType($argType)) { | 2635 if (IsWrapperType($argType)) { |
| 2634 $parameterCheckString .= " if (info.Length() > $paramInde
x && !isUndefinedOrNull($argValue) && !V8${argType}::hasInstance($argValue, info
.GetIsolate(), worldType(info.GetIsolate()))) {\n"; | 2636 $parameterCheckString .= " if (info.Length() > $paramInde
x && !isUndefinedOrNull($argValue) && !V8${argType}::hasInstance($argValue, info
.GetIsolate(), worldType(info.GetIsolate()))) {\n"; |
| 2635 $parameterCheckString .= " throwTypeError(ExceptionMe
ssages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter $huma
nFriendlyIndex is not of type \'$argType\'.\"), info.GetIsolate());\n"; | 2637 $parameterCheckString .= " throwTypeError(ExceptionMe
ssages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter $huma
nFriendlyIndex is not of type \'$argType\'.\"), info.GetIsolate());\n"; |
| 2636 $parameterCheckString .= " return;\n"; | 2638 $parameterCheckString .= " return;\n"; |
| 2637 $parameterCheckString .= " }\n"; | 2639 $parameterCheckString .= " }\n"; |
| 2638 } | 2640 } |
| 2639 } | 2641 } |
| 2640 my $default = defined $parameter->extendedAttributes->{"Default"} ?
$parameter->extendedAttributes->{"Default"} : ""; | 2642 my $default = defined $parameter->extendedAttributes->{"Default"} ?
$parameter->extendedAttributes->{"Default"} : ""; |
| 2641 my $jsValue = $parameter->isOptional && $default eq "NullString" ? "
argumentOrNull(info, $paramIndex)" : "info[$paramIndex]"; | 2643 my $jsValue = $parameter->isOptional && $default eq "NullString" ? "
argumentOrNull(info, $paramIndex)" : "info[$paramIndex]"; |
| 2642 my $isNullable = $parameter->isNullable && !IsRefPtrType($parameter-
>type); | 2644 my $isNullable = IsNullableParameter($parameter); |
| 2643 $parameterCheckString .= " bool ${parameterName}IsNull = $jsValue
->IsNull();\n" if $isNullable; | 2645 $parameterCheckString .= " bool ${parameterName}IsNull = $jsValue
->IsNull();\n" if $isNullable; |
| 2644 $parameterCheckString .= JSValueToNativeStatement($parameter->type,
$parameter->extendedAttributes, $humanFriendlyIndex, $jsValue, $parameterName, "
", "info.GetIsolate()"); | 2646 $parameterCheckString .= JSValueToNativeStatement($parameter->type,
$parameter->extendedAttributes, $humanFriendlyIndex, $jsValue, $parameterName, "
", "info.GetIsolate()"); |
| 2645 if ($nativeType eq 'Dictionary' or $nativeType eq 'ScriptPromise') { | 2647 if ($nativeType eq 'Dictionary' or $nativeType eq 'ScriptPromise') { |
| 2646 $parameterCheckString .= " if (!$parameterName.isUndefinedOrN
ull() && !$parameterName.isObject()) {\n"; | 2648 $parameterCheckString .= " if (!$parameterName.isUndefinedOrN
ull() && !$parameterName.isObject()) {\n"; |
| 2647 if ($functionName eq "Constructor") { | 2649 if ($functionName eq "Constructor") { |
| 2648 $parameterCheckString .= " throwTypeError(ExceptionMe
ssages::failedToConstruct(\"$interfaceName\", \"parameter ${humanFriendlyIndex}
('${parameterName}') is not an object.\"), info.GetIsolate());\n"; | 2650 $parameterCheckString .= " throwTypeError(ExceptionMe
ssages::failedToConstruct(\"$interfaceName\", \"parameter ${humanFriendlyIndex}
('${parameterName}') is not an object.\"), info.GetIsolate());\n"; |
| 2649 } else { | 2651 } else { |
| 2650 $parameterCheckString .= " throwTypeError(ExceptionMe
ssages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter ${hum
anFriendlyIndex} ('${parameterName}') is not an object.\"), info.GetIsolate());\
n"; | 2652 $parameterCheckString .= " throwTypeError(ExceptionMe
ssages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter ${hum
anFriendlyIndex} ('${parameterName}') is not an object.\"), info.GetIsolate());\
n"; |
| 2651 } | 2653 } |
| 2652 $parameterCheckString .= " return;\n"; | 2654 $parameterCheckString .= " return;\n"; |
| (...skipping 2527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5180 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); | 5182 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); |
| 5181 push @arguments, "$paramName->propertyReference()"; | 5183 push @arguments, "$paramName->propertyReference()"; |
| 5182 $code .= <<END; | 5184 $code .= <<END; |
| 5183 if (!$paramName) { | 5185 if (!$paramName) { |
| 5184 throwTypeError(ExceptionMessages::failedToExecute(\"$name\", \"$interfac
eName\", \"parameter $humanFriendlyIndex is not of type '${ \$parameter->type }'
.\"), info.GetIsolate()); | 5186 throwTypeError(ExceptionMessages::failedToExecute(\"$name\", \"$interfac
eName\", \"parameter $humanFriendlyIndex is not of type '${ \$parameter->type }'
.\"), info.GetIsolate()); |
| 5185 return; | 5187 return; |
| 5186 } | 5188 } |
| 5187 END | 5189 END |
| 5188 } elsif ($parameter->type eq "SVGMatrix" and $interfaceName eq "SVGTrans
formList") { | 5190 } elsif ($parameter->type eq "SVGMatrix" and $interfaceName eq "SVGTrans
formList") { |
| 5189 push @arguments, "$paramName.get()"; | 5191 push @arguments, "$paramName.get()"; |
| 5190 } elsif ($parameter->isNullable && !IsRefPtrType($parameter->type)) { | 5192 } elsif (IsNullableParameter($parameter)) { |
| 5191 push @arguments, "${paramName}IsNull ? 0 : &$paramName"; | 5193 push @arguments, "${paramName}IsNull ? 0 : &$paramName"; |
| 5192 } else { | 5194 } else { |
| 5193 push @arguments, $paramName; | 5195 push @arguments, $paramName; |
| 5194 } | 5196 } |
| 5195 $index++; | 5197 $index++; |
| 5196 $humanFriendlyIndex = $index + 1; | 5198 $humanFriendlyIndex = $index + 1; |
| 5197 } | 5199 } |
| 5198 | 5200 |
| 5199 if ($function->extendedAttributes->{"RaisesException"}) { | 5201 if ($function->extendedAttributes->{"RaisesException"}) { |
| 5200 push @arguments, "exceptionState"; | 5202 push @arguments, "exceptionState"; |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5983 my $type = shift; | 5985 my $type = shift; |
| 5984 | 5986 |
| 5985 return 0 if $type eq "any"; | 5987 return 0 if $type eq "any"; |
| 5986 return 0 if IsPrimitiveType($type); | 5988 return 0 if IsPrimitiveType($type); |
| 5987 return 0 if GetArrayType($type); | 5989 return 0 if GetArrayType($type); |
| 5988 return 0 if GetSequenceType($type); | 5990 return 0 if GetSequenceType($type); |
| 5989 return 0 if $type eq "Promise"; | 5991 return 0 if $type eq "Promise"; |
| 5990 return 0 if IsCallbackFunctionType($type); | 5992 return 0 if IsCallbackFunctionType($type); |
| 5991 return 0 if IsEnumType($type); | 5993 return 0 if IsEnumType($type); |
| 5992 return 0 if IsUnionType($type); | 5994 return 0 if IsUnionType($type); |
| 5995 return 0 if $type eq "Dictionary"; |
| 5993 | 5996 |
| 5994 return 1; | 5997 return 1; |
| 5995 } | 5998 } |
| 5996 | 5999 |
| 6000 sub IsNullableParameter |
| 6001 { |
| 6002 my $parameter = shift; |
| 6003 |
| 6004 return $parameter->isNullable && !IsRefPtrType($parameter->type) && $paramet
er->type ne "Dictionary"; |
| 6005 } |
| 6006 |
| 5997 sub GetSVGTypeNeedingTearOff | 6007 sub GetSVGTypeNeedingTearOff |
| 5998 { | 6008 { |
| 5999 my $type = shift; | 6009 my $type = shift; |
| 6000 | 6010 |
| 6001 return $svgTypeNeedingTearOff{$type} if exists $svgTypeNeedingTearOff{$type}
; | 6011 return $svgTypeNeedingTearOff{$type} if exists $svgTypeNeedingTearOff{$type}
; |
| 6002 return undef; | 6012 return undef; |
| 6003 } | 6013 } |
| 6004 | 6014 |
| 6005 sub GetSVGWrappedTypeNeedingTearOff | 6015 sub GetSVGWrappedTypeNeedingTearOff |
| 6006 { | 6016 { |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6315 my $interface = shift; | 6325 my $interface = shift; |
| 6316 | 6326 |
| 6317 return 1 if $interface->extendedAttributes->{"CustomToV8"}; | 6327 return 1 if $interface->extendedAttributes->{"CustomToV8"}; |
| 6318 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; | 6328 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; |
| 6319 return 1 if InheritsInterface($interface, "Document"); | 6329 return 1 if InheritsInterface($interface, "Document"); |
| 6320 | 6330 |
| 6321 return 0; | 6331 return 0; |
| 6322 } | 6332 } |
| 6323 | 6333 |
| 6324 1; | 6334 1; |
| OLD | NEW |