[WebIDL] Overloaded functions unnecessarily duplicate argument checks
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 May 2017 16:08:31 +0000 (16:08 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 May 2017 16:08:31 +0000 (16:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172481

Reviewed by Chris Dumez.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(GeneratePropertiesHashTable):
Update for rename of GetConditionalForFunctionConsideringOverloads.

(AreTypesDistinguishableForOverloadResolution):
Remove unnecessary subroutine isDictionary that can be replaced by
a direct call to $codeGenerator->IsDictionaryType().

(GetConditionalForFunctionConsideringOverloads):
Renamed from getConditionalForFunctionConsideringOverloads.

(GenerateOverloadDispatcher):
Renamed from GenerateOverloadedFunctionOrConstructor. Moved Constructor/Operation/LegacyCaller
specific code out, and into parameters.

(GenerateImplementation):
Moved operation generation out into its own subroutine.

(GenerateOperationDefinition): Added.
Moved from GenerateImplementation.

(GenerateLegacyCallerDefinitions):
Pass function name and signature to GenerateOverloadDispatcher.

(GenerateArgumentsCountCheck):
Don't generate an argument check if this is an overloaded function. The argument
checks happen in the overload dispatcher.

(NeedsExplicitPropagateExceptionCall):
(GenerateParametersCheck):
(GenerateImplementationFunctionCall):
Replace IsReturningPromise with more direct check.

(GenerateConstructorDefinitions):
Pass function name and signature to GenerateOverloadDispatcher.

(getConditionalForFunctionConsideringOverloads): Renamed to GetConditionalForFunctionConsideringOverloads.
(GenerateOverloadedFunctionOrConstructor): Renamed to GenerateOverloadDispatcher.
(IsReturningPromise): Deleted.

* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/TestInterface.idl:
Update test results.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@217369 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp
Source/WebCore/bindings/scripts/test/TestInterface.idl

index 2713115..ac75deb 100644 (file)
@@ -1,3 +1,57 @@
+2017-05-24  Sam Weinig  <sam@webkit.org>
+
+        [WebIDL] Overloaded functions unnecessarily duplicate argument checks
+        https://bugs.webkit.org/show_bug.cgi?id=172481
+
+        Reviewed by Chris Dumez.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateHeader):
+        (GeneratePropertiesHashTable):
+        Update for rename of GetConditionalForFunctionConsideringOverloads.
+
+        (AreTypesDistinguishableForOverloadResolution):
+        Remove unnecessary subroutine isDictionary that can be replaced by
+        a direct call to $codeGenerator->IsDictionaryType().
+
+        (GetConditionalForFunctionConsideringOverloads):
+        Renamed from getConditionalForFunctionConsideringOverloads.
+
+        (GenerateOverloadDispatcher):
+        Renamed from GenerateOverloadedFunctionOrConstructor. Moved Constructor/Operation/LegacyCaller
+        specific code out, and into parameters.
+
+        (GenerateImplementation):
+        Moved operation generation out into its own subroutine.
+
+        (GenerateOperationDefinition): Added.
+        Moved from GenerateImplementation.
+
+        (GenerateLegacyCallerDefinitions):
+        Pass function name and signature to GenerateOverloadDispatcher.
+
+        (GenerateArgumentsCountCheck):
+        Don't generate an argument check if this is an overloaded function. The argument
+        checks happen in the overload dispatcher.
+
+        (NeedsExplicitPropagateExceptionCall):
+        (GenerateParametersCheck):
+        (GenerateImplementationFunctionCall):
+        Replace IsReturningPromise with more direct check.
+
+        (GenerateConstructorDefinitions):
+        Pass function name and signature to GenerateOverloadDispatcher.
+
+        (getConditionalForFunctionConsideringOverloads): Renamed to GetConditionalForFunctionConsideringOverloads.
+        (GenerateOverloadedFunctionOrConstructor): Renamed to GenerateOverloadDispatcher.
+        (IsReturningPromise): Deleted.
+
+        * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
+        * bindings/scripts/test/JS/JSTestInterface.cpp:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/TestInterface.idl:
+        Update test results.
+
 2017-05-24  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r217319.
index 55395f1..00a8dad 100644 (file)
@@ -2193,7 +2193,7 @@ sub GenerateHeader
                 $inAppleCopyright = 0;
             }
 
-            my $conditionalAttribute = getConditionalForFunctionConsideringOverloads($function);
+            my $conditionalAttribute = GetConditionalForFunctionConsideringOverloads($function);
             my $conditionalString = $conditionalAttribute ? $codeGenerator->GenerateConditionalStringFromAttributeValue($conditionalAttribute) : undef;
             push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
             my $functionName = GetFunctionName($interface, $className, $function);
@@ -2403,7 +2403,7 @@ sub GeneratePropertiesHashTable
 
         push(@$hashSpecials, ComputeFunctionSpecial($interface, $function));
 
-        my $conditional = getConditionalForFunctionConsideringOverloads($function);
+        my $conditional = GetConditionalForFunctionConsideringOverloads($function);
         $conditionals->{$name} = $conditional if $conditional;
 
         if (NeedsRuntimeCheck($function)) {
@@ -2495,13 +2495,9 @@ sub AreTypesDistinguishableForOverloadResolution
 {
     my ($typeA, $typeB) = @_;
 
-    my $isDictionary = sub {
-        my $type = shift;
-        return $codeGenerator->IsDictionaryType($type);
-    };
     my $isCallbackFunctionOrDictionary = sub {
         my $type = shift;
-        return $codeGenerator->IsCallbackFunction($type) || &$isDictionary($type);
+        return $codeGenerator->IsCallbackFunction($type) || $codeGenerator->IsDictionaryType($type);
     };
 
     # Two types are distinguishable for overload resolution if at most one of the two includes a nullable type.
@@ -2527,7 +2523,7 @@ sub AreTypesDistinguishableForOverloadResolution
     return 0 if $typeA->name eq "object" or $typeB->name eq "object";
     return 0 if $codeGenerator->IsNumericType($typeA) && $codeGenerator->IsNumericType($typeB);
     return 0 if $codeGenerator->IsStringOrEnumType($typeA) && $codeGenerator->IsStringOrEnumType($typeB);
-    return 0 if &$isDictionary($typeA) && &$isDictionary($typeB);
+    return 0 if $codeGenerator->IsDictionaryType($typeA) && $codeGenerator->IsDictionaryType($typeB);
     return 0 if $codeGenerator->IsCallbackInterface($typeA) && $codeGenerator->IsCallbackInterface($typeB);
     return 0 if &$isCallbackFunctionOrDictionary($typeA) && &$isCallbackFunctionOrDictionary($typeB);
     return 0 if $codeGenerator->IsSequenceOrFrozenArrayType($typeA) && $codeGenerator->IsSequenceOrFrozenArrayType($typeB);
@@ -2580,7 +2576,7 @@ sub GetOverloadThatMatchesIgnoringUnionSubtypes
     }
 }
 
