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 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2251 # values passed in non-primitive argument slots. When more than a single | 2251 # values passed in non-primitive argument slots. When more than a single |
2252 # overload is applicable, precedence is given according to the order of | 2252 # overload is applicable, precedence is given according to the order of |
2253 # declaration in the IDL. | 2253 # declaration in the IDL. |
2254 | 2254 |
2255 my $name = $function->name; | 2255 my $name = $function->name; |
2256 my $interfaceName = $interface->name; | 2256 my $interfaceName = $interface->name; |
2257 my $implClassName = GetImplName($interface); | 2257 my $implClassName = GetImplName($interface); |
2258 | 2258 |
2259 my $conditionalString = GenerateConditionalString($function); | 2259 my $conditionalString = GenerateConditionalString($function); |
2260 my $leastNumMandatoryParams = 255; | 2260 my $leastNumMandatoryParams = 255; |
2261 my $code = ""; | 2261 |
2262 $code .= "#if ${conditionalString}\n\n" if $conditionalString; | 2262 my $hasExceptionState = 0; |
2263 $code .= <<END; | 2263 my $header = ""; |
| 2264 $header .= "#if ${conditionalString}\n\n" if $conditionalString; |
| 2265 $header .= <<END; |
2264 static void ${name}Method${forMainWorldSuffix}(const v8::FunctionCallbackInfo<v8
::Value>& info) | 2266 static void ${name}Method${forMainWorldSuffix}(const v8::FunctionCallbackInfo<v8
::Value>& info) |
2265 { | 2267 { |
2266 END | 2268 END |
| 2269 my $code = ""; |
2267 $code .= GenerateFeatureObservation($function->extendedAttributes->{"Measure
As"}); | 2270 $code .= GenerateFeatureObservation($function->extendedAttributes->{"Measure
As"}); |
2268 $code .= GenerateDeprecationNotification($function->extendedAttributes->{"De
precateAs"}); | 2271 $code .= GenerateDeprecationNotification($function->extendedAttributes->{"De
precateAs"}); |
2269 | 2272 |
2270 foreach my $overload (@{$function->{overloads}}) { | 2273 foreach my $overload (@{$function->{overloads}}) { |
2271 my ($numMandatoryParams, $parametersCheck) = GenerateFunctionParametersC
heck($overload); | 2274 my ($numMandatoryParams, $parametersCheck) = GenerateFunctionParametersC
heck($overload); |
2272 $leastNumMandatoryParams = $numMandatoryParams if ($numMandatoryParams <
$leastNumMandatoryParams); | 2275 $leastNumMandatoryParams = $numMandatoryParams if ($numMandatoryParams <
$leastNumMandatoryParams); |
2273 $code .= " if ($parametersCheck) {\n"; | 2276 $code .= " if ($parametersCheck) {\n"; |
2274 my $overloadedIndexString = $overload->{overloadIndex}; | 2277 my $overloadedIndexString = $overload->{overloadIndex}; |
2275 $code .= " ${name}${overloadedIndexString}Method${forMainWorldSuf
fix}(info);\n"; | 2278 $code .= " ${name}${overloadedIndexString}Method${forMainWorldSuf
fix}(info);\n"; |
2276 $code .= " return;\n"; | 2279 $code .= " return;\n"; |
2277 $code .= " }\n"; | 2280 $code .= " }\n"; |
2278 } | 2281 } |
2279 if ($leastNumMandatoryParams >= 1) { | 2282 if ($leastNumMandatoryParams >= 1) { |
| 2283 if (!$hasExceptionState) { |
| 2284 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
| 2285 $header .= " ExceptionState exceptionState(ExceptionState::Execut
ionContext, \"${name}\", \"${interfaceName}\", info.Holder(), info.GetIsolate())
;\n"; |
| 2286 $hasExceptionState = 1; |
| 2287 } |
2280 $code .= " if (UNLIKELY(info.Length() < $leastNumMandatoryParams)) {\
n"; | 2288 $code .= " if (UNLIKELY(info.Length() < $leastNumMandatoryParams)) {\
n"; |
2281 $code .= " throwTypeError(ExceptionMessages::failedToExecute(\"$n
ame\", \"$interfaceName\", ExceptionMessages::notEnoughArguments($leastNumMandat
oryParams, info.Length())), info.GetIsolate());\n"; | 2289 $code .= " exceptionState.notEnoughArguments($leastNumMandatoryPa
rams, info.Length());\n"; |
2282 $code .= " return;\n"; | 2290 $code .= " return;\n"; |
2283 $code .= " }\n"; | 2291 $code .= " }\n"; |
2284 } | 2292 } |
2285 $code .= <<END; | 2293 if ($hasExceptionState) { |
2286 throwTypeError(ExceptionMessages::failedToExecute(\"$name\", \"$interfaceNam
e\", \"No function was found that matched the signature provided.\"), info.GetIs
olate()); | 2294 $code .= <<END; |
| 2295 exceptionState.throwTypeError(\"No function was found that matched the signa
ture provided.\"); |
| 2296 exceptionState.throwIfNeeded(); |
2287 END | 2297 END |
| 2298 } else { |
| 2299 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); |
| 2300 $code .=<<END; |
| 2301 throwTypeError(ExceptionMessages::failedToExecute(\"${name}\", \"${interface
Name}\", \"No function was found that matched the signature provided.\"), info.G
etIsolate()); |
| 2302 END |
| 2303 } |
2288 $code .= "}\n\n"; | 2304 $code .= "}\n\n"; |
2289 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; | 2305 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; |
2290 $implementation{nameSpaceInternal}->add($code); | 2306 $implementation{nameSpaceInternal}->add($header . $code); |
2291 } | 2307 } |
2292 | 2308 |
2293 sub GenerateFunctionCallback | 2309 sub GenerateFunctionCallback |
2294 { | 2310 { |
2295 my $function = shift; | 2311 my $function = shift; |
2296 my $interface = shift; | 2312 my $interface = shift; |
2297 my $forMainWorldSuffix = shift; | 2313 my $forMainWorldSuffix = shift; |
2298 | 2314 |
2299 my $implClassName = GetImplName($interface); | 2315 my $implClassName = GetImplName($interface); |
2300 my $v8ClassName = GetV8ClassName($interface); | 2316 my $v8ClassName = GetV8ClassName($interface); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2359 $code .= "{\n"; | 2375 $code .= "{\n"; |
2360 | 2376 |
2361 # We throw exceptions using 'ExceptionState' if the function explicitly clai
ms that exceptions | 2377 # We throw exceptions using 'ExceptionState' if the function explicitly clai
ms that exceptions |
2362 # may be raised, or for event listeners, or for security-checking, and for w
eird SVG stuff. | 2378 # may be raised, or for event listeners, or for security-checking, and for w
eird SVG stuff. |
2363 my $isEventListener = $name eq "addEventListener" || $name eq "removeEventLi
stener"; | 2379 my $isEventListener = $name eq "addEventListener" || $name eq "removeEventLi
stener"; |
2364 my $isSecurityCheckNecessary = $interface->extendedAttributes->{"CheckSecuri
ty"} && !$function->extendedAttributes->{"DoNotCheckSecurity"}; | 2380 my $isSecurityCheckNecessary = $interface->extendedAttributes->{"CheckSecuri
ty"} && !$function->extendedAttributes->{"DoNotCheckSecurity"}; |
2365 my $raisesExceptions = $function->extendedAttributes->{"RaisesException"}; | 2381 my $raisesExceptions = $function->extendedAttributes->{"RaisesException"}; |
2366 my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGProperty
Types($interfaceName); | 2382 my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGProperty
Types($interfaceName); |
2367 my $isNonListSVGType = $svgNativeType && !($interfaceName =~ /List$/); | 2383 my $isNonListSVGType = $svgNativeType && !($interfaceName =~ /List$/); |
2368 | 2384 |
| 2385 my $hasExceptionState = 0; |
2369 if ($raisesExceptions || $isEventListener || $isSecurityCheckNecessary || $i
sNonListSVGType) { | 2386 if ($raisesExceptions || $isEventListener || $isSecurityCheckNecessary || $i
sNonListSVGType) { |
2370 AddToImplIncludes("bindings/v8/ExceptionState.h"); | 2387 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
2371 $code .= " ExceptionState exceptionState(ExceptionState::ExecutionCon
text, \"${unoverloadedName}\", \"${interfaceName}\", info.Holder(), info.GetIsol
ate());\n"; | 2388 $code .= " ExceptionState exceptionState(ExceptionState::ExecutionCon
text, \"${unoverloadedName}\", \"${interfaceName}\", info.Holder(), info.GetIsol
ate());\n"; |
| 2389 $hasExceptionState = 1; |
2372 } | 2390 } |
2373 | 2391 |
2374 if ($isEventListener) { | 2392 if ($isEventListener) { |
2375 my $lookupType = ($name eq "addEventListener") ? "OrCreate" : "Only"; | 2393 my $lookupType = ($name eq "addEventListener") ? "OrCreate" : "Only"; |
2376 my $passRefPtrHandling = ($name eq "addEventListener") ? "" : ".get()"; | 2394 my $passRefPtrHandling = ($name eq "addEventListener") ? "" : ".get()"; |
2377 my $hiddenDependencyAction = ($name eq "addEventListener") ? "create" :
"remove"; | 2395 my $hiddenDependencyAction = ($name eq "addEventListener") ? "create" :
"remove"; |
2378 | 2396 |
2379 AddToImplIncludes("bindings/v8/BindingSecurity.h"); | 2397 AddToImplIncludes("bindings/v8/BindingSecurity.h"); |
2380 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); | 2398 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); |
2381 AddToImplIncludes("core/frame/DOMWindow.h"); | 2399 AddToImplIncludes("core/frame/DOMWindow.h"); |
(...skipping 15 matching lines...) Expand all Loading... |
2397 ${hiddenDependencyAction}HiddenDependency(info.Holder(), info[1], ${
v8ClassName}::eventListenerCacheIndex, info.GetIsolate()); | 2415 ${hiddenDependencyAction}HiddenDependency(info.Holder(), info[1], ${
v8ClassName}::eventListenerCacheIndex, info.GetIsolate()); |
2398 } | 2416 } |
2399 } | 2417 } |
2400 END | 2418 END |
2401 $code .= "#endif // ${conditionalString}\n" if $conditionalString; | 2419 $code .= "#endif // ${conditionalString}\n" if $conditionalString; |
2402 $code .= "\n"; | 2420 $code .= "\n"; |
2403 $implementation{nameSpaceInternal}->add($code); | 2421 $implementation{nameSpaceInternal}->add($code); |
2404 return; | 2422 return; |
2405 } | 2423 } |
2406 | 2424 |
2407 $code .= GenerateArgumentsCountCheck($function, $interface); | 2425 $code .= GenerateArgumentsCountCheck($function, $interface, $hasExceptionSta
te); |
2408 | 2426 |
2409 if ($name eq "set" and IsConstructorTemplate($interface, "TypedArray")) { | 2427 if ($name eq "set" and IsConstructorTemplate($interface, "TypedArray")) { |
2410 AddToImplIncludes("bindings/v8/custom/V8ArrayBufferViewCustom.h"); | 2428 AddToImplIncludes("bindings/v8/custom/V8ArrayBufferViewCustom.h"); |
2411 $code .= <<END; | 2429 $code .= <<END; |
2412 setWebGLArrayHelper<$implClassName, ${v8ClassName}>(info); | 2430 setWebGLArrayHelper<$implClassName, ${v8ClassName}>(info); |
2413 } | 2431 } |
2414 | 2432 |
2415 END | 2433 END |
2416 $implementation{nameSpaceInternal}->add($code); | 2434 $implementation{nameSpaceInternal}->add($code); |
2417 return; | 2435 return; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2508 if (ExtendedAttributeContains($callWith, "FirstWindow")) { | 2526 if (ExtendedAttributeContains($callWith, "FirstWindow")) { |
2509 push(@callWithArgs, "firstDOMWindow()"); | 2527 push(@callWithArgs, "firstDOMWindow()"); |
2510 } | 2528 } |
2511 return ([@callWithArgs], $code); | 2529 return ([@callWithArgs], $code); |
2512 } | 2530 } |
2513 | 2531 |
2514 sub GenerateArgumentsCountCheck | 2532 sub GenerateArgumentsCountCheck |
2515 { | 2533 { |
2516 my $function = shift; | 2534 my $function = shift; |
2517 my $interface = shift; | 2535 my $interface = shift; |
| 2536 my $hasExceptionState = shift; |
2518 | 2537 |
2519 my $functionName = $function->name; | 2538 my $functionName = $function->name; |
2520 my $interfaceName = $interface->name; | 2539 my $interfaceName = $interface->name; |
2521 my $implClassName = GetImplName($interface); | 2540 my $implClassName = GetImplName($interface); |
2522 | 2541 |
2523 my $numMandatoryParams = 0; | 2542 my $numMandatoryParams = 0; |
2524 my $allowNonOptional = 1; | 2543 my $allowNonOptional = 1; |
2525 foreach my $param (@{$function->parameters}) { | 2544 foreach my $param (@{$function->parameters}) { |
2526 if ($param->isOptional or $param->isVariadic) { | 2545 if ($param->isOptional or $param->isVariadic) { |
2527 $allowNonOptional = 0; | 2546 $allowNonOptional = 0; |
2528 } else { | 2547 } else { |
2529 die "An argument must not be declared to be optional unless all subs
equent arguments to the operation are also optional." if !$allowNonOptional; | 2548 die "An argument must not be declared to be optional unless all subs
equent arguments to the operation are also optional." if !$allowNonOptional; |
2530 $numMandatoryParams++; | 2549 $numMandatoryParams++; |
2531 } | 2550 } |
2532 } | 2551 } |
2533 | 2552 |
2534 my $argumentsCountCheckString = ""; | 2553 my $argumentsCountCheckString = ""; |
2535 if ($numMandatoryParams >= 1) { | 2554 if ($numMandatoryParams >= 1) { |
2536 $argumentsCountCheckString .= " if (UNLIKELY(info.Length() < $numMand
atoryParams)) {\n"; | 2555 $argumentsCountCheckString .= " if (UNLIKELY(info.Length() < $numMand
atoryParams)) {\n"; |
2537 $argumentsCountCheckString .= " throwTypeError(ExceptionMessages:
:failedToExecute(\"$functionName\", \"$interfaceName\", ExceptionMessages::notEn
oughArguments($numMandatoryParams, info.Length())), info.GetIsolate());\n"; | 2556 if ($hasExceptionState) { |
| 2557 $argumentsCountCheckString .= " exceptionState.notEnoughArgum
ents($numMandatoryParams, info.Length());\n"; |
| 2558 } else { |
| 2559 $argumentsCountCheckString .= " throwTypeError(ExceptionMessa
ges::failedToExecute(\"$functionName\", \"$interfaceName\", ExceptionMessages::n
otEnoughArguments($numMandatoryParams, info.Length())), info.GetIsolate());\n"; |
| 2560 } |
2538 $argumentsCountCheckString .= " return;\n"; | 2561 $argumentsCountCheckString .= " return;\n"; |
2539 $argumentsCountCheckString .= " }\n"; | 2562 $argumentsCountCheckString .= " }\n"; |
2540 } | 2563 } |
2541 return $argumentsCountCheckString; | 2564 return $argumentsCountCheckString; |
2542 } | 2565 } |
2543 | 2566 |
2544 sub GenerateParametersCheck | 2567 sub GenerateParametersCheck |
2545 { | 2568 { |
2546 my $function = shift; | 2569 my $function = shift; |
2547 my $interface = shift; | 2570 my $interface = shift; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2698 } | 2721 } |
2699 return ($parameterCheckString, $paramIndex, %replacements); | 2722 return ($parameterCheckString, $paramIndex, %replacements); |
2700 } | 2723 } |
2701 | 2724 |
2702 sub GenerateOverloadedConstructorCallback | 2725 sub GenerateOverloadedConstructorCallback |
2703 { | 2726 { |
2704 my $interface = shift; | 2727 my $interface = shift; |
2705 my $interfaceName = $interface->name; | 2728 my $interfaceName = $interface->name; |
2706 my $implClassName = GetImplName($interface); | 2729 my $implClassName = GetImplName($interface); |
2707 | 2730 |
2708 my $code = ""; | 2731 my $hasExceptionState = 0; |
2709 $code .= <<END; | 2732 my $header = ""; |
| 2733 $header .= <<END; |
2710 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | 2734 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
2711 { | 2735 { |
2712 END | 2736 END |
| 2737 my $code = ""; |
2713 my $leastNumMandatoryParams = 255; | 2738 my $leastNumMandatoryParams = 255; |
2714 foreach my $constructor (@{$interface->constructors}) { | 2739 foreach my $constructor (@{$interface->constructors}) { |
2715 my $name = "constructor" . $constructor->overloadedIndex; | 2740 my $name = "constructor" . $constructor->overloadedIndex; |
2716 my ($numMandatoryParams, $parametersCheck) = GenerateFunctionParametersC
heck($constructor); | 2741 my ($numMandatoryParams, $parametersCheck) = GenerateFunctionParametersC
heck($constructor); |
2717 $leastNumMandatoryParams = $numMandatoryParams if ($numMandatoryParams <
$leastNumMandatoryParams); | 2742 $leastNumMandatoryParams = $numMandatoryParams if ($numMandatoryParams <
$leastNumMandatoryParams); |
2718 $code .= " if ($parametersCheck) {\n"; | 2743 $code .= " if ($parametersCheck) {\n"; |
2719 $code .= " ${implClassName}V8Internal::${name}(info);\n"; | 2744 $code .= " ${implClassName}V8Internal::${name}(info);\n"; |
2720 $code .= " return;\n"; | 2745 $code .= " return;\n"; |
2721 $code .= " }\n"; | 2746 $code .= " }\n"; |
2722 } | 2747 } |
2723 if ($leastNumMandatoryParams >= 1) { | 2748 if ($leastNumMandatoryParams >= 1) { |
2724 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); | 2749 if (!$hasExceptionState) { |
| 2750 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
| 2751 $header .= " ExceptionState exceptionState(ExceptionState::Constr
uctionContext, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n"; |
| 2752 $hasExceptionState = 1; |
| 2753 } |
2725 $code .= " if (UNLIKELY(info.Length() < $leastNumMandatoryParams)) {\
n"; | 2754 $code .= " if (UNLIKELY(info.Length() < $leastNumMandatoryParams)) {\
n"; |
2726 | 2755 $code .= " exceptionState.notEnoughArguments($leastNumMandatoryPa
rams, info.Length());\n"; |
2727 $code .= " throwTypeError(ExceptionMessages::failedToConstruct(\"
$interfaceName\", ExceptionMessages::notEnoughArguments($leastNumMandatoryParams
, info.Length())), info.GetIsolate());\n"; | |
2728 $code .= " return;\n"; | 2756 $code .= " return;\n"; |
2729 $code .= " }\n"; | 2757 $code .= " }\n"; |
2730 } | 2758 } |
2731 $code .= <<END; | 2759 if ($hasExceptionState) { |
2732 throwTypeError(ExceptionMessages::failedToConstruct(\"$interfaceName\", \"No
matching constructor signature.\"), info.GetIsolate()); | 2760 $code .= <<END; |
2733 return; | 2761 exceptionState.throwTypeError(\"No matching constructor signature.\"); |
| 2762 exceptionState.throwIfNeeded(); |
2734 END | 2763 END |
| 2764 } else { |
| 2765 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); |
| 2766 $code .= <<END; |
| 2767 throwTypeError(ExceptionMessages::failedToConstruct(\"${interfaceName}\", \"
No matching constructor signature.\"), info.GetIsolate()); |
| 2768 END |
| 2769 } |
2735 $code .= "}\n\n"; | 2770 $code .= "}\n\n"; |
2736 $implementation{nameSpaceInternal}->add($code); | 2771 $implementation{nameSpaceInternal}->add($header . $code); |
2737 } | 2772 } |
2738 | 2773 |
2739 sub GenerateSingleConstructorCallback | 2774 sub GenerateSingleConstructorCallback |
2740 { | 2775 { |
2741 my $interface = shift; | 2776 my $interface = shift; |
2742 my $function = shift; | 2777 my $function = shift; |
2743 | 2778 |
2744 my $implClassName = GetImplName($interface); | 2779 my $implClassName = GetImplName($interface); |
2745 my $v8ClassName = GetV8ClassName($interface); | 2780 my $v8ClassName = GetV8ClassName($interface); |
2746 my $overloadedIndexString = ""; | 2781 my $overloadedIndexString = ""; |
2747 if ($function->overloadedIndex > 0) { | 2782 if ($function->overloadedIndex > 0) { |
2748 $overloadedIndexString .= $function->overloadedIndex; | 2783 $overloadedIndexString .= $function->overloadedIndex; |
2749 } | 2784 } |
2750 | 2785 |
2751 my $constructorRaisesException = $interface->extendedAttributes->{"RaisesExc
eption"} && $interface->extendedAttributes->{"RaisesException"} eq "Constructor"
; | 2786 my $constructorRaisesException = $interface->extendedAttributes->{"RaisesExc
eption"} && $interface->extendedAttributes->{"RaisesException"} eq "Constructor"
; |
2752 my $raisesExceptions = $function->extendedAttributes->{"RaisesException"} ||
$constructorRaisesException; | 2787 my $raisesExceptions = $function->extendedAttributes->{"RaisesException"} ||
$constructorRaisesException; |
2753 | 2788 |
2754 my @beforeArgumentList; | 2789 my @beforeArgumentList; |
2755 my @afterArgumentList; | 2790 my @afterArgumentList; |
2756 my $code = ""; | 2791 my $code = ""; |
2757 $code .= <<END; | 2792 $code .= <<END; |
2758 static void constructor${overloadedIndexString}(const v8::FunctionCallbackInfo<v
8::Value>& info) | 2793 static void constructor${overloadedIndexString}(const v8::FunctionCallbackInfo<v
8::Value>& info) |
2759 { | 2794 { |
2760 END | 2795 END |
2761 | 2796 |
2762 if ($function->overloadedIndex == 0) { | 2797 if ($function->overloadedIndex == 0) { |
2763 $code .= GenerateArgumentsCountCheck($function, $interface); | 2798 my $hasExceptionState = 0; |
| 2799 $code .= GenerateArgumentsCountCheck($function, $interface, $hasExceptio
nState); |
2764 } | 2800 } |
2765 | 2801 |
2766 if ($raisesExceptions) { | 2802 if ($raisesExceptions) { |
2767 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); | 2803 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); |
2768 AddToImplIncludes("bindings/v8/ExceptionState.h"); | 2804 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
2769 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; | 2805 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
2770 } | 2806 } |
2771 | 2807 |
2772 # FIXME: Currently [Constructor(...)] does not yet support optional argument
s without [Default=...] | 2808 # FIXME: Currently [Constructor(...)] does not yet support optional argument
s without [Default=...] |
2773 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interface, ""); | 2809 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interface, ""); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3096 $code .= <<END; | 3132 $code .= <<END; |
3097 Document* document = currentDocument(); | 3133 Document* document = currentDocument(); |
3098 ASSERT(document); | 3134 ASSERT(document); |
3099 | 3135 |
3100 // Make sure the document is added to the DOM Node map. Otherwise, the ${imp
lClassName} instance | 3136 // Make sure the document is added to the DOM Node map. Otherwise, the ${imp
lClassName} instance |
3101 // may end up being the only node in the map and get garbage-collected prema
turely. | 3137 // may end up being the only node in the map and get garbage-collected prema
turely. |
3102 toV8(document, info.Holder(), info.GetIsolate()); | 3138 toV8(document, info.Holder(), info.GetIsolate()); |
3103 | 3139 |
3104 END | 3140 END |
3105 | 3141 |
3106 $code .= GenerateArgumentsCountCheck($function, $interface); | 3142 my $hasExceptionState = 0; |
| 3143 $code .= GenerateArgumentsCountCheck($function, $interface, $hasExceptionSta
te); |
3107 | 3144 |
3108 if ($raisesExceptions) { | 3145 if ($raisesExceptions) { |
3109 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); | 3146 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); |
3110 AddToImplIncludes("bindings/v8/ExceptionState.h"); | 3147 AddToImplIncludes("bindings/v8/ExceptionState.h"); |
3111 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; | 3148 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
3112 } | 3149 } |
3113 | 3150 |
3114 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interface); | 3151 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC
heck($function, $interface); |
3115 $code .= $parameterCheckString; | 3152 $code .= $parameterCheckString; |
3116 | 3153 |
(...skipping 3343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6460 return 1 if $name eq "ErrorCallback"; | 6497 return 1 if $name eq "ErrorCallback"; |
6461 return 1 if $name eq "FileCallback"; | 6498 return 1 if $name eq "FileCallback"; |
6462 return 1 if $name eq "FileSystemCallback"; | 6499 return 1 if $name eq "FileSystemCallback"; |
6463 return 1 if $name eq "FileSystemVoidCallback"; | 6500 return 1 if $name eq "FileSystemVoidCallback"; |
6464 return 1 if $name eq "FileWriterCallback"; | 6501 return 1 if $name eq "FileWriterCallback"; |
6465 return 1 if $name eq "MetadataCallback"; | 6502 return 1 if $name eq "MetadataCallback"; |
6466 return 0; | 6503 return 0; |
6467 } | 6504 } |
6468 | 6505 |
6469 1; | 6506 1; |
OLD | NEW |