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

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

Issue 121113004: Improve handling of failed integer type conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 11 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
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 my %header; 141 my %header;
142 142
143 # Implementation code structure: 143 # Implementation code structure:
144 # Root ... Copyright 144 # Root ... Copyright
145 # Conditional ... #if FEATURE ... #endif (to be removed soon) 145 # Conditional ... #if FEATURE ... #endif (to be removed soon)
146 # Includes 146 # Includes
147 # NameSpaceWebCore 147 # NameSpaceWebCore
148 # NameSpaceInternal ... namespace ${implClassName}V8Internal in case of no n-callback 148 # NameSpaceInternal ... namespace ${implClassName}V8Internal in case of no n-callback
149 my %implementation; 149 my %implementation;
150 150
151 # The integer primitive types, a map from an IDL integer type to its
152 # binding-level type name.
153 #
154 # NOTE: For the unsigned types, the "UI" prefix is used (and not
155 # "Ui"), so as to match onto the naming of V8Binding conversion
156 # methods (and not the Typed Array naming scheme for unsigned types.)
157 my %integerTypeHash = ("byte" => "Int8",
158 "octet" => "UInt8",
159 "short" => "Int16",
160 "long" => "Int32",
161 "long long" => "Int64",
162 "unsigned short" => "UInt16",
163 "unsigned long" => "UInt32",
164 "unsigned long long" => "UInt64"
165 );
166
167 # Other primitive types
168 #
151 # Promise is not yet in the Web IDL spec but is going to be speced 169 # Promise is not yet in the Web IDL spec but is going to be speced
152 # as primitive types in the future. 170 # as primitive types in the future.
153 # Since V8 dosn't provide Promise primitive object currently, 171 # Since V8 dosn't provide Promise primitive object currently,
154 # primitiveTypeHash doesn't contain Promise. 172 # primitiveTypeHash doesn't contain Promise.
155 my %primitiveTypeHash = ("Date" => 1, 173 my %primitiveTypeHash = ("Date" => 1,
156 "DOMString" => 1, 174 "DOMString" => 1,
157 "DOMTimeStamp" => 1, # typedef unsigned long long 175 "DOMTimeStamp" => 1, # typedef unsigned long long
158 "boolean" => 1, 176 "boolean" => 1,
159 "void" => 1, 177 "void" => 1,
160 "byte" => 1,
161 "octet" => 1,
162 "short" => 1,
163 "long" => 1,
164 "long long" => 1,
165 "unsigned short" => 1,
166 "unsigned long" => 1,
167 "unsigned long long" => 1,
168 "float" => 1, 178 "float" => 1,
169 "double" => 1, 179 "double" => 1,
170 ); 180 );
171 181
172 my %integerTypeHash = ("byte" => 1,
173 "octet" => 1,
174 "short" => 1,
175 "long" => 1,
176 "long long" => 1,
177 "unsigned short" => 1,
178 "unsigned long" => 1,
179 "unsigned long long" => 1,
180 );
181
182 my %nonWrapperTypes = ("CompareHow" => 1, 182 my %nonWrapperTypes = ("CompareHow" => 1,
183 "Dictionary" => 1, 183 "Dictionary" => 1,
184 "EventListener" => 1, 184 "EventListener" => 1,
185 "EventHandler" => 1, 185 "EventHandler" => 1,
186 "MediaQueryListListener" => 1, 186 "MediaQueryListListener" => 1,
187 "NodeFilter" => 1, 187 "NodeFilter" => 1,
188 "SerializedScriptValue" => 1, 188 "SerializedScriptValue" => 1,
189 "any" => 1, 189 "any" => 1,
190 ); 190 );
191 191
(...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 $code .= "static void ${attrName}AttributeSetter${forMainWorldSuffix}(v8 ::Local<v8::Value> jsValue, const v8::FunctionCallbackInfo<v8::Value>& info)\n"; 1928 $code .= "static void ${attrName}AttributeSetter${forMainWorldSuffix}(v8 ::Local<v8::Value> jsValue, const v8::FunctionCallbackInfo<v8::Value>& info)\n";
1929 } else { 1929 } else {
1930 $code .= "static void ${attrName}AttributeSetter${forMainWorldSuffix}(v8 ::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)\n"; 1930 $code .= "static void ${attrName}AttributeSetter${forMainWorldSuffix}(v8 ::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)\n";
1931 } 1931 }
1932 $code .= "{\n"; 1932 $code .= "{\n";
1933 1933
1934 my $raisesException = $attribute->extendedAttributes->{"RaisesException"}; 1934 my $raisesException = $attribute->extendedAttributes->{"RaisesException"};
1935 my $useExceptions = 1 if $raisesException && ($raisesException eq "VALUE_IS_ MISSING" or $raisesException eq "Setter"); 1935 my $useExceptions = 1 if $raisesException && ($raisesException eq "VALUE_IS_ MISSING" or $raisesException eq "Setter");
1936 my $hasStrictTypeChecking = 1 if $attribute->extendedAttributes->{"StrictTyp eChecking"} && IsWrapperType($attrType); # Currently only actually check interf ace types 1936 my $hasStrictTypeChecking = 1 if $attribute->extendedAttributes->{"StrictTyp eChecking"} && IsWrapperType($attrType); # Currently only actually check interf ace types
1937 1937
1938 # Can throw exceptions from accessors or during type conversion.
1939 my $isIntegerType = IsIntegerType($attribute->type);
1940
1938 # We throw exceptions using 'ExceptionState' if the attribute explicitly 1941 # We throw exceptions using 'ExceptionState' if the attribute explicitly
1939 # claims that exceptions may be raised, or if a strict type check might 1942 # claims that exceptions may be raised, or if a strict type check might
1940 # fail, or if we're dealing with SVG, which does strange things with 1943 # fail, or if we're dealing with SVG, which does strange things with
1941 # tearoffs and read-only wrappers. 1944 # tearoffs and read-only wrappers.
1942 if ($useExceptions or $hasStrictTypeChecking or GetSVGTypeNeedingTearOff($in terfaceName) or GetSVGTypeNeedingTearOff($attrType)) { 1945 if ($useExceptions or $hasStrictTypeChecking or GetSVGTypeNeedingTearOff($in terfaceName) or GetSVGTypeNeedingTearOff($attrType) or $isIntegerType) {
1943 $code .= " ExceptionState exceptionState(ExceptionState::SetterContex t, \"${attrName}\", \"${interfaceName}\", info.Holder(), info.GetIsolate());\n"; 1946 $code .= " ExceptionState exceptionState(ExceptionState::SetterContex t, \"${attrName}\", \"${interfaceName}\", info.Holder(), info.GetIsolate());\n";
1944 } 1947 }
1945 1948
1946 # If the "StrictTypeChecking" extended attribute is present, and the 1949 # If the "StrictTypeChecking" extended attribute is present, and the
1947 # attribute's type is an interface type, then if the incoming value does not 1950 # attribute's type is an interface type, then if the incoming value does not
1948 # implement that interface, a TypeError is thrown rather than silently 1951 # implement that interface, a TypeError is thrown rather than silently
1949 # passing NULL to the C++ code. 1952 # passing NULL to the C++ code.
1950 # Per the Web IDL and ECMAScript specifications, incoming values can always 1953 # Per the Web IDL and ECMAScript specifications, incoming values can always
1951 # be converted to both strings and numbers, so do not throw TypeError if the 1954 # be converted to both strings and numbers, so do not throw TypeError if the
1952 # attribute is of these types. 1955 # attribute is of these types.
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
2359 # Append a number to an overloaded method's name to make it unique: 2362 # Append a number to an overloaded method's name to make it unique:
2360 $name = $name . $function->{overloadIndex}; 2363 $name = $name . $function->{overloadIndex};
2361 } 2364 }
2362 2365
2363 my $conditionalString = GenerateConditionalString($function); 2366 my $conditionalString = GenerateConditionalString($function);
2364 my $code = ""; 2367 my $code = "";
2365 $code .= "#if ${conditionalString}\n" if $conditionalString; 2368 $code .= "#if ${conditionalString}\n" if $conditionalString;
2366 $code .= "static void ${name}Method${forMainWorldSuffix}(const v8::FunctionC allbackInfo<v8::Value>& info)\n"; 2369 $code .= "static void ${name}Method${forMainWorldSuffix}(const v8::FunctionC allbackInfo<v8::Value>& info)\n";
2367 $code .= "{\n"; 2370 $code .= "{\n";
2368 2371
2369 # We throw exceptions using 'ExceptionState' if the function explicitly clai ms that exceptions 2372 # We throw exceptions using 'ExceptionState' for a function if:
2370 # may be raised, or for event listeners, or for security-checking, and for w eird SVG stuff. 2373 # - it explicitly claims that exceptions may be raised (or should be if ty pe checks fail.)
2374 # - event listeners.
2375 # - security-checking.
2376 # - weird SVG stuff.
2377 # - takes a parameter that might raise an exception on conversion.
2378 #
2371 my $isEventListener = $name eq "addEventListener" || $name eq "removeEventLi stener"; 2379 my $isEventListener = $name eq "addEventListener" || $name eq "removeEventLi stener";
2372 my $isSecurityCheckNecessary = $interface->extendedAttributes->{"CheckSecuri ty"} && !$function->extendedAttributes->{"DoNotCheckSecurity"}; 2380 my $isSecurityCheckNecessary = $interface->extendedAttributes->{"CheckSecuri ty"} && !$function->extendedAttributes->{"DoNotCheckSecurity"};
2373 my $raisesExceptions = $function->extendedAttributes->{"RaisesException"}; 2381 my $raisesExceptions = $function->extendedAttributes->{"RaisesException"};
2374 my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGProperty Types($interfaceName); 2382 my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGProperty Types($interfaceName);
2375 my $isNonListSVGType = $svgNativeType && !($interfaceName =~ /List$/); 2383 my $isNonListSVGType = $svgNativeType && !($interfaceName =~ /List$/);
2376 2384
2377 my $hasExceptionState = 0; 2385 my $hasExceptionState = $raisesExceptions || $isEventListener || $isSecurity CheckNecessary || $isNonListSVGType || HasExceptionRaisingParameter($function);
2378 if ($raisesExceptions || $isEventListener || $isSecurityCheckNecessary || $i sNonListSVGType || HasSerializedScriptValueParameter($function)) { 2386 if ($hasExceptionState) {
2379 $code .= " ExceptionState exceptionState(ExceptionState::ExecutionCon text, \"${unoverloadedName}\", \"${interfaceName}\", info.Holder(), info.GetIsol ate());\n"; 2387 $code .= " ExceptionState exceptionState(ExceptionState::ExecutionCon text, \"${unoverloadedName}\", \"${interfaceName}\", info.Holder(), info.GetIsol ate());\n";
2380 $hasExceptionState = 1;
2381 } 2388 }
2382 2389
2383 if ($isEventListener) { 2390 if ($isEventListener) {
2384 my $lookupType = ($name eq "addEventListener") ? "OrCreate" : "Only"; 2391 my $lookupType = ($name eq "addEventListener") ? "OrCreate" : "Only";
2385 my $passRefPtrHandling = ($name eq "addEventListener") ? "" : ".get()"; 2392 my $passRefPtrHandling = ($name eq "addEventListener") ? "" : ".get()";
2386 my $hiddenDependencyAction = ($name eq "addEventListener") ? "create" : "remove"; 2393 my $hiddenDependencyAction = ($name eq "addEventListener") ? "create" : "remove";
2387 2394
2388 AddToImplIncludes("bindings/v8/BindingSecurity.h"); 2395 AddToImplIncludes("bindings/v8/BindingSecurity.h");
2389 AddToImplIncludes("bindings/v8/V8EventListenerList.h"); 2396 AddToImplIncludes("bindings/v8/V8EventListenerList.h");
2390 AddToImplIncludes("core/frame/DOMWindow.h"); 2397 AddToImplIncludes("core/frame/DOMWindow.h");
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2458 $code .= " exceptionState.throwIfNeeded();\n"; 2465 $code .= " exceptionState.throwIfNeeded();\n";
2459 $code .= " return;\n"; 2466 $code .= " return;\n";
2460 $code .= " }\n"; 2467 $code .= " }\n";
2461 END 2468 END
2462 } 2469 }
2463 2470
2464 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC heck($function, $interface, $forMainWorldSuffix, $hasExceptionState); 2471 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC heck($function, $interface, $forMainWorldSuffix, $hasExceptionState);
2465 $code .= $parameterCheckString; 2472 $code .= $parameterCheckString;
2466 2473
2467 # Build the function call string. 2474 # Build the function call string.
2468 $code .= GenerateFunctionCallString($function, $paramIndex, " ", $interfa ce, $forMainWorldSuffix, %replacements); 2475 $code .= GenerateFunctionCallString($function, $paramIndex, " ", $interfa ce, $forMainWorldSuffix, $hasExceptionState, %replacements);
2469 $code .= "}\n"; 2476 $code .= "}\n";
2470 $code .= "#endif // ${conditionalString}\n" if $conditionalString; 2477 $code .= "#endif // ${conditionalString}\n" if $conditionalString;
2471 $code .= "\n"; 2478 $code .= "\n";
2472 $implementation{nameSpaceInternal}->add($code); 2479 $implementation{nameSpaceInternal}->add($code);
2473 } 2480 }
2474 2481
2475 sub GenerateCallWith 2482 sub GenerateCallWith
2476 { 2483 {
2477 my $callWith = shift; 2484 my $callWith = shift;
2478 return ([], "") unless $callWith; 2485 return ([], "") unless $callWith;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
2566 foreach my $parameter (@{$function->parameters}) { 2573 foreach my $parameter (@{$function->parameters}) {
2567 my $humanFriendlyIndex = $paramIndex + 1; 2574 my $humanFriendlyIndex = $paramIndex + 1;
2568 my $nativeType = GetNativeType($parameter->type, $parameter->extendedAtt ributes, "parameter"); 2575 my $nativeType = GetNativeType($parameter->type, $parameter->extendedAtt ributes, "parameter");
2569 2576
2570 # Optional arguments without [Default=...] should generate an early call with fewer arguments. 2577 # Optional arguments without [Default=...] should generate an early call with fewer arguments.
2571 # Optional Dictionary arguments always considered to have default of emp ty dictionary. 2578 # Optional Dictionary arguments always considered to have default of emp ty dictionary.
2572 if ($parameter->isOptional && !$parameter->extendedAttributes->{"Default "} && $nativeType ne "Dictionary" && !IsCallbackInterface($parameter->type)) { 2579 if ($parameter->isOptional && !$parameter->extendedAttributes->{"Default "} && $nativeType ne "Dictionary" && !IsCallbackInterface($parameter->type)) {
2573 $parameterCheckString .= <<END; 2580 $parameterCheckString .= <<END;
2574 if (UNLIKELY(info.Length() <= $paramIndex)) { 2581 if (UNLIKELY(info.Length() <= $paramIndex)) {
2575 END 2582 END
2576 $parameterCheckString .= GenerateFunctionCallString($function, $para mIndex, " " x 2, $interface, $forMainWorldSuffix, %replacements); 2583 $parameterCheckString .= GenerateFunctionCallString($function, $para mIndex, " " x 2, $interface, $forMainWorldSuffix, $hasExceptionState, %replac ements);
2577 $parameterCheckString .= <<END; 2584 $parameterCheckString .= <<END;
2578 return; 2585 return;
2579 } 2586 }
2580 END 2587 END
2581 } 2588 }
2582 2589
2583 my $parameterName = $parameter->name; 2590 my $parameterName = $parameter->name;
2584 if (IsCallbackInterface($parameter->type)) { 2591 if (IsCallbackInterface($parameter->type)) {
2585 my $v8ClassName = "V8" . $parameter->type; 2592 my $v8ClassName = "V8" . $parameter->type;
2586 AddToImplIncludes("$v8ClassName.h"); 2593 AddToImplIncludes("$v8ClassName.h");
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2777 2784
2778 my $interfaceName = $interface->name; 2785 my $interfaceName = $interface->name;
2779 my $implClassName = GetImplName($interface); 2786 my $implClassName = GetImplName($interface);
2780 my $v8ClassName = GetV8ClassName($interface); 2787 my $v8ClassName = GetV8ClassName($interface);
2781 my $overloadedIndexString = ""; 2788 my $overloadedIndexString = "";
2782 if ($function->overloadedIndex > 0) { 2789 if ($function->overloadedIndex > 0) {
2783 $overloadedIndexString .= $function->overloadedIndex; 2790 $overloadedIndexString .= $function->overloadedIndex;
2784 } 2791 }
2785 2792
2786 my $constructorRaisesException = $interface->extendedAttributes->{"RaisesExc eption"} && $interface->extendedAttributes->{"RaisesException"} eq "Constructor" ; 2793 my $constructorRaisesException = $interface->extendedAttributes->{"RaisesExc eption"} && $interface->extendedAttributes->{"RaisesException"} eq "Constructor" ;
2787 my $raisesExceptions = $function->extendedAttributes->{"RaisesException"} || $constructorRaisesException || HasSerializedScriptValueParameter($function); 2794 my $hasExceptionState = $function->extendedAttributes->{"RaisesException"} | | $constructorRaisesException || HasExceptionRaisingParameter($function);
2788 2795
2789 my @beforeArgumentList; 2796 my @beforeArgumentList;
2790 my @afterArgumentList; 2797 my @afterArgumentList;
2791 my $code = ""; 2798 my $code = "";
2792 $code .= <<END; 2799 $code .= <<END;
2793 static void constructor${overloadedIndexString}(const v8::FunctionCallbackInfo<v 8::Value>& info) 2800 static void constructor${overloadedIndexString}(const v8::FunctionCallbackInfo<v 8::Value>& info)
2794 { 2801 {
2795 END 2802 END
2796 2803
2804 if ($hasExceptionState) {
2805 $code .= " ExceptionState exceptionState(ExceptionState::Construction Context, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n";
2806 }
2797 if ($function->overloadedIndex == 0) { 2807 if ($function->overloadedIndex == 0) {
2798 my $hasExceptionState = 0;
2799 $code .= GenerateArgumentsCountCheck($function, $interface, $hasExceptio nState); 2808 $code .= GenerateArgumentsCountCheck($function, $interface, $hasExceptio nState);
2800 } 2809 }
2801 2810
2802 if ($raisesExceptions) {
2803 $code .= " ExceptionState exceptionState(ExceptionState::Construction Context, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n";
2804 }
2805
2806 # FIXME: Currently [Constructor(...)] does not yet support optional argument s without [Default=...] 2811 # FIXME: Currently [Constructor(...)] does not yet support optional argument s without [Default=...]
2807 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC heck($function, $interface, "", $raisesExceptions); 2812 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC heck($function, $interface, "", $hasExceptionState);
2808 $code .= $parameterCheckString; 2813 $code .= $parameterCheckString;
2809 2814
2810 if ($interface->extendedAttributes->{"ConstructorCallWith"}) { 2815 if ($interface->extendedAttributes->{"ConstructorCallWith"}) {
2811 if (ExtendedAttributeContains($interface->extendedAttributes->{"Construc torCallWith"}, "ExecutionContext")) { 2816 if (ExtendedAttributeContains($interface->extendedAttributes->{"Construc torCallWith"}, "ExecutionContext")) {
2812 push(@beforeArgumentList, "context"); 2817 push(@beforeArgumentList, "context");
2813 $code .= " ExecutionContext* context = getExecutionContext();\n"; 2818 $code .= " ExecutionContext* context = getExecutionContext();\n";
2814 } 2819 }
2815 if (ExtendedAttributeContains($interface->extendedAttributes->{"Construc torCallWith"}, "Document")) { 2820 if (ExtendedAttributeContains($interface->extendedAttributes->{"Construc torCallWith"}, "Document")) {
2816 push(@beforeArgumentList, "document"); 2821 push(@beforeArgumentList, "document");
2817 $code .= " Document& document = *toDocument(getExecutionContext() );\n"; 2822 $code .= " Document& document = *toDocument(getExecutionContext() );\n";
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
3071 3076
3072 sub GenerateNamedConstructor 3077 sub GenerateNamedConstructor
3073 { 3078 {
3074 my $function = shift; 3079 my $function = shift;
3075 my $interface = shift; 3080 my $interface = shift;
3076 3081
3077 my $interfaceName = $interface->name; 3082 my $interfaceName = $interface->name;
3078 my $implClassName = GetImplName($interface); 3083 my $implClassName = GetImplName($interface);
3079 my $v8ClassName = GetV8ClassName($interface); 3084 my $v8ClassName = GetV8ClassName($interface);
3080 my $constructorRaisesException = $interface->extendedAttributes->{"RaisesExc eption"} && $interface->extendedAttributes->{"RaisesException"} eq "Constructor" ; 3085 my $constructorRaisesException = $interface->extendedAttributes->{"RaisesExc eption"} && $interface->extendedAttributes->{"RaisesException"} eq "Constructor" ;
3081 my $raisesExceptions = $function->extendedAttributes->{"RaisesException"} || $constructorRaisesException || HasSerializedScriptValueParameter($function); 3086 my $raisesExceptions = $function->extendedAttributes->{"RaisesException"} || $constructorRaisesException || HasExceptionRaisingParameter($function);
3082 3087
3083 my $maybeObserveFeature = GenerateFeatureObservation($function->extendedAttr ibutes->{"MeasureAs"}); 3088 my $maybeObserveFeature = GenerateFeatureObservation($function->extendedAttr ibutes->{"MeasureAs"});
3084 my $maybeDeprecateFeature = GenerateDeprecationNotification($function->exten dedAttributes->{"DeprecateAs"}); 3089 my $maybeDeprecateFeature = GenerateDeprecationNotification($function->exten dedAttributes->{"DeprecateAs"});
3085 3090
3086 my @beforeArgumentList; 3091 my @beforeArgumentList;
3087 my @afterArgumentList; 3092 my @afterArgumentList;
3088 3093
3089 my $toActiveDOMObject = "0"; 3094 my $toActiveDOMObject = "0";
3090 if (InheritsExtendedAttribute($interface, "ActiveDOMObject")) { 3095 if (InheritsExtendedAttribute($interface, "ActiveDOMObject")) {
3091 $toActiveDOMObject = "${v8ClassName}::toActiveDOMObject"; 3096 $toActiveDOMObject = "${v8ClassName}::toActiveDOMObject";
(...skipping 20 matching lines...) Expand all
3112 $code .= <<END; 3117 $code .= <<END;
3113 Document* document = currentDocument(); 3118 Document* document = currentDocument();
3114 ASSERT(document); 3119 ASSERT(document);
3115 3120
3116 // Make sure the document is added to the DOM Node map. Otherwise, the ${imp lClassName} instance 3121 // Make sure the document is added to the DOM Node map. Otherwise, the ${imp lClassName} instance
3117 // may end up being the only node in the map and get garbage-collected prema turely. 3122 // may end up being the only node in the map and get garbage-collected prema turely.
3118 toV8(document, info.Holder(), info.GetIsolate()); 3123 toV8(document, info.Holder(), info.GetIsolate());
3119 3124
3120 END 3125 END
3121 3126
3122 if ($raisesExceptions) { 3127 my $hasExceptionState = $raisesExceptions;
3128 if ($hasExceptionState) {
3123 $code .= " ExceptionState exceptionState(ExceptionState::Construction Context, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n"; 3129 $code .= " ExceptionState exceptionState(ExceptionState::Construction Context, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n";
3124 } 3130 }
3125
3126 my $hasExceptionState = $raisesExceptions;
3127 $code .= GenerateArgumentsCountCheck($function, $interface, $hasExceptionSta te); 3131 $code .= GenerateArgumentsCountCheck($function, $interface, $hasExceptionSta te);
3128 3132
3129 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC heck($function, $interface, "", $raisesExceptions); 3133 my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersC heck($function, $interface, "", $hasExceptionState);
3130 $code .= $parameterCheckString; 3134 $code .= $parameterCheckString;
3131 3135
3132 push(@beforeArgumentList, "*document"); 3136 push(@beforeArgumentList, "*document");
3133 3137
3134 if ($constructorRaisesException) { 3138 if ($constructorRaisesException) {
3135 push(@afterArgumentList, "exceptionState"); 3139 push(@afterArgumentList, "exceptionState");
3136 } 3140 }
3137 3141
3138 my @argumentList; 3142 my @argumentList;
3139 my $index = 0; 3143 my $index = 0;
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
3701 $implementation{nameSpaceInternal}->add($code); 3705 $implementation{nameSpaceInternal}->add($code);
3702 } 3706 }
3703 3707
3704 sub GenerateImplementationIndexedPropertySetter 3708 sub GenerateImplementationIndexedPropertySetter
3705 { 3709 {
3706 my $interface = shift; 3710 my $interface = shift;
3707 my $indexedSetterFunction = shift; 3711 my $indexedSetterFunction = shift;
3708 my $implClassName = GetImplName($interface); 3712 my $implClassName = GetImplName($interface);
3709 my $v8ClassName = GetV8ClassName($interface); 3713 my $v8ClassName = GetV8ClassName($interface);
3710 my $methodName = GetImplName($indexedSetterFunction); 3714 my $methodName = GetImplName($indexedSetterFunction);
3715 my $interfaceName = $interface->name;
3711 3716
3712 my $type = $indexedSetterFunction->parameters->[1]->type; 3717 my $type = $indexedSetterFunction->parameters->[1]->type;
3713 my $raisesExceptions = $indexedSetterFunction->extendedAttributes->{"RaisesE xception"}; 3718 my $raisesExceptions = $indexedSetterFunction->extendedAttributes->{"RaisesE xception"};
3714 my $treatNullAs = $indexedSetterFunction->parameters->[1]->extendedAttribute s->{"TreatNullAs"}; 3719 my $treatNullAs = $indexedSetterFunction->parameters->[1]->extendedAttribute s->{"TreatNullAs"};
3715 my $treatUndefinedAs = $indexedSetterFunction->parameters->[1]->extendedAttr ibutes->{"TreatUndefinedAs"}; 3720 my $treatUndefinedAs = $indexedSetterFunction->parameters->[1]->extendedAttr ibutes->{"TreatUndefinedAs"};
3716 my $asSetterValue = 0;
3717 3721
3718 my $code = "static void indexedPropertySetter(uint32_t index, v8::Local<v8:: Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)\n"; 3722 my $code = "static void indexedPropertySetter(uint32_t index, v8::Local<v8:: Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)\n";
3719 $code .= "{\n"; 3723 $code .= "{\n";
3724
3725 my $extraArguments = "";
3726 if ($raisesExceptions || IsIntegerType($type)) {
3727 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola te());\n";
3728 if ($raisesExceptions) {
3729 $extraArguments = ", exceptionState";
3730 }
3731 }
3732
3733 my $asSetterValue = 0;
3720 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H older());\n"; 3734 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H older());\n";
3721 $code .= JSValueToNativeStatement($indexedSetterFunction->parameters->[1]->t ype, $indexedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "pro pertyValue", " ", "info.GetIsolate()"); 3735 $code .= JSValueToNativeStatement($indexedSetterFunction->parameters->[1]->t ype, $indexedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "pro pertyValue", " ", "info.GetIsolate()");
3722 3736
3723 my $extraArguments = "";
3724 if ($raisesExceptions) {
3725 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola te());\n";
3726 $extraArguments = ", exceptionState";
3727 }
3728 my @conditions = (); 3737 my @conditions = ();
3729 my @statements = (); 3738 my @statements = ();
3730 if ($treatNullAs && $treatNullAs ne "NullString") { 3739 if ($treatNullAs && $treatNullAs ne "NullString") {
3731 push @conditions, "jsValue->IsNull()"; 3740 push @conditions, "jsValue->IsNull()";
3732 push @statements, "collection->${treatNullAs}(index$extraArguments);"; 3741 push @statements, "collection->${treatNullAs}(index$extraArguments);";
3733 } 3742 }
3734 if ($treatUndefinedAs && $treatUndefinedAs ne "NullString") { 3743 if ($treatUndefinedAs && $treatUndefinedAs ne "NullString") {
3735 push @conditions, "jsValue->IsUndefined()"; 3744 push @conditions, "jsValue->IsUndefined()";
3736 push @statements, "collection->${treatUndefinedAs}(index$extraArguments) ;"; 3745 push @statements, "collection->${treatUndefinedAs}(index$extraArguments) ;";
3737 } 3746 }
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
4006 $implementation{nameSpaceInternal}->add($code); 4015 $implementation{nameSpaceInternal}->add($code);
4007 } 4016 }
4008 4017
4009 sub GenerateImplementationNamedPropertySetter 4018 sub GenerateImplementationNamedPropertySetter
4010 { 4019 {
4011 my $interface = shift; 4020 my $interface = shift;
4012 my $namedSetterFunction = shift; 4021 my $namedSetterFunction = shift;
4013 my $implClassName = GetImplName($interface); 4022 my $implClassName = GetImplName($interface);
4014 my $v8ClassName = GetV8ClassName($interface); 4023 my $v8ClassName = GetV8ClassName($interface);
4015 my $methodName = GetImplName($namedSetterFunction); 4024 my $methodName = GetImplName($namedSetterFunction);
4025 my $interfaceName = $interface->name;
4016 4026
4027 my $type = $namedSetterFunction->parameters->[1]->type;
4017 my $raisesExceptions = $namedSetterFunction->extendedAttributes->{"RaisesExc eption"}; 4028 my $raisesExceptions = $namedSetterFunction->extendedAttributes->{"RaisesExc eption"};
4018 my $treatNullAs = $namedSetterFunction->parameters->[1]->extendedAttributes- >{"TreatNullAs"}; 4029 my $treatNullAs = $namedSetterFunction->parameters->[1]->extendedAttributes- >{"TreatNullAs"};
4019 my $treatUndefinedAs = $namedSetterFunction->parameters->[1]->extendedAttrib utes->{"TreatUndefinedAs"}; 4030 my $treatUndefinedAs = $namedSetterFunction->parameters->[1]->extendedAttrib utes->{"TreatUndefinedAs"};
4020 my $asSetterValue = 0;
4021 4031
4022 my $code = "static void namedPropertySetter(v8::Local<v8::String> name, v8:: Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)\n"; 4032 my $code = "static void namedPropertySetter(v8::Local<v8::String> name, v8:: Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)\n";
4023 $code .= "{\n"; 4033 $code .= "{\n";
4024 if (!$namedSetterFunction->extendedAttributes->{"OverrideBuiltins"}) { 4034 if (!$namedSetterFunction->extendedAttributes->{"OverrideBuiltins"}) {
4025 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n ame).IsEmpty())\n"; 4035 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n ame).IsEmpty())\n";
4026 $code .= " return;\n"; 4036 $code .= " return;\n";
4027 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; 4037 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n";
4028 $code .= " return;\n"; 4038 $code .= " return;\n";
4029 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n"; 4039 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n";
4030 $code .= " return;\n"; 4040 $code .= " return;\n";
4031 } 4041 }
4042
4043 my $extraArguments = "";
4044 if ($raisesExceptions || IsIntegerType($type)) {
4045 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola te());\n";
4046 if ($raisesExceptions) {
4047 $extraArguments = ", exceptionState";
4048 }
4049 }
4050
4051 my $asSetterValue = 0;
4032 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H older());\n"; 4052 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H older());\n";
4033 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[0]->typ e, $namedSetterFunction->extendedAttributes, $asSetterValue, "name", "propertyNa me", " ", "info.GetIsolate()"); 4053 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[0]->typ e, $namedSetterFunction->extendedAttributes, $asSetterValue, "name", "propertyNa me", " ", "info.GetIsolate()");
4034 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[1]->typ e, $namedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "propert yValue", " ", "info.GetIsolate()"); 4054 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[1]->typ e, $namedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "propert yValue", " ", "info.GetIsolate()");
4035 my $extraArguments = "";
4036 if ($raisesExceptions) {
4037 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola te());\n";
4038 $extraArguments = ", exceptionState";
4039 }
4040 4055
4041 my @conditions = (); 4056 my @conditions = ();
4042 my @statements = (); 4057 my @statements = ();
4043 if ($treatNullAs && $treatNullAs ne "NullString") { 4058 if ($treatNullAs && $treatNullAs ne "NullString") {
4044 push @conditions, "jsValue->IsNull()"; 4059 push @conditions, "jsValue->IsNull()";
4045 push @statements, "collection->${treatNullAs}(propertyName$extraArgument s);"; 4060 push @statements, "collection->${treatNullAs}(propertyName$extraArgument s);";
4046 } 4061 }
4047 if ($treatUndefinedAs && $treatUndefinedAs ne "NullString") { 4062 if ($treatUndefinedAs && $treatUndefinedAs ne "NullString") {
4048 push @conditions, "jsValue->IsUndefined()"; 4063 push @conditions, "jsValue->IsUndefined()";
4049 push @statements, "collection->${treatUndefinedAs}(propertyName$extraArg uments);"; 4064 push @statements, "collection->${treatUndefinedAs}(propertyName$extraArg uments);";
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
5181 return "WebCore"; 5196 return "WebCore";
5182 } 5197 }
5183 5198
5184 sub GenerateFunctionCallString 5199 sub GenerateFunctionCallString
5185 { 5200 {
5186 my $function = shift; 5201 my $function = shift;
5187 my $numberOfParameters = shift; 5202 my $numberOfParameters = shift;
5188 my $indent = shift; 5203 my $indent = shift;
5189 my $interface = shift; 5204 my $interface = shift;
5190 my $forMainWorldSuffix = shift; 5205 my $forMainWorldSuffix = shift;
5206 my $hasExceptionState = shift;
5191 my %replacements = @_; 5207 my %replacements = @_;
5192 5208
5193 my $interfaceName = $interface->name; 5209 my $interfaceName = $interface->name;
5194 my $implClassName = GetImplName($interface); 5210 my $implClassName = GetImplName($interface);
5195 my $name = GetImplName($function); 5211 my $name = GetImplName($function);
5196 my $returnType = $function->type; 5212 my $returnType = $function->type;
5197 my $nativeReturnType = GetNativeType($returnType, {}, ""); 5213 my $nativeReturnType = GetNativeType($returnType, {}, "");
5198 my $code = ""; 5214 my $code = "";
5199 5215
5200 my $isSVGTearOffType = (IsSVGTypeNeedingTearOff($returnType) and not $interf aceName =~ /List$/); 5216 my $isSVGTearOffType = (IsSVGTypeNeedingTearOff($returnType) and not $interf aceName =~ /List$/);
(...skipping 29 matching lines...) Expand all
5230 if ($index eq $numberOfParameters) { 5246 if ($index eq $numberOfParameters) {
5231 last; 5247 last;
5232 } 5248 }
5233 my $paramName = $parameter->name; 5249 my $paramName = $parameter->name;
5234 my $paramType = $parameter->type; 5250 my $paramType = $parameter->type;
5235 5251
5236 if ($replacements{$paramName}) { 5252 if ($replacements{$paramName}) {
5237 push @arguments, $replacements{$paramName}; 5253 push @arguments, $replacements{$paramName};
5238 } elsif (IsSVGTypeNeedingTearOff($parameter->type) and not $interfaceNam e =~ /List$/) { 5254 } elsif (IsSVGTypeNeedingTearOff($parameter->type) and not $interfaceNam e =~ /List$/) {
5239 push @arguments, "$paramName->propertyReference()"; 5255 push @arguments, "$paramName->propertyReference()";
5240 $code .= <<END; 5256 if ($hasExceptionState) {
5257 $code .= <<END;
5258 if (!$paramName) {
5259 exceptionState.throwTypeError(\"parameter $humanFriendlyIndex is not of type '${ \$parameter->type }'.\");
5260 exceptionState.throwIfNeeded();
5261 return;
5262 }
5263 END
5264 } else {
5265 $code .= <<END;
5241 if (!$paramName) { 5266 if (!$paramName) {
5242 throwTypeError(ExceptionMessages::failedToExecute(\"$name\", \"$interfac eName\", \"parameter $humanFriendlyIndex is not of type '${ \$parameter->type }' .\"), info.GetIsolate()); 5267 throwTypeError(ExceptionMessages::failedToExecute(\"$name\", \"$interfac eName\", \"parameter $humanFriendlyIndex is not of type '${ \$parameter->type }' .\"), info.GetIsolate());
5243 return; 5268 return;
5244 } 5269 }
5245 END 5270 END
5271 }
5246 } elsif ($parameter->type eq "SVGMatrix" and $interfaceName eq "SVGTrans formList") { 5272 } elsif ($parameter->type eq "SVGMatrix" and $interfaceName eq "SVGTrans formList") {
5247 push @arguments, "$paramName.get()"; 5273 push @arguments, "$paramName.get()";
5248 } elsif (IsNullableParameter($parameter)) { 5274 } elsif (IsNullableParameter($parameter)) {
5249 push @arguments, "${paramName}IsNull ? 0 : &$paramName"; 5275 push @arguments, "${paramName}IsNull ? 0 : &$paramName";
5250 } elsif (IsCallbackInterface($paramType) or $paramType eq "NodeFilter" o r $paramType eq "XPathNSResolver") { 5276 } elsif (IsCallbackInterface($paramType) or $paramType eq "NodeFilter" o r $paramType eq "XPathNSResolver") {
5251 push @arguments, "$paramName.release()"; 5277 push @arguments, "$paramName.release()";
5252 } else { 5278 } else {
5253 push @arguments, $paramName; 5279 push @arguments, $paramName;
5254 } 5280 }
5255 $index++; 5281 $index++;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
5424 my $nativeType = GetNativeType($type, $extendedAttributes, "parameter"); 5450 my $nativeType = GetNativeType($type, $extendedAttributes, "parameter");
5425 my $native_value = JSValueToNative($type, $extendedAttributes, $argIndexOrZe ro, $jsValue, $getIsolate); 5451 my $native_value = JSValueToNative($type, $extendedAttributes, $argIndexOrZe ro, $jsValue, $getIsolate);
5426 my $code = ""; 5452 my $code = "";
5427 if ($type eq "DOMString" || IsEnumType($type)) { 5453 if ($type eq "DOMString" || IsEnumType($type)) {
5428 die "Wrong native type passed: $nativeType" unless $nativeType =~ /^V8St ringResource/; 5454 die "Wrong native type passed: $nativeType" unless $nativeType =~ /^V8St ringResource/;
5429 if ($type eq "DOMString" or IsEnumType($type)) { 5455 if ($type eq "DOMString" or IsEnumType($type)) {
5430 $code .= $indent . "V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID($nativeType , $variableName, $native_value);\n" 5456 $code .= $indent . "V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID($nativeType , $variableName, $native_value);\n"
5431 } else { 5457 } else {
5432 $code .= $indent . "$nativeType $variableName($native_value, true);\ n"; 5458 $code .= $indent . "$nativeType $variableName($native_value, true);\ n";
5433 } 5459 }
5434 } elsif ($extendedAttributes->{"EnforceRange"}) { 5460 } elsif (IsIntegerType($type)) {
5435 $code .= $indent . "V8TRYCATCH_WITH_TYPECHECK_VOID($nativeType, $variabl eName, $native_value, $getIsolate);\n"; 5461 $code .= $indent . "V8TRYCATCH_EXCEPTION_VOID($nativeType, $variableName , $native_value, exceptionState);\n";
5436 } else { 5462 } else {
5437 $code .= $indent . "V8TRYCATCH_VOID($nativeType, $variableName, $native_ value);\n"; 5463 $code .= $indent . "V8TRYCATCH_VOID($nativeType, $variableName, $native_ value);\n";
5438 } 5464 }
5439 return $code; 5465 return $code;
5440 } 5466 }
5441 5467
5442 5468
5443 sub JSValueToNative 5469 sub JSValueToNative
5444 { 5470 {
5445 my $type = shift; 5471 my $type = shift;
5446 my $extendedAttributes = shift; 5472 my $extendedAttributes = shift;
5447 # Argument position (1-indexed) or 0 if for a setter's value. 5473 # Argument position (1-indexed) or 0 if for a setter's value.
5448 my $argIndexOrZero = shift; 5474 my $argIndexOrZero = shift;
5449 my $value = shift; 5475 my $value = shift;
5450 my $getIsolate = shift; 5476 my $getIsolate = shift;
5451 5477
5452 my $intConversion = $extendedAttributes->{"EnforceRange"} ? "EnforceRange" : "NormalConversion";
5453
5454 return "$value->BooleanValue()" if $type eq "boolean"; 5478 return "$value->BooleanValue()" if $type eq "boolean";
5455 return "static_cast<$type>($value->NumberValue())" if $type eq "float" or $t ype eq "double"; 5479 return "static_cast<$type>($value->NumberValue())" if $type eq "float" or $t ype eq "double";
5456 5480
5457 if ($intConversion ne "NormalConversion") { 5481 if (IsIntegerType($type)) {
5458 return "toInt8($value, $intConversion, ok)" if $type eq "byte"; 5482 my $conversion = "to" . $integerTypeHash{$type} . "($value";
5459 return "toUInt8($value, $intConversion, ok)" if $type eq "octet"; 5483 if ($extendedAttributes->{"EnforceRange"}) {
5460 return "toInt16($value, $intConversion, ok)" if $type eq "short"; 5484 return "${conversion}, EnforceRange, exceptionState)";
5461 return "toUInt16($value, $intConversion, ok)" if $type eq "unsigned shor t"; 5485 } else {
5462 return "toInt32($value, $intConversion, ok)" if $type eq "long"; 5486 return "${conversion}, exceptionState)";
5463 return "toUInt32($value, $intConversion, ok)" if $type eq "unsigned long "; 5487 }
5464 return "toInt64($value, $intConversion, ok)" if $type eq "long long";
5465 return "toUInt64($value, $intConversion, ok)" if $type eq "unsigned long long";
5466 } else {
5467 return "toInt8($value)" if $type eq "byte";
5468 return "toUInt8($value)" if $type eq "octet";
5469 return "toInt16($value)" if $type eq "short";
5470 return "toUInt16($value)" if $type eq "unsigned short";
5471 return "toInt32($value)" if $type eq "long";
5472 return "toUInt32($value)" if $type eq "unsigned long";
5473 return "toInt64($value)" if $type eq "long long";
5474 return "toUInt64($value)" if $type eq "unsigned long long";
5475 } 5488 }
5476 return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "C ompareHow"; 5489 return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "C ompareHow";
5477 return "toWebCoreDate($value)" if $type eq "Date"; 5490 return "toWebCoreDate($value)" if $type eq "Date";
5478 5491
5479 if ($type eq "DOMString" or IsEnumType($type)) { 5492 if ($type eq "DOMString" or IsEnumType($type)) {
5480 return $value; 5493 return $value;
5481 } 5494 }
5482 5495
5483 if ($type eq "SerializedScriptValue") { 5496 if ($type eq "SerializedScriptValue") {
5484 AddToImplIncludes("bindings/v8/SerializedScriptValue.h"); 5497 AddToImplIncludes("bindings/v8/SerializedScriptValue.h");
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
5895 } 5908 }
5896 }; 5909 };
5897 5910
5898 &$recurse($interface); 5911 &$recurse($interface);
5899 } 5912 }
5900 5913
5901 sub IsPrimitiveType 5914 sub IsPrimitiveType
5902 { 5915 {
5903 my $type = shift; 5916 my $type = shift;
5904 5917
5918 return 1 if $integerTypeHash{$type};
5905 return 1 if $primitiveTypeHash{$type}; 5919 return 1 if $primitiveTypeHash{$type};
5906 return 0; 5920 return 0;
5907 } 5921 }
5908 5922
5909 sub IsIntegerType 5923 sub IsIntegerType
5910 { 5924 {
5911 my $type = shift; 5925 my $type = shift;
5912 5926
5913 return 1 if $integerTypeHash{$type}; 5927 return 1 if $integerTypeHash{$type};
5914 return 0; 5928 return 0;
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
6336 my $interface = shift; 6350 my $interface = shift;
6337 6351
6338 return 1 if ExtendedAttributeContains($interface->extendedAttributes->{"Cust om"}, "ToV8"); 6352 return 1 if ExtendedAttributeContains($interface->extendedAttributes->{"Cust om"}, "ToV8");
6339 return 1 if ExtendedAttributeContains($interface->extendedAttributes->{"Cust om"}, "Wrap"); 6353 return 1 if ExtendedAttributeContains($interface->extendedAttributes->{"Cust om"}, "Wrap");
6340 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; 6354 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"};
6341 return 1 if InheritsInterface($interface, "Document"); 6355 return 1 if InheritsInterface($interface, "Document");
6342 6356
6343 return 0; 6357 return 0;
6344 } 6358 }
6345 6359
6346 sub HasSerializedScriptValueParameter 6360 sub HasExceptionRaisingParameter
6347 { 6361 {
6348 my $function = shift; 6362 my $function = shift;
6349 6363
6350 foreach my $parameter (@{$function->parameters}) { 6364 foreach my $parameter (@{$function->parameters}) {
6351 if ($parameter->type eq "SerializedScriptValue") { 6365 if ($parameter->type eq "SerializedScriptValue") {
6352 return 1; 6366 return 1;
6367 } elsif (IsIntegerType($parameter->type)) {
6368 return 1;
6353 } 6369 }
6354 } 6370 }
6355 return 0; 6371 return 0;
6356 } 6372 }
6357 6373
6358 1; 6374 1;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698