-sub getConditionalForFunctionConsideringOverloads
+sub GetConditionalForFunctionConsideringOverloads
 {
     my $function = shift;
 
@@ -2597,30 +2593,19 @@ sub getConditionalForFunctionConsideringOverloads
 
 # Implements the overload resolution algorithm, as defined in the Web IDL specification:
 # http://heycam.github.io/webidl/#es-overloads
-sub GenerateOverloadedFunctionOrConstructor
+sub GenerateOverloadDispatcher
 {
-    my ($function, $interface, $variant) = @_;
+    my ($function, $interface, $overloadFunctionPrefix, $functionSignature) = @_;
+    
     my %allSets = ComputeEffectiveOverloadSet($function->{overloads});
 
-    my $interfaceName = $interface->type->name;
-    my $className = "JS$interfaceName";
-    my $functionName;
-    if ($variant eq "constructor") {
-        $functionName = "construct${className}";
-    } elsif ($variant eq "legacycaller") {
-        $functionName = "call${className}";
-    } else {
-        my $kind = $function->isStatic ? "Constructor" : (OperationShouldBeOnInstance($interface, $function) ? "Instance" : "Prototype");
-        $functionName = "js${interfaceName}${kind}Function" . $codeGenerator->WK_ucfirst($function->name);
-    }
-
     my $generateOverloadCallIfNecessary = sub {
         my ($overload, $condition, $include) = @_;
         return unless $overload;
         my $conditionalString = $codeGenerator->GenerateConditionalString($overload);
         push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
         push(@implContent, "        if ($condition)\n    ") if $condition;
-        push(@implContent, "        return ${functionName}$overload->{overloadIndex}(state);\n");
+        push(@implContent, "        return ${overloadFunctionPrefix}" . $overload->{overloadIndex} . "(state);\n");
         push(@implContent, "#endif\n") if $conditionalString;
         AddToImplIncludes($include, $overload->extendedAttributes->{"Conditional"}) if $include;
     };
@@ -2691,14 +2676,10 @@ sub GenerateOverloadedFunctionOrConstructor
 
     my $maxArgCount = LengthOfLongestFunctionParameterList($function->{overloads});
 
-    my $conditionalAttribute = getConditionalForFunctionConsideringOverloads($function);
+    my $conditionalAttribute = GetConditionalForFunctionConsideringOverloads($function);
     my $conditionalString = $conditionalAttribute ? $codeGenerator->GenerateConditionalStringFromAttributeValue($conditionalAttribute) : undef;
     push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
-    if ($variant eq "constructor") {
-        push(@implContent, "template<> EncodedJSValue JSC_HOST_CALL ${className}Constructor::construct(ExecState* state)\n");
-    } else {
-        push(@implContent, "EncodedJSValue JSC_HOST_CALL ${functionName}(ExecState* state)\n");
-    }
+    push(@implContent, "$functionSignature\n");
     push(@implContent, <<END);    
 {
     VM& vm = state->vm();
@@ -3132,7 +3113,7 @@ sub GenerateImplementation
                 $inAppleCopyright = 0;
             }
 
-            my $conditionalAttribute = getConditionalForFunctionConsideringOverloads($function);
+            my $conditionalAttribute = GetConditionalForFunctionConsideringOverloads($function);
             my $conditionalString = $conditionalAttribute ? $codeGenerator->GenerateConditionalStringFromAttributeValue($conditionalAttribute) : undef;
             push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
             my $functionName = GetFunctionName($interface, $className, $function);
@@ -3712,7 +3693,7 @@ sub GenerateImplementation
                 my $templateParameters = "${getFunctionName}Getter";
                 if ($attribute->extendedAttributes->{LenientThis}) {
                     $templateParameters .= ", CastedThisErrorBehavior::ReturnEarly";
-                } elsif (IsReturningPromise($attribute)) {
+                } elsif ($attribute->type->name eq "Promise") {
                     $templateParameters .= ", CastedThisErrorBehavior::RejectPromise";
                 }
 
@@ -4071,212 +4052,12 @@ sub GenerateImplementation
     # Functions
     if ($numFunctions > 0) {
         my $inAppleCopyright = 0;
-        foreach my $function (@functions) {
-            next if IsJSBuiltin($interface, $function);
-            next if $function->isIterable;
-            next if $function->isSerializer;
-            if ($function->extendedAttributes->{AppleCopyright}) {
-                if (!$inAppleCopyright) {
-                    push(@implContent, $beginAppleCopyrightForSourceFiles);
-                    $inAppleCopyright = 1;
-                }
-            } elsif ($inAppleCopyright) {
-                push(@implContent, $endAppleCopyright);
-                $inAppleCopyright = 0;
-            }
-
-            my $isCustom = HasCustomMethod($function->extendedAttributes);
-            my $isOverloaded = $function->{overloads} && @{$function->{overloads}} > 1;
-
-            next if $isCustom && $isOverloaded && $function->{overloadIndex} > 1;
-
-            AddToImplIncludesForIDLType($function->type) unless $isCustom or IsReturningPromise($function);
-
-            my $functionName = GetFunctionName($interface, $className, $function);
-
-            my $conditional = $function->extendedAttributes->{Conditional};
-            if ($conditional) {
-                my $conditionalString = $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional);
-                push(@implContent, "#if ${conditionalString}\n");
-            }
-
-            my $functionReturn = "EncodedJSValue JSC_HOST_CALL";
-            if (!$isCustom && $isOverloaded) {
-                # Append a number to an overloaded method's name to make it unique:
-                $functionName = $functionName . $function->{overloadIndex};
-                # Make this function static to avoid compiler warnings, since we don't generate a prototype for it in the header.
-                $functionReturn = "static inline EncodedJSValue";
-            }
-
-            my $functionImplementationName = $function->extendedAttributes->{ImplementedAs} || $codeGenerator->WK_lcfirst($function->name);
-
-            AddToImplIncludes("JSDOMPromiseDeferred.h") if IsReturningPromise($function);
-
-            if (!$function->isStatic) {
-                my $classParameterType = $className eq "JSEventTarget" ? "JSEventTargetWrapper*" : "${className}*";
-                my $optionalPromiseParameter = (IsReturningPromise($function) && !$isCustom) ? " Ref<DeferredPromise>&&," : "";
-                push(@implContent, "static inline JSC::EncodedJSValue ${functionName}Caller(JSC::ExecState*, ${classParameterType},${optionalPromiseParameter} JSC::ThrowScope&);\n");
-                push(@implContent, "\n");
-            }
-
-            if (IsReturningPromise($function) && !$isCustom) {
-                my $scope = $interface->extendedAttributes->{Exposed} ? "WindowOrWorker" : "WindowOnly";
-                push(@implContent, <<END);
-static EncodedJSValue ${functionName}Promise(ExecState*, Ref<DeferredPromise>&&);
-
-${functionReturn} ${functionName}(ExecState* state)
-{
-    ASSERT(state);
-    return JSValue::encode(callPromiseFunction<${functionName}Promise, PromiseExecutionScope::${scope}>(*state));
-}
-
-static inline EncodedJSValue ${functionName}Promise(ExecState* state, Ref<DeferredPromise>&& promise)
-END
-            } else {
-                push(@implContent, "${functionReturn} ${functionName}(ExecState* state)\n");
-            }
-
-            push(@implContent, "{\n");
-
-            $implIncludes{"<runtime/Error.h>"} = 1;
-
-            if ($function->extendedAttributes->{CEReactions}) {
-                push(@implContent, "    CustomElementReactionStack customElementReactionStack;\n");
-                $implIncludes{"CustomElementReactionQueue.h"} = 1;
-            }
-
-            if ($function->isStatic) {
-                if ($isCustom) {
-                    GenerateArgumentsCountCheck(\@implContent, $function, $interface);
-                    push(@implContent, "    return JSValue::encode(${className}::" . $functionImplementationName . "(state));\n");
-                } else {
-                    push(@implContent, "    VM& vm = state->vm();\n");
-                    push(@implContent, "    auto throwScope = DECLARE_THROW_SCOPE(vm);\n");
-                    push(@implContent, "    UNUSED_PARAM(throwScope);\n");
-
-                    GenerateArgumentsCountCheck(\@implContent, $function, $interface);
-
-                    my $functionString = GenerateParametersCheck(\@implContent, $function, $interface, $functionImplementationName);
-                    GenerateImplementationFunctionCall($function, $functionString, "    ", $interface);
-                }
-            } else {
-                my $methodName = $function->name;
-                if (IsReturningPromise($function) && !$isCustom) {
-                    my $templateParameters = "${functionName}Caller";
-                    $templateParameters .= ", CastedThisErrorBehavior::Assert" if ($function->extendedAttributes->{PrivateIdentifier} and not $function->extendedAttributes->{PublicIdentifier});
-                    push(@implContent, "    return BindingCaller<$className>::callPromiseOperation<${templateParameters}>(state, WTFMove(promise), \"${methodName}\");\n");
-                    push(@implContent, "}\n");
-                    push(@implContent, "\n");
-                    push(@implContent, "static inline JSC::EncodedJSValue ${functionName}Caller(JSC::ExecState* state, ${className}* castedThis, Ref<DeferredPromise>&& promise, JSC::ThrowScope& throwScope)\n");
-                } else {
-                    my $classParameterType = $className eq "JSEventTarget" ? "JSEventTargetWrapper*" : "${className}*";
-                    my $templateParameters = "${functionName}Caller";
-                    if ($function->extendedAttributes->{PrivateIdentifier} and not $function->extendedAttributes->{PublicIdentifier}) {
-                        $templateParameters .= ", CastedThisErrorBehavior::Assert";
-                    } elsif (IsReturningPromise($function)) {
-                        # FIXME: We need this specific handling for custom promise-returning functions.
-                        # It would be better to have the casted-this code calling the promise-specific code.
-                        $templateParameters .= ", CastedThisErrorBehavior::RejectPromise" if IsReturningPromise($function);
-                    }
-
-                    push(@implContent, "    return BindingCaller<$className>::callOperation<${templateParameters}>(state, \"${methodName}\");\n");
-                    push(@implContent, "}\n");
-                    push(@implContent, "\n");
-                    push(@implContent, "static inline JSC::EncodedJSValue ${functionName}Caller(JSC::ExecState* state, ${classParameterType} castedThis, JSC::ThrowScope& throwScope)\n");
-                }
-
-                push(@implContent, "{\n");
-                push(@implContent, "    UNUSED_PARAM(state);\n");
-                push(@implContent, "    UNUSED_PARAM(throwScope);\n");
-
-                if ($interface->extendedAttributes->{CheckSecurity} and !$function->extendedAttributes->{DoNotCheckSecurity}) {
-                    AddToImplIncludes("JSDOMBindingSecurity.h");
-                    if ($interfaceName eq "DOMWindow") {
-                        push(@implContent, "    if (!BindingSecurity::shouldAllowAccessToDOMWindow(state, castedThis->wrapped(), ThrowSecurityError))\n");
-                    } else {
-                        push(@implContent, "    if (!BindingSecurity::shouldAllowAccessToFrame(state, castedThis->wrapped().frame(), ThrowSecurityError))\n");
-                    }
-                    push(@implContent, "        return JSValue::encode(jsUndefined());\n");
-                }
-
-                if ($isCustom) {
-                    push(@implContent, "    return JSValue::encode(castedThis->" . $functionImplementationName . "(*state));\n");
-                } else {
-                    push(@implContent, "    auto& impl = castedThis->wrapped();\n") unless $function->isMapLike;
-
-                    GenerateArgumentsCountCheck(\@implContent, $function, $interface);
-
-                    my $functionString = GenerateParametersCheck(\@implContent, $function, $interface, $functionImplementationName);
-                    GenerateImplementationFunctionCall($function, $functionString, "    ", $interface);
-                }
-            }
-
-            push(@implContent, "}\n\n");
 
-            if ($function->extendedAttributes->{DOMJIT}) {
-                $implIncludes{"<interpreter/FrameTracers.h>"} = 1;
-                my $unsafeFunctionName = "unsafe" . $codeGenerator->WK_ucfirst($functionName);
-                push(@implContent, "JSC::EncodedJSValue JIT_OPERATION ${unsafeFunctionName}(JSC::ExecState* state, $className* castedThis");
-                foreach my $argument (@{$function->arguments}) {
-                    my $type = $argument->type;
-                    my $argumentType = GetUnsafeArgumentType($interface, $type);
-                    my $name = $argument->name;
-                    my $encodedName = "encoded" . $codeGenerator->WK_ucfirst($name);
-                    push(@implContent, ", ${argumentType} ${encodedName}");
-                }
-                push(@implContent, ")\n");
-                push(@implContent, "{\n");
-                push(@implContent, "    UNUSED_PARAM(state);\n");
-                push(@implContent, "    VM& vm = state->vm();\n");
-                push(@implContent, "    JSC::NativeCallFrameTracer tracer(&vm, state);\n");
-                push(@implContent, "    auto throwScope = DECLARE_THROW_SCOPE(vm);\n");
-                push(@implContent, "    UNUSED_PARAM(throwScope);\n");
-                push(@implContent, "    auto& impl = castedThis->wrapped();\n");
-                my @arguments;
-                my $implFunctionName;
-                my $implementedBy = $function->extendedAttributes->{ImplementedBy};
-
-                if ($implementedBy) {
-                    AddToImplIncludes("${implementedBy}.h", $function->extendedAttributes->{Conditional});
-                    unshift(@arguments, "impl") if !$function->isStatic;
-                    $implFunctionName = "WebCore::${implementedBy}::${functionImplementationName}";
-                } elsif ($function->isStatic) {
-                    $implFunctionName = "${interfaceName}::${functionImplementationName}";
-                } else {
-                    $implFunctionName = "impl.${functionImplementationName}";
-                }
-
-                foreach my $argument (@{$function->arguments}) {
-                    my $value = "";
-                    my $type = $argument->type;
-                    my $name = $argument->name;
-                    my $encodedName = "encoded" . $codeGenerator->WK_ucfirst($name);
-                    my $shouldPassByReference = ShouldPassArgumentByReference($argument);
-
-                    my ($nativeValue, $mayThrowException) = UnsafeToNative($interface, $argument, $encodedName, $function->extendedAttributes->{Conditional});
-                    push(@implContent, "    auto $name = ${nativeValue};\n");
-                    push(@implContent, "    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n") if $mayThrowException;
-                    $value = "WTFMove($name)";
-
-                    if ($shouldPassByReference) {
-                        $value = "*$name";
-                    }
-                    push(@arguments, $value);
-                }
-                my $functionString = "$implFunctionName(" . join(", ", @arguments) . ")";
-                $functionString = "propagateException(*state, throwScope, $functionString)" if NeedsExplicitPropagateExceptionCall($function);
-                push(@implContent, "    return JSValue::encode(" . NativeToJSValueUsingPointers($function, $interface, $functionString, "*castedThis->globalObject()") . ");\n");
-                push(@implContent, "}\n\n");
-            }
-
-            push(@implContent, "#endif\n\n") if $conditional;
-
-            # Generate a function dispatching call to the rest of the overloads.
-            GenerateOverloadedFunctionOrConstructor($function, $interface, "operation") if !$isCustom && $isOverloaded && $function->{overloadIndex} == @{$function->{overloads}};
+        foreach my $function (@functions) {
+            GenerateOperationDefinition($interface, $className, $function);
         }
 
         push(@implContent, $endAppleCopyright) if $inAppleCopyright;
-
     }
 
     GenerateLegacyCallerDefinitions($interface, $className);
@@ -4511,6 +4292,223 @@ END
     push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString;
 }
 
+sub GenerateOperationDefinition
+{
+    my ($interface, $className, $operation) = @_;
+
+    return if IsJSBuiltin($interface, $operation);
+    return if $operation->isIterable;
+    return if $operation->isSerializer;
+
+    my $isCustom = HasCustomMethod($operation->extendedAttributes);
+    my $isOverloaded = $operation->{overloads} && @{$operation->{overloads}} > 1;
+
+    return if $isCustom && $isOverloaded && $operation->{overloadIndex} > 1;
+
+    my $inAppleCopyright = 0;
+
+    if ($operation->extendedAttributes->{AppleCopyright}) {
+        if (!$inAppleCopyright) {
+            push(@implContent, $beginAppleCopyrightForSourceFiles);
+            $inAppleCopyright = 1;
+        }
+    } elsif ($inAppleCopyright) {
+        push(@implContent, $endAppleCopyright);
+        $inAppleCopyright = 0;
+    }
+
+    my $conditional = $operation->extendedAttributes->{Conditional};
+    if ($conditional) {
+        my $conditionalString = $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional);
+        push(@implContent, "#if ${conditionalString}\n");
+    }
+
+    my $hasPromiseReturnType = $operation->type->name eq "Promise";
+
+    AddToImplIncludesForIDLType($operation->type, $conditional) unless $isCustom or $hasPromiseReturnType;
+    AddToImplIncludes("JSDOMPromiseDeferred.h", $conditional) if $hasPromiseReturnType;
+    AddToImplIncludes("<runtime/Error.h>", $conditional);
+
+    my $functionName = GetFunctionName($interface, $className, $operation);
+    my $functionReturn = "EncodedJSValue JSC_HOST_CALL";
+
+    if (!$isCustom && $isOverloaded) {
+        # Append a number to an overloaded method's name to make it unique:
+        $functionName = $functionName . $operation->{overloadIndex};
+        # Make this function static to avoid compiler warnings, since we don't generate a prototype for it in the header.
+        $functionReturn = "static inline EncodedJSValue";
+    }
+
+    my $functionImplementationName = $operation->extendedAttributes->{ImplementedAs} || $codeGenerator->WK_lcfirst($operation->name);
+
+    if (!$operation->isStatic) {
+        my $classParameterType = $className eq "JSEventTarget" ? "JSEventTargetWrapper*" : "${className}*";
+        my $optionalPromiseParameter = ($hasPromiseReturnType && !$isCustom) ? " Ref<DeferredPromise>&&," : "";
+        push(@implContent, "static inline JSC::EncodedJSValue ${functionName}Caller(JSC::ExecState*, ${classParameterType},${optionalPromiseParameter} JSC::ThrowScope&);\n");
+        push(@implContent, "\n");
+    }
+
+    if ($hasPromiseReturnType && !$isCustom) {
+        my $scope = $interface->extendedAttributes->{Exposed} ? "WindowOrWorker" : "WindowOnly";
+        push(@implContent, "static EncodedJSValue ${functionName}Promise(ExecState*, Ref<DeferredPromise>&&);\n");
+        push(@implContent, "\n");
+        push(@implContent, "${functionReturn} ${functionName}(ExecState* state)\n");
+        push(@implContent, "{\n");
+        push(@implContent, "    ASSERT(state);\n");
+        push(@implContent, "    return JSValue::encode(callPromiseFunction<${functionName}Promise, PromiseExecutionScope::${scope}>(*state));\n");
+        push(@implContent, "}\n");
+        push(@implContent, "\n");
+        push(@implContent, "static inline EncodedJSValue ${functionName}Promise(ExecState* state, Ref<DeferredPromise>&& promise)\n");
+    } else {
+        push(@implContent, "${functionReturn} ${functionName}(ExecState* state)\n");
+    }
+
+    push(@implContent, "{\n");
+
+
+    if ($operation->extendedAttributes->{CEReactions}) {
+        push(@implContent, "    CustomElementReactionStack customElementReactionStack;\n");
+        $implIncludes{"CustomElementReactionQueue.h"} = 1;
+    }
+
+    if ($operation->isStatic) {
+        if ($isCustom) {
+            GenerateArgumentsCountCheck(\@implContent, $operation, $interface);
+            push(@implContent, "    return JSValue::encode(${className}::" . $functionImplementationName . "(state));\n");
+        } else {
+            push(@implContent, "    VM& vm = state->vm();\n");
+            push(@implContent, "    auto throwScope = DECLARE_THROW_SCOPE(vm);\n");
+            push(@implContent, "    UNUSED_PARAM(throwScope);\n");
+
+            GenerateArgumentsCountCheck(\@implContent, $operation, $interface);
+
+            my $functionString = GenerateParametersCheck(\@implContent, $operation, $interface, $functionImplementationName);
+            GenerateImplementationFunctionCall($operation, $functionString, "    ", $interface);
+        }
+    } else {
+        my $methodName = $operation->name;
+
+        if ($hasPromiseReturnType && !$isCustom) {
+            my $templateParameters = "${functionName}Caller";
+            $templateParameters .= ", CastedThisErrorBehavior::Assert" if ($operation->extendedAttributes->{PrivateIdentifier} and not $operation->extendedAttributes->{PublicIdentifier});
+            push(@implContent, "    return BindingCaller<$className>::callPromiseOperation<${templateParameters}>(state, WTFMove(promise), \"${methodName}\");\n");
+            push(@implContent, "}\n");
+            push(@implContent, "\n");
+            push(@implContent, "static inline JSC::EncodedJSValue ${functionName}Caller(JSC::ExecState* state, ${className}* castedThis, Ref<DeferredPromise>&& promise, JSC::ThrowScope& throwScope)\n");
+        } else {
+            my $classParameterType = $className eq "JSEventTarget" ? "JSEventTargetWrapper*" : "${className}*";
+            my $templateParameters = "${functionName}Caller";
+            if ($operation->extendedAttributes->{PrivateIdentifier} and not $operation->extendedAttributes->{PublicIdentifier}) {
+                $templateParameters .= ", CastedThisErrorBehavior::Assert";
+            } elsif ($hasPromiseReturnType) {
+                # FIXME: We need this specific handling for custom promise-returning functions.
+                # It would be better to have the casted-this code calling the promise-specific code.
+                $templateParameters .= ", CastedThisErrorBehavior::RejectPromise";
+            }
+
+            push(@implContent, "    return BindingCaller<$className>::callOperation<${templateParameters}>(state, \"${methodName}\");\n");
+            push(@implContent, "}\n");
+            push(@implContent, "\n");
+            push(@implContent, "static inline JSC::EncodedJSValue ${functionName}Caller(JSC::ExecState* state, ${classParameterType} castedThis, JSC::ThrowScope& throwScope)\n");
+        }
+
+        push(@implContent, "{\n");
+        push(@implContent, "    UNUSED_PARAM(state);\n");
+        push(@implContent, "    UNUSED_PARAM(throwScope);\n");
+
+        if ($interface->extendedAttributes->{CheckSecurity} and !$operation->extendedAttributes->{DoNotCheckSecurity}) {
+            AddToImplIncludes("JSDOMBindingSecurity.h");
+            if ($interface->type->name eq "DOMWindow") {
+                push(@implContent, "    if (!BindingSecurity::shouldAllowAccessToDOMWindow(state, castedThis->wrapped(), ThrowSecurityError))\n");
+            } else {
+                push(@implContent, "    if (!BindingSecurity::shouldAllowAccessToFrame(state, castedThis->wrapped().frame(), ThrowSecurityError))\n");
+            }
+            push(@implContent, "        return JSValue::encode(jsUndefined());\n");
+        }
+
+        if ($isCustom) {
+            push(@implContent, "    return JSValue::encode(castedThis->" . $functionImplementationName . "(*state));\n");
+        } else {
+            push(@implContent, "    auto& impl = castedThis->wrapped();\n") unless $operation->isMapLike;
+
+            GenerateArgumentsCountCheck(\@implContent, $operation, $interface);
+
+            my $functionString = GenerateParametersCheck(\@implContent, $operation, $interface, $functionImplementationName);
+            GenerateImplementationFunctionCall($operation, $functionString, "    ", $interface);
+        }
+    }
+
+    push(@implContent, "}\n\n");
+
+    if ($operation->extendedAttributes->{DOMJIT}) {
+        $implIncludes{"<interpreter/FrameTracers.h>"} = 1;
+        my $unsafeFunctionName = "unsafe" . $codeGenerator->WK_ucfirst($functionName);
+        push(@implContent, "JSC::EncodedJSValue JIT_OPERATION ${unsafeFunctionName}(JSC::ExecState* state, $className* castedThis");
+        foreach my $argument (@{$operation->arguments}) {
+            my $type = $argument->type;
+            my $argumentType = GetUnsafeArgumentType($interface, $type);
+            my $name = $argument->name;
+            my $encodedName = "encoded" . $codeGenerator->WK_ucfirst($name);
+            push(@implContent, ", ${argumentType} ${encodedName}");
+        }
+        push(@implContent, ")\n");
+        push(@implContent, "{\n");
+        push(@implContent, "    UNUSED_PARAM(state);\n");
+        push(@implContent, "    VM& vm = state->vm();\n");
+        push(@implContent, "    JSC::NativeCallFrameTracer tracer(&vm, state);\n");
+        push(@implContent, "    auto throwScope = DECLARE_THROW_SCOPE(vm);\n");
+        push(@implContent, "    UNUSED_PARAM(throwScope);\n");
+        push(@implContent, "    auto& impl = castedThis->wrapped();\n");
+        my @arguments;
+        my $implFunctionName;
+        my $implementedBy = $operation->extendedAttributes->{ImplementedBy};
+
+        if ($implementedBy) {
+            AddToImplIncludes("${implementedBy}.h", $operation->extendedAttributes->{Conditional});
+            unshift(@arguments, "impl") if !$operation->isStatic;
+            $implFunctionName = "WebCore::" . $implementedBy . "::" . $functionImplementationName;
+        } elsif ($operation->isStatic) {
+            $implFunctionName = $interface->type->name . "::" . $functionImplementationName;
+        } else {
+            $implFunctionName = "impl." . $functionImplementationName;
+        }
+
+        foreach my $argument (@{$operation->arguments}) {
+            my $value = "";
+            my $type = $argument->type;
+            my $name = $argument->name;
+            my $encodedName = "encoded" . $codeGenerator->WK_ucfirst($name);
+            my $shouldPassByReference = ShouldPassArgumentByReference($argument);
+
+            my ($nativeValue, $mayThrowException) = UnsafeToNative($interface, $argument, $encodedName, $operation->extendedAttributes->{Conditional});
+            push(@implContent, "    auto $name = ${nativeValue};\n");
+            push(@implContent, "    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n") if $mayThrowException;
+            $value = "WTFMove($name)";
+
+            if ($shouldPassByReference) {
+                $value = "*$name";
+            }
+            push(@arguments, $value);
+        }
+        my $functionString = "$implFunctionName(" . join(", ", @arguments) . ")";
+        $functionString = "propagateException(*state, throwScope, $functionString)" if NeedsExplicitPropagateExceptionCall($operation);
+        push(@implContent, "    return JSValue::encode(" . NativeToJSValueUsingPointers($operation, $interface, $functionString, "*castedThis->globalObject()") . ");\n");
+        push(@implContent, "}\n\n");
+    }
+
+    push(@implContent, "#endif\n\n") if $conditional;
+
+    # Generate a function dispatching call to the rest of the overloads.
+    if (!$isCustom && $isOverloaded && $operation->{overloadIndex} == @{$operation->{overloads}}) {
+        my $overloadDispatcherFunctionName = GetFunctionName($interface, $className, $operation);
+        my $overloadDispatcherFunctionSignature = "EncodedJSValue JSC_HOST_CALL ${overloadDispatcherFunctionName}(ExecState* state)";
+
+        GenerateOverloadDispatcher($operation, $interface, $overloadDispatcherFunctionName, $overloadDispatcherFunctionSignature);
+    }
+
+    push(@implContent, $endAppleCopyright) if $inAppleCopyright;
+}
+
 sub GenerateSerializerFunction
 {
     my ($interface, $className) = @_;
@@ -4601,7 +4599,11 @@ sub GenerateLegacyCallerDefinitions
         foreach my $legacyCaller (@legacyCallers) {
             GenerateLegacyCallerDefinition($interface, $className, $legacyCaller);
         }
-        GenerateOverloadedFunctionOrConstructor($legacyCallers[0], $interface, "legacycaller");
+
+        my $overloadDispatcherFunctionName = "call${className}";
+        my $overloadDispatcherFunctionSignature = "EncodedJSValue JSC_HOST_CALL ${overloadDispatcherFunctionName}(ExecState* state)";
+
+        GenerateOverloadDispatcher($legacyCallers[0], $interface, $overloadDispatcherFunctionName, $overloadDispatcherFunctionSignature);
     } else {
         GenerateLegacyCallerDefinition($interface, $className, $legacyCallers[0]);
     }
@@ -4739,9 +4741,11 @@ sub GenerateCallWith
 
 sub GenerateArgumentsCountCheck
 {
-    my $outputArray = shift;
-    my $function = shift;
-    my $interface = shift;
+    my ($outputArray, $function, $interface) = @_;
+
+    # Overloaded functions don't need to check the argument count since the 
+    # dispatch function does for them.
+    return if $function->{overloads} && @{$function->{overloads}} > 1;
 
     my $numMandatoryArguments = @{$function->arguments};
     foreach my $argument (reverse(@{$function->arguments})) {
@@ -4804,10 +4808,7 @@ sub NeedsExplicitPropagateExceptionCall
 
     return 0 unless $function->extendedAttributes->{MayThrowException};
 
-    return 1 if $function->type && $function->type->name eq "void";
-    return 1 if IsReturningPromise($function);
-
-    return 0;
+    return $function->type && ($function->type->name eq "void" || $function->type->name eq "Promise");
 }
 
 sub GenerateParametersCheck
@@ -4933,7 +4934,7 @@ sub GenerateParametersCheck
         $argumentIndex++;
     }
 
-    push(@arguments, "WTFMove(promise)") if IsReturningPromise($function);
+    push(@arguments, "WTFMove(promise)") if $function->type && $function->type->name eq "Promise";
 
     my $functionString = "$functionName(" . join(", ", @arguments) . ")";
     $functionString = "propagateException(*state, throwScope, $functionString)" if NeedsExplicitPropagateExceptionCall($function);
@@ -5333,7 +5334,7 @@ sub GenerateImplementationFunctionCall
 {
     my ($function, $functionString, $indent, $interface) = @_;
 
-    if ($function->type->name eq "void" || IsReturningPromise($function)) {
+    if ($function->type->name eq "void" || $function->type->name eq "Promise") {
         push(@implContent, $indent . "$functionString;\n");
         push(@implContent, $indent . "return JSValue::encode(jsUndefined());\n");
     } else {
@@ -6171,7 +6172,11 @@ sub GenerateConstructorDefinitions
             foreach my $constructor (@constructors) {
                 GenerateConstructorDefinition($outputArray, $className, $protoClassName, $visibleInterfaceName, $interface, $generatingNamedConstructor, $constructor);
             }
-            GenerateOverloadedFunctionOrConstructor(@{$interface->constructors}[0], $interface, "constructor");
+
+            my $overloadDispatcherFunctionName = "construct${className}";
+            my $overloadDispatcherFunctionSignature = "template<> EncodedJSValue JSC_HOST_CALL ${className}Constructor::construct(ExecState* state)";
+
+            GenerateOverloadDispatcher(@{$interface->constructors}[0], $interface, $overloadDispatcherFunctionName, $overloadDispatcherFunctionSignature);
         } elsif (@constructors == 1) {
             GenerateConstructorDefinition($outputArray, $className, $protoClassName, $visibleInterfaceName, $interface, $generatingNamedConstructor, $constructors[0]);
         } else {
@@ -6354,12 +6359,6 @@ sub NeedsConstructorProperty
     return !$interface->extendedAttributes->{NoInterfaceObject} || $interface->extendedAttributes->{CustomConstructor};
 }
 
-sub IsReturningPromise
-{
-    my $function = shift;
-    return $function->type && $function->type->name eq "Promise";
-}
-
 sub IsConstructable
 {
     my $interface = shift;
index 6a40c5c..0706673 100644 (file)
@@ -409,8 +409,6 @@ static inline JSC::EncodedJSValue jsTestGlobalObjectInstanceFunctionEnabledAtRun
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto testParam = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.enabledAtRuntimeOperation(WTFMove(testParam));
@@ -432,8 +430,6 @@ static inline JSC::EncodedJSValue jsTestGlobalObjectInstanceFunctionEnabledAtRun
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto testParam = convert<IDLLong>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.enabledAtRuntimeOperation(WTFMove(testParam));
index ddd435e..3762c4e 100644 (file)
@@ -30,7 +30,6 @@
 #include "JSDOMConvert.h"
 #include "JSDOMExceptionHandling.h"
 #include "JSDOMWrapperCache.h"
-#include "JSTestObj.h"
 #include "TestSupplemental.h"
 #include <runtime/Error.h>
 #include <runtime/FunctionPrototype.h>
@@ -42,6 +41,7 @@
 
 #if ENABLE(Condition11) || ENABLE(Condition12) || ENABLE(Condition22) || ENABLE(Condition23)
 #include "JSNode.h"
+#include "JSTestObj.h"
 #endif
 
 using namespace JSC;
index 8323a10..f743abc 100644 (file)
@@ -5221,8 +5221,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionEnabledAtRuntimeOper
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto testParam = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.enabledAtRuntimeOperation(WTFMove(testParam));
@@ -5244,8 +5242,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionEnabledAtRuntimeOper
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto testParam = convert<IDLLong>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.enabledAtRuntimeOperation(WTFMove(testParam));
@@ -7033,8 +7029,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod1Cal
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 2))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto objArg = convert<IDLNullable<IDLInterface<TestObj>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "objArg", "TestObject", "overloadedMethod", "TestObj"); });
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(1));
@@ -7055,8 +7049,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod2Cal
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto objArg = convert<IDLNullable<IDLInterface<TestObj>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "objArg", "TestObject", "overloadedMethod", "TestObj"); });
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     auto longArg = state->argument(1).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(1)));
@@ -7077,8 +7069,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod3Cal
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadedMethod(WTFMove(strArg));
@@ -7097,8 +7087,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod4Cal
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto longArg = convert<IDLLong>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadedMethod(WTFMove(longArg));
@@ -7117,8 +7105,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod5Cal
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto callback = convert<IDLCallbackInterface<JSTestCallbackInterface>>(*state, state->uncheckedArgument(0), *castedThis->globalObject(), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentMustBeFunctionError(state, scope, 0, "callback", "TestObject", "overloadedMethod"); });
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadedMethod(callback.releaseNonNull());
@@ -7137,8 +7123,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod6Cal
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto listArg = convert<IDLNullable<IDLInterface<DOMStringList>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "listArg", "TestObject", "overloadedMethod", "DOMStringList"); });
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadedMethod(WTFMove(listArg));
@@ -7157,8 +7141,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod7Cal
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto arrayArg = convert<IDLNullable<IDLSequence<IDLDOMString>>>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadedMethod(WTFMove(arrayArg));
@@ -7177,8 +7159,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod8Cal
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto objArg = convert<IDLInterface<TestObj>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "objArg", "TestObject", "overloadedMethod", "TestObj"); });
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadedMethod(*objArg);
@@ -7197,8 +7177,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod9Cal
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto window = convert<IDLInterface<DOMWindow>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "window", "TestObject", "overloadedMethod", "DOMWindow"); });
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadedMethod(*window);
@@ -7217,8 +7195,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod10Ca
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto arrayArg = convert<IDLSequence<IDLDOMString>>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadedMethod(WTFMove(arrayArg));
@@ -7237,8 +7213,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod11Ca
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto arrayArg = convert<IDLSequence<IDLUnsignedLong>>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadedMethod(WTFMove(arrayArg));
@@ -7257,8 +7231,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethod12Ca
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadedMethod(WTFMove(strArg));
@@ -7341,8 +7313,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethodWith
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     auto objArg = convert<IDLNullable<IDLInterface<TestObj>>>(*state, state->argument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 1, "objArg", "TestObject", "overloadedMethodWithOptionalParameter", "TestObj"); });
@@ -7363,8 +7333,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethodWith
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto objArg = convert<IDLNullable<IDLInterface<TestObj>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "objArg", "TestObject", "overloadedMethodWithOptionalParameter", "TestObj"); });
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     auto longArg = state->argument(1).isUndefined() ? std::optional<Converter<IDLLong>::ReturnType>() : std::optional<Converter<IDLLong>::ReturnType>(convert<IDLLong>(*state, state->uncheckedArgument(1)));
@@ -7410,8 +7378,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethodWith
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto objectOrNode = convert<IDLUnion<IDLInterface<TestObj>, IDLInterface<TestNode>>>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadedMethodWithDistinguishingUnion(WTFMove(objectOrNode));
@@ -7430,8 +7396,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethodWith
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto value = convert<IDLLong>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadedMethodWithDistinguishingUnion(WTFMove(value));
@@ -7469,8 +7433,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethodWith
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto objectOrNode = convert<IDLUnion<IDLInterface<TestObj>, IDLInterface<TestNode>>>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadedMethodWith2DistinguishingUnions(WTFMove(objectOrNode));
@@ -7489,8 +7451,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethodWith
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto value = convert<IDLUnion<IDLInterface<TestInterface>, IDLDOMString, IDLLong>>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadedMethodWith2DistinguishingUnions(WTFMove(value));
@@ -7530,8 +7490,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethodWith
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 2))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto objectOrNode = convert<IDLUnion<IDLInterface<TestObj>, IDLInterface<TestNode>>>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     auto object = convert<IDLInterface<TestObj>>(*state, state->uncheckedArgument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 1, "object", "TestObject", "overloadedMethodWithNonDistinguishingUnion", "TestObj"); });
@@ -7552,8 +7510,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadedMethodWith
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 2))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto objectOrNode = convert<IDLUnion<IDLInterface<TestObj>, IDLInterface<TestNode>>>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     auto node = convert<IDLInterface<TestNode>>(*state, state->uncheckedArgument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 1, "node", "TestObject", "overloadedMethodWithNonDistinguishingUnion", "TestNode"); });
@@ -7590,8 +7546,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadWithNullable
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto objectOrNode = convert<IDLNullable<IDLUnion<IDLInterface<TestObj>, IDLInterface<TestNode>>>>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadWithNullableUnion(WTFMove(objectOrNode));
@@ -7610,8 +7564,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadWithNullable
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto index = convert<IDLLong>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadWithNullableUnion(WTFMove(index));
@@ -7669,8 +7621,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadWithOptional
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto index = convert<IDLLong>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.overloadWithOptionalUnion(WTFMove(index));
@@ -7711,8 +7661,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadWithNullable
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 2))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto obj = convert<IDLNullable<IDLInterface<TestObj>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "obj", "TestObject", "overloadWithNullableNonDistinguishingParameter", "TestObj"); });
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     auto node = convert<IDLInterface<TestNode>>(*state, state->uncheckedArgument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 1, "node", "TestObject", "overloadWithNullableNonDistinguishingParameter", "TestNode"); });
@@ -7733,8 +7681,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionOverloadWithNullable
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 2))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto node = convert<IDLNullable<IDLInterface<TestNode>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "node", "TestObject", "overloadWithNullableNonDistinguishingParameter", "TestNode"); });
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     auto index = convert<IDLLong>(*state, state->uncheckedArgument(1));
@@ -7792,8 +7738,6 @@ static inline EncodedJSValue jsTestObjConstructorFunctionOverloadedMethod11(Exec
     VM& vm = state->vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
     UNUSED_PARAM(throwScope);
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto arg = convert<IDLLong>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     TestObj::overloadedMethod1(WTFMove(arg));
@@ -7808,8 +7752,6 @@ static inline EncodedJSValue jsTestObjConstructorFunctionOverloadedMethod12(Exec
     VM& vm = state->vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
     UNUSED_PARAM(throwScope);
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto type = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     TestObj::overloadedMethod1(WTFMove(type));
@@ -8394,8 +8336,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloade
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto a = convert<IDLFloat>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.testPromiseOverloadedFunction(WTFMove(a), WTFMove(promise));
@@ -8422,8 +8362,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloade
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto request = convert<IDLInterface<FetchRequest>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "request", "TestObject", "testPromiseOverloadedFunction", "FetchRequest"); });
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.testPromiseOverloadedFunction(*request, WTFMove(promise));
@@ -8508,8 +8446,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionConditionalOverload1
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto str = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.conditionalOverload(WTFMove(str));
@@ -8531,8 +8467,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionConditionalOverload2
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto a = convert<IDLLong>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.conditionalOverload(WTFMove(a));
@@ -8574,8 +8508,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionSingleConditionalOve
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto str = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.singleConditionalOverload(WTFMove(str));
@@ -8595,8 +8527,6 @@ static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionSingleConditionalOve
     UNUSED_PARAM(state);
     UNUSED_PARAM(throwScope);
     auto& impl = castedThis->wrapped();
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto a = convert<IDLLong>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     impl.singleConditionalOverload(WTFMove(a));
@@ -8722,8 +8652,6 @@ static inline EncodedJSValue callJSTestObj1(ExecState* state)
     VM& vm = state->vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
     UNUSED_PARAM(throwScope);
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto* castedThis = jsCast<JSTestObj*>(state->jsCallee());
     ASSERT(castedThis);
     auto& impl = castedThis->wrapped();
@@ -8738,8 +8666,6 @@ static inline EncodedJSValue callJSTestObj2(ExecState* state)
     VM& vm = state->vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
     UNUSED_PARAM(throwScope);
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto* castedThis = jsCast<JSTestObj*>(state->jsCallee());
     ASSERT(castedThis);
     auto& impl = castedThis->wrapped();
index 4c5a455..2ec2159 100644 (file)
@@ -76,8 +76,6 @@ static inline EncodedJSValue constructJSTestOverloadedConstructors1(ExecState* s
     UNUSED_PARAM(throwScope);
     auto* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(state->jsCallee());
     ASSERT(castedThis);
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto arrayBuffer = convert<IDLInterface<ArrayBuffer>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "arrayBuffer", "TestOverloadedConstructors", nullptr, "ArrayBuffer"); });
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     auto object = TestOverloadedConstructors::create(*arrayBuffer);
@@ -91,8 +89,6 @@ static inline EncodedJSValue constructJSTestOverloadedConstructors2(ExecState* s
     UNUSED_PARAM(throwScope);
     auto* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(state->jsCallee());
     ASSERT(castedThis);
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto arrayBufferView = convert<IDLInterface<ArrayBufferView>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "arrayBufferView", "TestOverloadedConstructors", nullptr, "ArrayBufferView"); });
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     auto object = TestOverloadedConstructors::create(arrayBufferView.releaseNonNull());
@@ -106,8 +102,6 @@ static inline EncodedJSValue constructJSTestOverloadedConstructors3(ExecState* s
     UNUSED_PARAM(throwScope);
     auto* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(state->jsCallee());
     ASSERT(castedThis);
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto blob = convert<IDLInterface<Blob>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "blob", "TestOverloadedConstructors", nullptr, "Blob"); });
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     auto object = TestOverloadedConstructors::create(*blob);
@@ -121,8 +115,6 @@ static inline EncodedJSValue constructJSTestOverloadedConstructors4(ExecState* s
     UNUSED_PARAM(throwScope);
     auto* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(state->jsCallee());
     ASSERT(castedThis);
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto string = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     auto object = TestOverloadedConstructors::create(WTFMove(string));
index 393a6d0..3917576 100644 (file)
@@ -89,8 +89,6 @@ static inline EncodedJSValue constructJSTestOverloadedConstructorsWithSequence2(
     UNUSED_PARAM(throwScope);
     auto* castedThis = jsCast<JSTestOverloadedConstructorsWithSequenceConstructor*>(state->jsCallee());
     ASSERT(castedThis);
-    if (UNLIKELY(state->argumentCount() < 1))
-        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
     auto string = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
     auto object = TestOverloadedConstructorsWithSequence::create(WTFMove(string));
index 5184420..558a3c2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 2010 Google Inc. All rights reserved.
  *
- * Redistribution and use in source and binary formstrArg, with or without
+ * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
@@ -15,7 +15,7 @@
  *     from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIEstrArg, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
@@ -27,7 +27,7 @@
  */
 
 // This IDL file is for testing the bindings code generator and for tracking
-// changes in its ouput.
+// changes in its output.
 [
     ActiveDOMObject,
     CustomNamedSetter,