diff options
author | Ben Murdoch <benm@google.com> | 2010-06-15 19:36:43 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-06-16 14:52:28 +0100 |
commit | 545e470e52f0ac6a3a072bf559c796b42c6066b6 (patch) | |
tree | c0c14763654d84d37577dde512c3d3b4699a9e86 /WebCore/bindings/scripts | |
parent | 719298a66237d38ea5c05f1547123ad8aacbc237 (diff) | |
download | external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.zip external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.gz external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.bz2 |
Merge webkit.org at r61121: Initial merge by git.
Change-Id: Icd6db395c62285be384d137164d95d7466c98760
Diffstat (limited to 'WebCore/bindings/scripts')
27 files changed, 2633 insertions, 508 deletions
diff --git a/WebCore/bindings/scripts/CodeGenerator.pm b/WebCore/bindings/scripts/CodeGenerator.pm index b8f23dd..7c0f427 100644 --- a/WebCore/bindings/scripts/CodeGenerator.pm +++ b/WebCore/bindings/scripts/CodeGenerator.pm @@ -24,6 +24,8 @@ package CodeGenerator; +use strict; + use File::Find; my $useDocument = ""; @@ -272,7 +274,7 @@ sub ParseInterface return $interface if $interface->name eq $interfaceName; } - die("Could NOT find interface definition for $interface in $filename"); + die("Could NOT find interface definition for $interfaceName in $filename"); } # Helpers for all CodeGenerator***.pm modules diff --git a/WebCore/bindings/scripts/CodeGeneratorCPP.pm b/WebCore/bindings/scripts/CodeGeneratorCPP.pm new file mode 100644 index 0000000..f441b0e --- /dev/null +++ b/WebCore/bindings/scripts/CodeGeneratorCPP.pm @@ -0,0 +1,975 @@ + +# Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> +# Copyright (C) 2006 Anders Carlsson <andersca@mac.com> +# Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org> +# Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> +# Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. +# Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> +# Copyright (C) Research In Motion Limited 2010. All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# aint with this library; see the file COPYING.LIB. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# + +package CodeGeneratorCPP; + +use File::stat; + +# Global Variables +my $module = ""; +my $outputDir = ""; + +my @headerContentHeader = (); +my @headerContent = (); +my %headerForwardDeclarations = (); + +my @implContentHeader = (); +my @implContent = (); +my %implIncludes = (); + +# Constants +my $exceptionInit = "WebCore::ExceptionCode ec = 0;"; +my $exceptionRaiseOnError = "webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec));"; + +# Default License Templates +my $headerLicenseTemplate = << "EOF"; +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig\@gmail.com> + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +EOF + +my $implementationLicenseTemplate = << "EOF"; +/* + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ +EOF + +# Default constructor +sub new +{ + my $object = shift; + my $reference = { }; + + $codeGenerator = shift; + $outputDir = shift; + shift; # $useLayerOnTop + shift; # $preprocessor + shift; # $writeDependencies + + bless($reference, $object); + return $reference; +} + +sub finish +{ + my $object = shift; +} + +# Params: 'domClass' struct +sub GenerateInterface +{ + my $object = shift; + my $dataNode = shift; + my $defines = shift; + + my $name = $dataNode->name; + my $className = GetClassName($name); + my $parentClassName = "WebDOM" . GetParentImplClassName($dataNode); + + # Start actual generation. + $object->GenerateHeader($dataNode); + $object->GenerateImplementation($dataNode); + + # Write changes. + $object->WriteData("WebDOM" . $name); +} + +# Params: 'idlDocument' struct +sub GenerateModule +{ + my $object = shift; + my $dataNode = shift; + + $module = $dataNode->module; +} + +sub GetClassName +{ + my $name = $codeGenerator->StripModule(shift); + + # special cases + return "WebDOMString" if $codeGenerator->IsStringType($name) or $name eq "SerializedScriptValue"; + return "WebDOMAbstractView" if $name eq "DOMWindow"; + return "WebDOMObject" if $name eq "DOMObject"; + return "bool" if $name eq "boolean"; + return $name if $codeGenerator->IsPrimitiveType($name); + + return "WebDOM$name"; +} + +sub GetImplClassName +{ + my $name = $codeGenerator->StripModule(shift); + + return "DOMWindow" if $name eq "AbstractView"; + return $name; +} + +sub GetParentImplClassName +{ + my $dataNode = shift; + + if (@{$dataNode->parents} eq 0) { + return "EventTarget" if $dataNode->extendedAttributes->{"EventTarget"}; + return "Object"; + } + + return $codeGenerator->StripModule($dataNode->parents(0)); +} + +sub GetParent +{ + my $dataNode = shift; + my $numParents = @{$dataNode->parents}; + + my $parent = ""; + if ($numParents eq 0) { + $parent = "WebDOMObject"; + $parent = "WebDOMEventTarget" if $dataNode->extendedAttributes->{"EventTarget"}; + } elsif ($numParents eq 1) { + my $parentName = $codeGenerator->StripModule($dataNode->parents(0)); + $parent = "WebDOM" . $parentName; + } else { + my @parents = @{$dataNode->parents}; + my $firstParent = $codeGenerator->StripModule(shift(@parents)); + $parent = "WebDOM" . $firstParent; + } + + return $parent; +} + +sub ShouldSkipTypeInImplementation +{ + my $typeInfo = shift; + + return 1 if $typeInfo->signature->extendedAttributes->{"Custom"} + and !$typeInfo->signature->extendedAttributes->{"NoCPPCustom"}; + + return 1 if $typeInfo->signature->extendedAttributes->{"CustomArgumentHandling"} + or $typeInfo->signature->extendedAttributes->{"CustomGetter"} + or $typeInfo->signature->extendedAttributes->{"NeedsUserGestureCheck"}; + + # FIXME: We don't generate bindings for SVG related interfaces yet + return 1 if $typeInfo->signature->name =~ /getSVGDocument/; + + return 1 if $typeInfo->signature->name =~ /Constructor/; + return 0; +} + +sub ShouldSkipTypeInHeader +{ + my $typeInfo = shift; + + # FIXME: We currently ignore any attribute/function needing custom code + return 1 if $typeInfo->signature->extendedAttributes->{"CustomArgumentHandling"} + or $typeInfo->signature->extendedAttributes->{"CustomGetter"}; + + # FIXME: We don't generate bindings for SVG related interfaces yet + return 1 if $typeInfo->signature->name =~ /getSVGDocument/; + + return 1 if $typeInfo->signature->name =~ /Constructor/; + return 0; +} + +sub GetCPPType +{ + my $type = shift; + my $useConstReference = shift; + my $name = GetClassName($type); + + return "int" if $type eq "long"; + return "unsigned" if $name eq "unsigned long"; + return "unsigned short" if $type eq "CompareHow"; + + if ($codeGenerator->IsStringType($type)) { + if ($useConstReference) { + return "const $name&"; + } + + return $name; + } + + return $name if $codeGenerator->IsPrimitiveType($type) or $type eq "DOMTimeStamp"; + return "const $name&" if $useConstReference; + return $name; +} + +sub ConversionNeeded +{ + my $type = $codeGenerator->StripModule(shift); + return !$codeGenerator->IsNonPointerType($type) && !$codeGenerator->IsStringType($type); +} + +sub GetCPPTypeGetter +{ + my $argName = shift; + my $type = $codeGenerator->StripModule(shift); + + return $argName if $codeGenerator->IsPrimitiveType($type) or $codeGenerator->IsStringType($type); + return "static_cast<WebCore::Range::CompareHow>($argName)" if $type eq "CompareHow"; + return "WebCore::SerializedScriptValue::create(WebCore::String($argName))" if $type eq "SerializedScriptValue"; + return "toWebCore($argName)"; +} + +sub AddForwardDeclarationsForType +{ + my $type = $codeGenerator->StripModule(shift); + my $public = shift; + + return if $codeGenerator->IsNonPointerType($type) or $codeGenerator->IsStringType($type); + + my $class = GetClassName($type); + $headerForwardDeclarations{$class} = 1 if $public; +} + +sub AddIncludesForType +{ + my $type = $codeGenerator->StripModule(shift); + + return if $codeGenerator->IsNonPointerType($type); + return if $type =~ /cconstructor/; + + if ($codeGenerator->IsStringType($type)) { + $implIncludes{"AtomicString.h"} = 1; + $implIncludes{"KURL.h"} = 1; + $implIncludes{"WebDOMString.h"} = 1; + return; + } + + if ($type eq "DOMObject") { + $implIncludes{"WebDOMObject.h"} = 1; + return; + } + + if ($type eq "DOMWindow") { + $implIncludes{"DOMWindow.h"} = 1; + $implIncludes{"WebDOMAbstractView.h"} = 1; + return; + } + + if ($type eq "EventListener") { + $implIncludes{"WebNativeEventListener.h"} = 1; + return; + } + + if ($type eq "SerializedScriptValue") { + $implIncludes{"SerializedScriptValue.h"} = 1; + return; + } + + $implIncludes{"Node.h"} = 1 if $type eq "NodeList"; + $implIncludes{"CSSMutableStyleDeclaration.h"} = 1 if $type eq "CSSStyleDeclaration"; + + # Default, include the same named file (the implementation) and the same name prefixed with "WebDOM". + $implIncludes{"$type.h"} = 1 unless $type eq "DOMObject"; + $implIncludes{"WebDOM$type.h"} = 1; +} + +sub GenerateConditionalStringFromAttributeValue +{ + my $conditional = shift; + if ($conditional =~ /&/) { + return "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; + } elsif ($conditional =~ /\|/) { + return "ENABLE(" . join(") || ENABLE(", split(/\|/, $conditional)) . ")"; + } else { + return "ENABLE(" . $conditional . ")"; + } +} + +sub GenerateConditionalString +{ + my $node = shift; + my $conditional = $node->extendedAttributes->{"Conditional"}; + if ($conditional) { + return GenerateConditionalStringFromAttributeValue($conditional); + } else { + return ""; + } +} + +sub GenerateHeader +{ + my $object = shift; + my $dataNode = shift; + + my $interfaceName = $dataNode->name; + my $className = GetClassName($interfaceName); + my $implClassName = GetImplClassName($interfaceName); + my $implClassNameWithNamespace = "WebCore::" . $implClassName; + + my $parentName = ""; + $parentName = GetParent($dataNode); + + my $numConstants = @{$dataNode->constants}; + my $numAttributes = @{$dataNode->attributes}; + my $numFunctions = @{$dataNode->functions}; + + # - Add default header template + @headerContentHeader = split("\r", $headerLicenseTemplate); + push(@headerContentHeader, "\n#ifndef $className" . "_h"); + push(@headerContentHeader, "\n#define $className" . "_h\n\n"); + + my $conditionalString = GenerateConditionalString($dataNode); + push(@headerContentHeader, "#if ${conditionalString}\n\n") if $conditionalString; + + # - INCLUDES - + + my %headerIncludes = (); + $headerIncludes{"WebDOMString.h"} = 1; + $headerIncludes{"$parentName.h"} = 1; + foreach my $include (sort keys(%headerIncludes)) { + push(@headerContentHeader, "#include <$include>\n"); + } + + push(@headerContent, "class $className"); + push(@headerContent, " : public $parentName") if $parentName; + push(@headerContent, " {\n"); + push(@headerContent, "public:\n"); + + # Constructor + push(@headerContent, " $className();\n"); + push(@headerContent, " explicit $className($implClassNameWithNamespace*);\n"); + + # Copy constructor on classes which have the d-ptr + if (@{$dataNode->parents} eq 0) { + push(@headerContent, " $className(const $className&);\n"); + } + + # Destructor + if (@{$dataNode->parents} eq 0) { + push(@headerContent, " ~$className();\n"); + } + + push(@headerContent, "\n"); + $headerForwardDeclarations{$implClassNameWithNamespace} = 1; + + # - Add constants. + if ($numConstants > 0) { + my @headerConstants = (); + + # FIXME: we need a way to include multiple enums. + foreach my $constant (@{$dataNode->constants}) { + my $constantName = $constant->name; + my $constantValue = $constant->value; + + my $output = "WEBDOM_" . $constantName . " = " . $constantValue; + push(@headerConstants, " " . $output); + } + + my $combinedConstants = join(",\n", @headerConstants); + + push(@headerContent, " "); + push(@headerContent, "enum {\n"); + push(@headerContent, $combinedConstants); + push(@headerContent, "\n "); + push(@headerContent, "};\n\n"); + } + + my @headerAttributes = (); + + # - Add attribute getters/setters. + if ($numAttributes > 0) { + foreach my $attribute (@{$dataNode->attributes}) { + next if ShouldSkipTypeInHeader($attribute); + + my $attributeName = $attribute->signature->name; + my $attributeType = GetCPPType($attribute->signature->type, 0); + my $attributeIsReadonly = ($attribute->type =~ /^readonly/); + my $property = " " . $attributeType . ($attributeType =~ /\*$/ ? "" : " ") . $attributeName . "() const"; + + my $availabilityMacro = ""; + my $declarationSuffix = ";\n"; + + AddForwardDeclarationsForType($attribute->signature->type, 1); + + $attributeType = GetCPPType($attribute->signature->type, 1); + my $setterName = "set" . ucfirst($attributeName); + + $property .= $declarationSuffix; + push(@headerAttributes, $property); + if (!$attributeIsReadonly and !$attribute->signature->extendedAttributes->{"Replaceable"}) { + $property = " void $setterName($attributeType)"; + $property .= $declarationSuffix; + push(@headerAttributes, $property); + } + } + + push(@headerContent, @headerAttributes) if @headerAttributes > 0; + } + + my @headerFunctions = (); + my @deprecatedHeaderFunctions = (); + my @interfaceFunctions = (); + + # - Add functions. + if ($numFunctions > 0) { + foreach my $function (@{$dataNode->functions}) { + next if ShouldSkipTypeInHeader($function); + my $functionName = $function->signature->name; + + my $returnType = GetCPPType($function->signature->type, 0); + my $numberOfParameters = @{$function->parameters}; + my %typesToForwardDeclare = ($function->signature->type => 1); + + my $parameterIndex = 0; + my $functionSig = "$returnType $functionName("; + my $methodName = $functionName; + foreach my $param (@{$function->parameters}) { + my $paramName = $param->name; + my $paramType = GetCPPType($param->type, 1); + $typesToForwardDeclare{$param->type} = 1; + + $functionSig .= ", " if $parameterIndex >= 1; + $functionSig .= "$paramType $paramName"; + $parameterIndex++; + } + $functionSig .= ")"; + if ($dataNode->extendedAttributes->{"PureInterface"}) { + push(@interfaceFunctions, " virtual " . $functionSig . " = 0;\n"); + } + my $functionDeclaration = $functionSig; + $functionDeclaration .= ";\n"; + + foreach my $type (keys %typesToForwardDeclare) { + # add any forward declarations to the public header if a deprecated version will be generated + AddForwardDeclarationsForType($type, 1); + } + + push(@headerFunctions, " "); + push(@headerFunctions, $functionDeclaration); + } + + if (@headerFunctions > 0) { + push(@headerContent, "\n") if @headerAttributes > 0; + push(@headerContent, @headerFunctions); + } + } + + push(@headerContent, "\n"); + push(@headerContent, " $implClassNameWithNamespace* impl() const;\n"); + + if (@{$dataNode->parents} eq 0) { + push(@headerContent, "\nprotected:\n"); + push(@headerContent, " struct ${className}Private;\n"); + push(@headerContent, " ${className}Private* m_impl;\n"); + } + + push(@headerContent, "};\n\n"); + + # for PureInterface classes also add the interface that the client code needs to + # implement + if ($dataNode->extendedAttributes->{"PureInterface"}) { + push(@headerContent, "class WebUser$interfaceName {\n"); + push(@headerContent, "public:\n"); + push(@headerContent, " virtual void ref() = 0;\n"); + push(@headerContent, " virtual void deref() = 0;\n\n"); + push(@headerContent, @interfaceFunctions); + push(@headerContent, "\nprotected:\n"); + push(@headerContent, " virtual ~WebUser$interfaceName() {}\n"); + push(@headerContent, "};\n\n"); + } + + push(@headerContent, "WebCore::$implClassName* toWebCore(const $className&);\n"); + push(@headerContent, "$className toWebKit(WebCore::$implClassName*);\n"); + if ($dataNode->extendedAttributes->{"PureInterface"}) { + push(@headerContent, "$className toWebKit(WebUser$interfaceName*);\n"); + } + push(@headerContent, "\n#endif\n"); + push(@headerContent, "#endif // ${conditionalString}\n\n") if $conditionalString; +} + +sub AddEarlyReturnStatement +{ + my $returnType = shift; + + if (!defined($returnType) or $returnType eq "void") { + $returnType = ""; + } elsif ($codeGenerator->IsPrimitiveType($returnType)) { + $returnType = " 0"; + } elsif ($returnType eq "bool") { + $returnType = " false"; + } else { + $returnType = " $returnType()"; + } + + # TODO: We could set exceptions here, if we want that + my $statement = " if (!impl())\n"; + $statement .= " return$returnType;\n\n"; + return $statement; +} + +sub AddReturnStatement +{ + my $typeInfo = shift; + my $returnValue = shift; + + # Used to invoke KURLs "const String&" operator + if ($codeGenerator->IsStringType($typeInfo->signature->type)) { + return " return static_cast<const WebCore::String&>($returnValue);\n"; + } + + return " return $returnValue;\n"; +} + +sub GenerateImplementation +{ + my $object = shift; + my $dataNode = shift; + + my @ancestorInterfaceNames = (); + + if (@{$dataNode->parents} > 1) { + $codeGenerator->AddMethodsConstantsAndAttributesFromParentClasses($dataNode, \@ancestorInterfaceNames); + } + + my $interfaceName = $dataNode->name; + my $className = GetClassName($interfaceName); + my $implClassName = GetImplClassName($interfaceName); + my $parentImplClassName = GetParentImplClassName($dataNode); + my $implClassNameWithNamespace = "WebCore::" . $implClassName; + my $baseClass = "WebDOM$parentImplClassName"; + my $conditional = $dataNode->extendedAttributes->{"Conditional"}; + + my $numAttributes = @{$dataNode->attributes}; + my $numFunctions = @{$dataNode->functions}; + + # - Add default header template. + @implContentHeader = split("\r", $implementationLicenseTemplate); + + # - INCLUDES - + push(@implContentHeader, "\n#include \"config.h\"\n"); + my $conditionalString = GenerateConditionalString($dataNode); + push(@implContentHeader, "\n#if ${conditionalString}\n\n") if $conditionalString; + push(@implContentHeader, "#include \"$className.h\"\n\n"); + + $implIncludes{"WebExceptionHandler.h"} = 1; + $implIncludes{"$implClassName.h"} = 1; + @implContent = (); + + push(@implContent, "#include <wtf/GetPtr.h>\n"); + push(@implContent, "#include <wtf/RefPtr.h>\n\n"); + + # Private datastructure, encapsulating WebCore types + if (@{$dataNode->parents} eq 0) { + push(@implContent, "struct ${className}::${className}Private {\n"); + push(@implContent, " ${className}Private($implClassNameWithNamespace* object = 0)\n"); + push(@implContent, " : impl(object)\n"); + push(@implContent, " {\n"); + push(@implContent, " }\n\n"); + push(@implContent, " RefPtr<$implClassNameWithNamespace> impl;\n"); + push(@implContent, "};\n\n"); + } + + # Constructor + push(@implContent, "${className}::$className()\n"); + push(@implContent, " : ${baseClass}()\n"); + push(@implContent, " , m_impl(0)\n") if (@{$dataNode->parents} eq 0); + push(@implContent, "{\n"); + push(@implContent, "}\n\n"); + + push(@implContent, "${className}::$className($implClassNameWithNamespace* impl)\n"); + if (@{$dataNode->parents} eq 0) { + push(@implContent, " : ${baseClass}()\n"); + push(@implContent, " , m_impl(new ${className}Private(impl))\n"); + push(@implContent, "{\n"); + push(@implContent, "}\n\n"); + + push(@implContent, "${className}::${className}(const ${className}& copy)\n"); + push(@implContent, " : ${baseClass}()\n"); + push(@implContent, "{\n"); + push(@implContent, " m_impl = copy.impl() ? new ${className}Private(copy.impl()) : 0;\n"); + push(@implContent, "}\n\n"); + + push(@implContent, "$implClassNameWithNamespace* ${className}::impl() const\n"); + push(@implContent, "{\n"); + push(@implContent, " return m_impl ? m_impl->impl.get() : 0;\n"); + push(@implContent, "}\n\n"); + + # Destructor + push(@implContent, "${className}::~$className()\n"); + push(@implContent, "{\n"); + push(@implContent, " delete m_impl;\n"); + push(@implContent, " m_impl = 0;\n"); + push(@implContent, "}\n\n"); + } else { + push(@implContent, " : ${baseClass}(impl)\n"); + push(@implContent, "{\n"); + push(@implContent, "}\n\n"); + + push(@implContent, "$implClassNameWithNamespace* ${className}::impl() const\n"); + push(@implContent, "{\n"); + push(@implContent, " return static_cast<$implClassNameWithNamespace*>(${baseClass}::impl());\n"); + push(@implContent, "}\n\n"); + } + + # START implementation + %attributeNames = (); + + # - Attributes + if ($numAttributes > 0) { + foreach my $attribute (@{$dataNode->attributes}) { + next if ShouldSkipTypeInImplementation($attribute); + AddIncludesForType($attribute->signature->type); + + my $idlType = $codeGenerator->StripModule($attribute->signature->type); + + my $attributeName = $attribute->signature->name; + my $attributeType = GetCPPType($attribute->signature->type, 0); + my $attributeIsReadonly = ($attribute->type =~ /^readonly/); + + $attributeNames{$attributeName} = 1; + + # - GETTER + my $getterSig = "$attributeType $className\:\:$attributeName() const\n"; + my $hasGetterException = @{$attribute->getterExceptions}; + my $getterContentHead; + my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; + my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; + if ($reflect || $reflectURL) { + my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $attributeName : ($reflect || $reflectURL); + my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); + $implIncludes{"${namespace}.h"} = 1; + my $getAttributeFunctionName = $reflectURL ? "getURLAttribute" : "getAttribute"; + $getterContentHead = "impl()->${getAttributeFunctionName}(WebCore::${namespace}::${contentAttributeName}Attr"; + } else { + $getterContentHead = "impl()->" . $codeGenerator->WK_lcfirst($attributeName) . "("; + } + my $getterContentTail = ")"; + + # Special cases + my @customGetterContent = (); + if ($attribute->signature->extendedAttributes->{"ConvertToString"}) { + $getterContentHead = "WebCore::String::number(" . $getterContentHead; + $getterContentTail .= ")"; + } elsif ($attribute->signature->extendedAttributes->{"ConvertFromString"}) { + $getterContentTail .= ".toInt()"; + } elsif ($attribute->signature->type eq "SerializedScriptValue") { + $getterContentHead = "$getterContentHead"; + $getterContentTail .= "->toString()"; + } elsif (ConversionNeeded($attribute->signature->type)) { + $getterContentHead = "toWebKit(WTF::getPtr($getterContentHead"; + $getterContentTail .= "))"; + } + + my $getterContent; + if ($hasGetterException) { + $getterContent = $getterContentHead . "ec" . $getterContentTail; + } else { + $getterContent = $getterContentHead . $getterContentTail; + } + + my $attributeConditionalString = GenerateConditionalString($attribute->signature); + push(@implContent, "#if ${attributeConditionalString}\n") if $attributeConditionalString; + + push(@implContent, $getterSig); + push(@implContent, "{\n"); + push(@implContent, AddEarlyReturnStatement($attributeType)); + push(@implContent, @customGetterContent); + if ($hasGetterException) { + # Differentiated between when the return type is a pointer and + # not for white space issue (ie. Foo *result vs. int result). + if ($attributeType =~ /\*$/) { + $getterContent = $attributeType . "result = " . $getterContent; + } else { + $getterContent = $attributeType . " result = " . $getterContent; + } + + push(@implContent, " $exceptionInit\n"); + push(@implContent, " $getterContent;\n"); + push(@implContent, " $exceptionRaiseOnError\n"); + push(@implContent, AddReturnStatement($attribute, "result")); + } else { + push(@implContent, AddReturnStatement($attribute, $getterContent)); + } + push(@implContent, "}\n\n"); + + # - SETTER + if (!$attributeIsReadonly and !$attribute->signature->extendedAttributes->{"Replaceable"}) { + # Exception handling + my $hasSetterException = @{$attribute->setterExceptions}; + + my $coreSetterName = "set" . $codeGenerator->WK_ucfirst($attributeName); + my $setterName = "set" . ucfirst($attributeName); + my $argName = "new" . ucfirst($attributeName); + my $arg = GetCPPTypeGetter($argName, $idlType); + + # The definition of ConvertFromString and ConvertToString is flipped for the setter + if ($attribute->signature->extendedAttributes->{"ConvertFromString"}) { + $arg = "WebCore::String::number($arg)"; + } elsif ($attribute->signature->extendedAttributes->{"ConvertToString"}) { + $arg = "WebCore::String($arg).toInt()"; + } + + my $attributeType = GetCPPType($attribute->signature->type, 1); + push(@implContent, "void $className\:\:$setterName($attributeType $argName)\n"); + push(@implContent, "{\n"); + push(@implContent, AddEarlyReturnStatement()); + + my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; + my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; + push(@implContent, " $exceptionInit\n") if $hasSetterException; + my $ec = $hasSetterException ? ", ec" : ""; + if ($reflect || $reflectURL) { + my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $attributeName : ($reflect || $reflectURL); + my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); + $implIncludes{"${namespace}.h"} = 1; + push(@implContent, " impl()->setAttribute(WebCore::${namespace}::${contentAttributeName}Attr, $arg$ec);\n"); + } else { + push(@implContent, " impl()->$coreSetterName($arg$ec);\n"); + } + push(@implContent, " $exceptionRaiseOnError\n") if $hasSetterException; + push(@implContent, "}\n\n"); + } + + push(@implContent, "#endif\n") if $attributeConditionalString; + } + } + + # - Functions + if ($numFunctions > 0) { + foreach my $function (@{$dataNode->functions}) { + # Treat PureInterface as Custom as well, since the WebCore versions will take a script context as well + next if ShouldSkipTypeInImplementation($function) || $dataNode->extendedAttributes->{"PureInterface"}; + AddIncludesForType($function->signature->type); + + my $functionName = $function->signature->name; + my $returnType = GetCPPType($function->signature->type, 0); + my $hasParameters = @{$function->parameters}; + my $raisesExceptions = @{$function->raisesExceptions}; + + my @parameterNames = (); + my @needsAssert = (); + my %needsCustom = (); + + my $parameterIndex = 0; + + # FIXME: Handle Callback support, we're just passing 0 as ScriptExecutionContext for now. + push(@parameterNames, "0") if ($dataNode->extendedAttributes->{"Callback"}); + + my $functionSig = "$returnType $className\:\:$functionName("; + foreach my $param (@{$function->parameters}) { + my $paramName = $param->name; + my $paramType = GetCPPType($param->type, 1); + + # make a new parameter name if the original conflicts with a property name + $paramName = "in" . ucfirst($paramName) if $attributeNames{$paramName}; + + AddIncludesForType($param->type); + + my $idlType = $codeGenerator->StripModule($param->type); + my $implGetter = GetCPPTypeGetter($paramName, $idlType); + + push(@parameterNames, $implGetter); + $needsCustom{"NodeToReturn"} = $paramName if $param->extendedAttributes->{"Return"}; + + unless ($codeGenerator->IsPrimitiveType($idlType) or $codeGenerator->IsStringType($idlType)) { + push(@needsAssert, " ASSERT($paramName);\n"); + } + + $functionSig .= ", " if $parameterIndex >= 1; + $functionSig .= "$paramType $paramName"; + $parameterIndex++; + } + + $functionSig .= ")"; + + my @functionContent = (); + push(@parameterNames, "ec") if $raisesExceptions; + my $content = "impl()->" . $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")"; + + if ($returnType eq "void") { + # Special case 'void' return type. + if ($raisesExceptions) { + push(@functionContent, " $exceptionInit\n"); + push(@functionContent, " $content;\n"); + push(@functionContent, " $exceptionRaiseOnError\n"); + } else { + push(@functionContent, " $content;\n"); + } + } elsif (defined $needsCustom{"NodeToReturn"}) { + # TODO: This is important to enable, once we care about custom code! + + # Special case the insertBefore, replaceChild, removeChild + # and appendChild functions from DOMNode + my $toReturn = $needsCustom{"NodeToReturn"}; + if ($raisesExceptions) { + push(@functionContent, " $exceptionInit\n"); + push(@functionContent, " if ($content)\n"); + push(@functionContent, " return $toReturn;\n"); + push(@functionContent, " $exceptionRaiseOnError\n"); + push(@functionContent, " return $className();\n"); + } else { + push(@functionContent, " if ($content)\n"); + push(@functionContent, " return $toReturn;\n"); + push(@functionContent, " return NULL;\n"); + } + } else { + if (ConversionNeeded($function->signature->type)) { + $content = "toWebKit(WTF::getPtr($content))"; + } + + if ($raisesExceptions) { + # Differentiated between when the return type is a pointer and + # not for white space issue (ie. Foo *result vs. int result). + if ($returnType =~ /\*$/) { + $content = $returnType . "result = " . $content; + } else { + $content = $returnType . " result = " . $content; + } + + push(@functionContent, " $exceptionInit\n"); + push(@functionContent, " $content;\n"); + push(@functionContent, " $exceptionRaiseOnError\n"); + push(@functionContent, " return result;\n"); + } else { + push(@functionContent, " return $content;\n"); + } + } + + push(@implContent, "$functionSig\n"); + push(@implContent, "{\n"); + push(@implContent, AddEarlyReturnStatement($returnType)); + push(@implContent, @functionContent); + push(@implContent, "}\n\n"); + + # Clear the hash + %needsCustom = (); + } + } + + # END implementation + + # Generate internal interfaces + push(@implContent, "WebCore::$implClassName* toWebCore(const $className& wrapper)\n"); + push(@implContent, "{\n"); + push(@implContent, " return wrapper.impl();\n"); + push(@implContent, "}\n\n"); + + push(@implContent, "$className toWebKit(WebCore::$implClassName* value)\n"); + push(@implContent, "{\n"); + push(@implContent, " return $className(value);\n"); + push(@implContent, "}\n"); + + # - End the ifdef conditional if necessary + push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString; +} + +# Internal helper +sub WriteData +{ + my $object = shift; + my $name = shift; + + # Open files for writing... + my $headerFileName = "$outputDir/" . $name . ".h"; + my $implFileName = "$outputDir/" . $name . ".cpp"; + + # Remove old files. + unlink($headerFileName); + unlink($implFileName); + + # Write public header. + open(HEADER, ">$headerFileName") or die "Couldn't open file $headerFileName"; + + print HEADER @headerContentHeader; + print HEADER "\n"; + foreach my $class (sort keys(%headerForwardDeclarations)) { + if ($class =~ /::/) { + my $namespacePart = $class; + $namespacePart =~ s/::.*//; + + my $classPart = $class; + $classPart =~ s/${namespacePart}:://; + + print HEADER "namespace $namespacePart {\nclass $classPart;\n};\n\n"; + } else { + print HEADER "class $class;\n" + } + } + + my $hasForwardDeclarations = keys(%headerForwardDeclarations); + print HEADER "\n" if $hasForwardDeclarations; + print HEADER @headerContent; + close(HEADER); + + @headerContentHeader = (); + @headerContent = (); + %headerForwardDeclarations = (); + + # Write implementation file. + open(IMPL, ">$implFileName") or die "Couldn't open file $implFileName"; + + print IMPL @implContentHeader; + + foreach my $include (sort keys(%implIncludes)) { + # "className.h" is already included right after config.h, silence check-webkit-style + next if $include eq "$name.h"; + print IMPL "#include \"$include\"\n"; + } + + print IMPL @implContent; + close(IMPL); + + @implContentHeader = (); + @implContent = (); + %implIncludes = (); +} + +1; diff --git a/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/WebCore/bindings/scripts/CodeGeneratorGObject.pm index b331f97..e98c661 100644 --- a/WebCore/bindings/scripts/CodeGeneratorGObject.pm +++ b/WebCore/bindings/scripts/CodeGeneratorGObject.pm @@ -362,7 +362,7 @@ sub GenerateProperty { } if (grep {$_ eq $attribute} @writeableProperties) { - push(@txtSetProps, " case ${propEnum}:\n {\n"); + push(@txtSetProps, " case ${propEnum}:\n {\n"); push(@txtSetProps, " WebCore::ExceptionCode ec = 0;\n") if @{$attribute->setterExceptions}; push(@txtSetProps, " ${setterContentHead}"); push(@txtSetProps, ", ec") if @{$attribute->setterExceptions}; @@ -370,7 +370,7 @@ sub GenerateProperty { push(@txtSetProps, " break;\n }\n"); } - push(@txtGetProps, " case ${propEnum}:\n {\n"); + push(@txtGetProps, " case ${propEnum}:\n {\n"); my $exception = ""; if (@{$attribute->getterExceptions}) { @@ -471,6 +471,16 @@ sub GenerateEventListener { my $object = shift; my $interfaceName = shift; + # This marks event listeners in some subclasses of Element. We + # cannot add them, otherwise we'll get runtime errors because of + # duplicated signal definitions between a class and some ancestor. + + # FIXME: it would be very good to be a lot more precise in how we + # do this... + if ($attribute->signature->extendedAttributes->{"WindowEventListener"}) { + return; + } + my $name = $attribute->signature->name; my $domSignalName = substr($name, 2); my $gobjectSignalName = EventSignalName($domSignalName); @@ -548,7 +558,7 @@ EOF if (scalar @writeableProperties > 0) { $txtSetProps = << "EOF"; - ${className} *self = WEBKIT_DOM_${clsCaps}(object); + ${className}* self = WEBKIT_DOM_${clsCaps}(object); $privFunction EOF push(@txtSetProps, $txtSetProps); @@ -587,6 +597,9 @@ EOF EOF push(@txtSetProps, $txtSetProps); + # Do not insert extra spaces when interpolating array variables + $" = ""; + $implContent = << "EOF"; static void ${lowerCaseIfaceName}_finalize(GObject* object) @@ -747,7 +760,7 @@ sub GenerateFunction { my $returnType = GetGlibTypeName($functionSigType); my $returnValueIsGDOMType = IsGDOMClassType($functionSigType); - my $functionSig = "$className *self"; + my $functionSig = "${className}* self"; my $callImplParams = ""; @@ -799,8 +812,8 @@ sub GenerateFunction { $functionSig .= ", GError **error"; } - push(@hBody, "WEBKIT_API $returnType\n$functionName ($functionSig);\n\n"); - push(@cBody, "$returnType\n$functionName ($functionSig)\n{\n"); + push(@hBody, "WEBKIT_API $returnType\n$functionName($functionSig);\n\n"); + push(@cBody, "$returnType\n$functionName($functionSig)\n{\n"); if ($conditionalMethods{$functionName}) { push(@cBody, "#if ENABLE($conditionalMethods{$functionName})\n"); @@ -969,7 +982,7 @@ EOF push(@cBody, "#endif\n"); } - push(@cBody, "\n}\n\n"); + push(@cBody, "}\n\n"); } sub ClassHasFunction { diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm index bffd046..c3521bf 100644 --- a/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -172,16 +172,16 @@ sub GenerateEventListenerCall push(@GenerateEventListenerImpl, <<END); JSValue correspondingElementWrapper = toJS(exec, imp->correspondingElement()); if (!correspondingElementWrapper.isObject()) - return jsUndefined(); + return JSValue::encode(jsUndefined()); END } push(@GenerateEventListenerImpl, <<END); JSValue listener = exec->argument(1); if (!listener.isObject()) - return jsUndefined(); + return JSValue::encode(jsUndefined()); imp->${functionName}EventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), $wrapperObject, false, currentWorld(exec))$passRefPtrHandling, exec->argument(2).toBoolean(exec)); - return jsUndefined(); + return JSValue::encode(jsUndefined()); END return @GenerateEventListenerImpl; } @@ -984,12 +984,18 @@ sub GenerateHeader push(@headerContent, "};\n\n"); + # Conditionally emit the constructor object's declaration + if ($dataNode->extendedAttributes->{"CustomConstructFunction"}) { + GenerateConstructorDeclaration(\@headerContent, $className, $dataNode); + } + + if ($numFunctions > 0) { push(@headerContent,"// Functions\n\n"); foreach my $function (@{$dataNode->functions}) { next if $function->{overloadIndex} && $function->{overloadIndex} > 1; my $functionName = $codeGenerator->WK_lcfirst($className) . "PrototypeFunction" . $codeGenerator->WK_ucfirst($function->signature->name); - push(@headerContent, "JSC::JSValue JSC_HOST_CALL ${functionName}(JSC::ExecState*);\n"); + push(@headerContent, "JSC::EncodedJSValue JSC_HOST_CALL ${functionName}(JSC::ExecState*);\n"); } } @@ -1115,7 +1121,7 @@ sub GenerateParametersCheckExpression # these are acceptable values for a DOMString argument (any Object can # be converted to a string via .toString). push(@andExpression, "(${value}.isNull() || ${value}.isUndefined() || ${value}.isString() || ${value}.isObject())") if $codeGenerator->IsStringType($type); - push(@andExpression, "(${value}.isNull() || asObject(${value})->inherits(JS${type}::s_info)") unless IsNativeType($type); + push(@andExpression, "(${value}.isNull() || ${value}.isObject() && asObject(${value})->inherits(&JS${type}::s_info))") unless IsNativeType($type); $parameterIndex++; } @@ -1154,7 +1160,7 @@ sub GenerateOverloadedPrototypeFunction my $functionName = "js${implClassName}PrototypeFunction" . $codeGenerator->WK_ucfirst($function->signature->name); - push(@implContent, "JSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n"); + push(@implContent, "EncodedJSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n"); push(@implContent, <<END); { END @@ -1164,7 +1170,7 @@ END push(@implContent, " return ${functionName}$overload->{overloadIndex}(exec);\n"); } push(@implContent, <<END); - return throwError(exec, TypeError); + return JSValue::encode(throwTypeError(exec)); } END @@ -1231,10 +1237,10 @@ sub GenerateImplementation \@hashKeys, \@hashSpecials, \@hashValue1, \@hashValue2); - my $protoClassName; - $protoClassName = "${className}Prototype"; + my $protoClassName = "${className}Prototype"; - push(@implContent, constructorFor($className, $protoClassName, $interfaceName, $visibleClassName, $dataNode)); + GenerateConstructorDeclaration(\@implContent, $className, $dataNode) unless $dataNode->extendedAttributes->{"CustomConstructFunction"}; + GenerateConstructorDefinition(\@implContent, $className, $protoClassName, $interfaceName, $visibleClassName, $dataNode); } # - Add functions and constants to a hashtable definition @@ -1786,11 +1792,14 @@ sub GenerateImplementation if ($function->{overloads} && @{$function->{overloads}} > 1) { # 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. + push(@implContent, "static "); } my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementationFunction"} || $codeGenerator->WK_lcfirst($function->signature->name); - push(@implContent, "JSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n"); + push(@implContent, "EncodedJSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n"); push(@implContent, "{\n"); $implIncludes{"<runtime/Error.h>"} = 1; @@ -1798,22 +1807,22 @@ sub GenerateImplementation if ($interfaceName eq "DOMWindow") { push(@implContent, " $className* castedThis = toJSDOMWindow(exec->hostThisValue().toThisObject(exec));\n"); push(@implContent, " if (!castedThis)\n"); - push(@implContent, " return throwError(exec, TypeError);\n"); + push(@implContent, " return throwVMTypeError(exec);\n"); } elsif ($dataNode->extendedAttributes->{"IsWorkerContext"}) { push(@implContent, " $className* castedThis = to${className}(exec->hostThisValue().toThisObject(exec));\n"); push(@implContent, " if (!castedThis)\n"); - push(@implContent, " return throwError(exec, TypeError);\n"); + push(@implContent, " return throwVMTypeError(exec);\n"); } else { push(@implContent, " JSValue thisValue = exec->hostThisValue();\n"); push(@implContent, " if (!thisValue.inherits(&${className}::s_info))\n"); - push(@implContent, " return throwError(exec, TypeError);\n"); + push(@implContent, " return throwVMTypeError(exec);\n"); push(@implContent, " $className* castedThis = static_cast<$className*>(asObject(thisValue));\n"); } if ($dataNode->extendedAttributes->{"CheckDomainSecurity"} && !$function->signature->extendedAttributes->{"DoNotCheckDomainSecurity"}) { push(@implContent, " if (!castedThis->allowsAccessFrom(exec))\n"); - push(@implContent, " return jsUndefined();\n"); + push(@implContent, " return JSValue::encode(jsUndefined());\n"); } # Special case for JSSVGLengthList / JSSVGTransformList / JSSVGPointList / JSSVGNumberList @@ -1832,12 +1841,12 @@ sub GenerateImplementation } if ($function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"JSCCustom"}) { - push(@implContent, " return castedThis->" . $functionImplementationName . "(exec);\n"); + push(@implContent, " return JSValue::encode(castedThis->" . $functionImplementationName . "(exec));\n"); } elsif ($svgPODListType) { $implIncludes{"JS${svgPODListType}.h"} = 1; $implIncludes{"JSSVGPODListCustom.h"} = 1; - push(@implContent, " return JSSVGPODListCustom::$functionImplementationName<$className, " . GetNativeType($svgPODListType) - . ">(castedThis, exec, to" . $svgPODListType . ");\n"); + push(@implContent, " return JSValue::encode(JSSVGPODListCustom::$functionImplementationName<$className, " . GetNativeType($svgPODListType) + . ">(castedThis, exec, to" . $svgPODListType . "));\n"); } else { push(@implContent, " $implType* imp = static_cast<$implType*>(castedThis->impl());\n"); push(@implContent, " $podType podImp(*imp);\n") if $podType; @@ -1848,9 +1857,9 @@ sub GenerateImplementation if ($requiresAllArguments) { push(@implContent, " if (exec->argumentCount() < $numParameters)\n"); if ($requiresAllArguments eq "Raise") { - push(@implContent, " return throwError(exec, SyntaxError, \"Not enough arguments\");\n"); + push(@implContent, " return throwVMError(exec, createSyntaxError(exec, \"Not enough arguments\"));\n"); } else { - push(@implContent, " return jsUndefined();\n"); + push(@implContent, " return JSValue::encode(jsUndefined());\n"); } } @@ -1860,7 +1869,7 @@ sub GenerateImplementation if ($function->signature->extendedAttributes->{"SVGCheckSecurityDocument"}) { push(@implContent, " if (!checkNodeSecurity(exec, imp->getSVGDocument(" . (@{$function->raisesExceptions} ? "ec" : "") .")))\n"); - push(@implContent, " return jsUndefined();\n"); + push(@implContent, " return JSValue::encode(jsUndefined());\n"); $implIncludes{"JSDOMBinding.h"} = 1; } @@ -1869,6 +1878,7 @@ sub GenerateImplementation } elsif ($function->signature->name eq "removeEventListener") { push(@implContent, GenerateEventListenerCall($className, "remove")); } else { + my $argsIndex = 0; my $paramIndex = 0; my $functionString = ($podType ? "podImp." : "imp->") . $functionImplementationName . "("; @@ -1885,10 +1895,15 @@ sub GenerateImplementation if ($callWith eq "DynamicFrame") { push(@implContent, " Frame* dynamicFrame = toDynamicFrame(exec);\n"); push(@implContent, " if (!dynamicFrame)\n"); - push(@implContent, " return jsUndefined();\n"); + push(@implContent, " return JSValue::encode(jsUndefined());\n"); $callWithArg = "dynamicFrame"; } elsif ($callWith eq "ScriptState") { $callWithArg = "exec"; + } elsif ($callWith eq "ScriptExecutionContext") { + push(@implContent, " ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();\n"); + push(@implContent, " if (!scriptContext)\n"); + push(@implContent, " return JSValue::encode(jsUndefined());\n"); + $callWithArg = "scriptContext"; } $functionString .= ", " if $paramIndex; $functionString .= $callWithArg; @@ -1902,7 +1917,7 @@ sub GenerateImplementation push(@implContent, "\n int argsCount = exec->argumentCount();\n"); $hasOptionalArguments = 1; } - push(@implContent, " if (argsCount < " . ($paramIndex + 1) . ") {\n"); + push(@implContent, " if (argsCount < " . ($argsIndex + 1) . ") {\n"); GenerateImplementationFunctionCall($function, $functionString, $paramIndex, " " x 2, $podType, $implClassName); push(@implContent, " }\n\n"); } @@ -1911,15 +1926,15 @@ sub GenerateImplementation if ($parameter->type eq "XPathNSResolver") { push(@implContent, " RefPtr<XPathNSResolver> customResolver;\n"); - push(@implContent, " XPathNSResolver* resolver = toXPathNSResolver(exec->argument($paramIndex));\n"); + push(@implContent, " XPathNSResolver* resolver = toXPathNSResolver(exec->argument($argsIndex));\n"); push(@implContent, " if (!resolver) {\n"); - push(@implContent, " customResolver = JSCustomXPathNSResolver::create(exec, exec->argument($paramIndex));\n"); + push(@implContent, " customResolver = JSCustomXPathNSResolver::create(exec, exec->argument($argsIndex));\n"); push(@implContent, " if (exec->hadException())\n"); - push(@implContent, " return jsUndefined();\n"); + push(@implContent, " return JSValue::encode(jsUndefined());\n"); push(@implContent, " resolver = customResolver.get();\n"); push(@implContent, " }\n"); } else { - push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($paramIndex)") . ";\n"); + push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($argsIndex)") . ";\n"); # If a parameter is "an index" and it's negative it should throw an INDEX_SIZE_ERR exception. # But this needs to be done in the bindings, because the type is unsigned and the fact that it @@ -1928,7 +1943,7 @@ sub GenerateImplementation $implIncludes{"ExceptionCode.h"} = 1; push(@implContent, " if ($name < 0) {\n"); push(@implContent, " setDOMException(exec, INDEX_SIZE_ERR);\n"); - push(@implContent, " return jsUndefined();\n"); + push(@implContent, " return JSValue::encode(jsUndefined());\n"); push(@implContent, " }\n"); } } @@ -1940,6 +1955,7 @@ sub GenerateImplementation } else { $functionString .= $name; } + $argsIndex++; $paramIndex++; } @@ -2221,7 +2237,7 @@ sub GenerateImplementationFunctionCall() push(@implContent, $indent . "$functionString;\n"); push(@implContent, $indent . "setDOMException(exec, ec);\n") if @{$function->raisesExceptions}; push(@implContent, $indent . "imp->commitChange(podImp, castedThis);\n") if $podType; - push(@implContent, $indent . "return jsUndefined();\n"); + push(@implContent, $indent . "return JSValue::encode(jsUndefined());\n"); } else { push(@implContent, "\n" . $indent . "JSC::JSValue result = " . NativeToJSValue($function->signature, 1, $implClassName, "", $functionString, "castedThis") . ";\n"); push(@implContent, $indent . "setDOMException(exec, ec);\n") if @{$function->raisesExceptions}; @@ -2229,7 +2245,7 @@ sub GenerateImplementationFunctionCall() $callWith = $function->signature->extendedAttributes->{"CallWith"}; if ($callWith and $callWith eq "ScriptState") { push(@implContent, $indent . "if (exec->hadException())\n"); - push(@implContent, $indent . " return jsUndefined();\n"); + push(@implContent, $indent . " return JSValue::encode(jsUndefined());\n"); } if ($podType and not $function->signature->extendedAttributes->{"Immutable"}) { @@ -2238,7 +2254,7 @@ sub GenerateImplementationFunctionCall() push(@implContent, $indent . "imp->commitChange(podImp, castedThis);\n"); } - push(@implContent, $indent . "return result;\n"); + push(@implContent, $indent . "return JSValue::encode(result);\n"); } } @@ -2702,86 +2718,94 @@ sub WriteData } } -sub constructorFor +sub GenerateConstructorDeclaration { + my $outputArray = shift; my $className = shift; - my $protoClassName = shift; - my $interfaceName = shift; - my $visibleClassName = shift; my $dataNode = shift; + my $constructorClassName = "${className}Constructor"; my $canConstruct = $dataNode->extendedAttributes->{"CanBeConstructed"}; my $callWith = $dataNode->extendedAttributes->{"CallWith"}; -my $implContent = << "EOF"; -class ${constructorClassName} : public DOMConstructorObject { -public: - ${constructorClassName}(ExecState* exec, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(${constructorClassName}::createStructure(globalObject->objectPrototype()), globalObject) - { - putDirect(exec->propertyNames().prototype, ${protoClassName}::self(exec, globalObject), DontDelete | ReadOnly); - } - virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); - virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); - virtual const ClassInfo* classInfo() const { return &s_info; } - static const ClassInfo s_info; + push(@$outputArray, "class ${constructorClassName} : public DOMConstructorObject {\n"); + push(@$outputArray, "public:\n"); + push(@$outputArray, " ${constructorClassName}(JSC::ExecState*, JSDOMGlobalObject*);\n\n"); - static PassRefPtr<Structure> createStructure(JSValue proto) - { - return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); - } - -protected: - static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags; -EOF + push(@$outputArray, " virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);\n"); + push(@$outputArray, " virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);\n"); + push(@$outputArray, " virtual const JSC::ClassInfo* classInfo() const { return &s_info; }\n"); + push(@$outputArray, " static const JSC::ClassInfo s_info;\n"); - if ($canConstruct) { -$implContent .= << "EOF"; - static JSObject* construct${interfaceName}(ExecState* exec, JSObject* constructor, const ArgList&) - { -EOF + push(@$outputArray, " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n"); + push(@$outputArray, " {\n"); + push(@$outputArray, " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);\n"); + push(@$outputArray, " }\n"); - my $constructorArg = ""; - if ($callWith and $callWith eq "ScriptExecutionContext") { - $constructorArg = "context"; -$implContent .= << "EOF"; - ScriptExecutionContext* context = static_cast<${constructorClassName}*>(constructor)->scriptExecutionContext(); - if (!context) - return throwError(exec, ReferenceError); -EOF - } + push(@$outputArray, "protected:\n"); + push(@$outputArray, " static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;\n"); -$implContent .= << "EOF"; - return asObject(toJS(exec, static_cast<${constructorClassName}*>(constructor)->globalObject(), ${interfaceName}::create(${constructorArg}))); - } - virtual ConstructType getConstructData(ConstructData& constructData) - { - constructData.native.function = construct${interfaceName}; - return ConstructTypeHost; - } -EOF + if ($canConstruct) { + push(@$outputArray, " static JSC::EncodedJSValue JSC_HOST_CALL construct${className}(JSC::ExecState*);\n"); + push(@$outputArray, " virtual JSC::ConstructType getConstructData(JSC::ConstructData&);\n"); } + push(@$outputArray, "};\n\n"); +} -$implContent .= << "EOF"; -}; +sub GenerateConstructorDefinition +{ + my $outputArray = shift; -const ClassInfo ${constructorClassName}::s_info = { "${visibleClassName}Constructor", 0, &${constructorClassName}Table, 0 }; + my $className = shift; + my $protoClassName = shift; + my $interfaceName = shift; + my $visibleClassName = shift; + my $dataNode = shift; -bool ${constructorClassName}::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) -{ - return getStaticValueSlot<${constructorClassName}, DOMObject>(exec, &${constructorClassName}Table, this, propertyName, slot); -} + my $constructorClassName = "${className}Constructor"; + my $canConstruct = $dataNode->extendedAttributes->{"CanBeConstructed"}; + my $customConstructFunction = $dataNode->extendedAttributes->{"CustomConstructFunction"}; + my $callWith = $dataNode->extendedAttributes->{"CallWith"}; -bool ${constructorClassName}::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) -{ - return getStaticValueDescriptor<${constructorClassName}, DOMObject>(exec, &${constructorClassName}Table, this, propertyName, descriptor); -} + push(@$outputArray, "const ClassInfo ${constructorClassName}::s_info = { \"${visibleClassName}Constructor\", 0, &${constructorClassName}Table, 0 };\n\n"); -EOF + push(@$outputArray, "${constructorClassName}::${constructorClassName}(ExecState* exec, JSDOMGlobalObject* globalObject)\n"); + push(@$outputArray, " : DOMConstructorObject(${constructorClassName}::createStructure(globalObject->objectPrototype()), globalObject)\n"); + push(@$outputArray, "{\n"); + push(@$outputArray, " putDirect(exec->propertyNames().prototype, ${protoClassName}::self(exec, globalObject), DontDelete | ReadOnly);\n"); + push(@$outputArray, "}\n\n"); + + push(@$outputArray, "bool ${constructorClassName}::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)\n"); + push(@$outputArray, "{\n"); + push(@$outputArray, " return getStaticValueSlot<${constructorClassName}, DOMObject>(exec, &${constructorClassName}Table, this, propertyName, slot);\n"); + push(@$outputArray, "}\n\n"); - $implJSCInclude{"JSNumberCell.h"} = 1; # FIXME: What is this for? + push(@$outputArray, "bool ${constructorClassName}::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)\n"); + push(@$outputArray, "{\n"); + push(@$outputArray, " return getStaticValueDescriptor<${constructorClassName}, DOMObject>(exec, &${constructorClassName}Table, this, propertyName, descriptor);\n"); + push(@$outputArray, "}\n\n"); - return $implContent; + if ($canConstruct) { + if (!$customConstructFunction) { + push(@$outputArray, "EncodedJSValue JSC_HOST_CALL ${constructorClassName}::construct${className}(ExecState* exec)\n"); + push(@$outputArray, "{\n"); + my $constructorArg = ""; + if ($callWith and $callWith eq "ScriptExecutionContext") { + $constructorArg = "context"; + push(@$outputArray, " ScriptExecutionContext* context = static_cast<${constructorClassName}*>(exec->callee())->scriptExecutionContext();\n"); + push(@$outputArray, " if (!context)\n"); + push(@$outputArray, " return throwVMError(exec, createReferenceError(exec, \"Reference error\"));\n"); + } + push(@$outputArray, " return JSValue::encode(asObject(toJS(exec, static_cast<${constructorClassName}*>(exec->callee())->globalObject(), ${interfaceName}::create(${constructorArg}))));\n"); + push(@$outputArray, "}\n\n"); + } + + push(@$outputArray, "ConstructType ${constructorClassName}::getConstructData(ConstructData& constructData)\n"); + push(@$outputArray, "{\n"); + push(@$outputArray, " constructData.native.function = construct${className};\n"); + push(@$outputArray, " return ConstructTypeHost;\n"); + push(@$outputArray, "}\n\n"); + } } 1; diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm index 89da48d..daead72 100644 --- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm +++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm @@ -5,6 +5,7 @@ # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> # Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> +# Copyright (C) 2010 Google Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public @@ -740,8 +741,8 @@ sub GenerateHeader foreach my $attribute (@{$dataNode->attributes}) { my $attributeName = $attribute->signature->name; - if ($attributeName eq "id" or $attributeName eq "hash") { - # Special case attributes id and hash to be idName and hashName to avoid ObjC naming conflict. + if ($attributeName eq "id" or $attributeName eq "hash" or $attributeName eq "description") { + # Special case some attributes (like id and hash) to have a "Name" suffix to avoid ObjC naming conflicts. $attributeName .= "Name"; } elsif ($attributeName eq "frame") { # Special case attribute frame to be frameBorders. @@ -1157,8 +1158,8 @@ sub GenerateImplementation my $attributeClassName = GetClassName($attribute->signature->type); my $attributeInterfaceName = $attributeName; - if ($attributeName eq "id" or $attributeName eq "hash") { - # Special case attributes id and hash to be idName and hashName to avoid ObjC naming conflict. + if ($attributeName eq "id" or $attributeName eq "hash" or $attributeName eq "description") { + # Special case some attributes (like id and hash) to have a "Name" suffix to avoid ObjC naming conflicts. $attributeInterfaceName .= "Name"; } elsif ($attributeName eq "frame") { # Special case attribute frame to be frameBorders. diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm index 058d1cc..e471500 100644 --- a/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -273,6 +273,13 @@ END END } + if ($implClassName eq "HTMLDocument") { + push(@headerContent, <<END); + static v8::Local<v8::Object> WrapInShadowObject(v8::Local<v8::Object> wrapper, Node* impl); + static v8::Handle<v8::Value> GetNamedProperty(HTMLDocument* htmlDocument, const AtomicString& key); +END + } + my @enabledAtRuntime; foreach my $function (@{$dataNode->functions}) { my $name = $function->signature->name; @@ -289,7 +296,7 @@ END } } - if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"}) { + if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"}) { push(@headerContent, <<END); static v8::Handle<v8::Value> constructorCallback(const v8::Arguments& args); END @@ -360,9 +367,6 @@ sub GetInternalFields if (IsSubType($dataNode, "Document")) { push(@customInternalFields, "implementationIndex"); - if ($name eq "HTMLDocument") { - push(@customInternalFields, ("markerIndex", "shadowIndex")); - } } elsif ($name eq "DOMWindow") { push(@customInternalFields, "enteredIsolatedWorldIndex"); } @@ -399,7 +403,6 @@ END my %indexerSpecialCases = ( "Storage" => 1, "HTMLAppletElement" => 1, - "HTMLDocument" => 1, "HTMLEmbedElement" => 1, "HTMLObjectElement" => 1 ); @@ -426,42 +429,47 @@ sub GenerateHeaderNamedAndIndexedPropertyAccessors if ($interfaceName eq "HTMLSelectElement" || $interfaceName eq "HTMLAppletElement" || $interfaceName eq "HTMLEmbedElement" || $interfaceName eq "HTMLObjectElement") { $hasCustomNamedGetter = 1; } + if ($interfaceName eq "HTMLDocument") { + $hasCustomNamedGetter = 0; + $hasCustomIndexedGetter = 0; + } my $isIndexerSpecialCase = exists $indexerSpecialCases{$interfaceName}; if ($hasCustomIndexedGetter || $isIndexerSpecialCase) { push(@headerContent, <<END); - static v8::Handle<v8::Value> indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> indexedPropertyGetter(uint32_t, const v8::AccessorInfo&); END } if ($isIndexerSpecialCase || $hasCustomIndexedSetter) { push(@headerContent, <<END); - static v8::Handle<v8::Value> indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> indexedPropertySetter(uint32_t, v8::Local<v8::Value>, const v8::AccessorInfo&); END } if ($hasCustomDeleters) { push(@headerContent, <<END); - static v8::Handle<v8::Boolean> indexedPropertyDeleter(uint32_t index, const v8::AccessorInfo& info); + static v8::Handle<v8::Boolean> indexedPropertyDeleter(uint32_t, const v8::AccessorInfo&); END } if ($hasCustomNamedGetter) { push(@headerContent, <<END); - static v8::Handle<v8::Value> namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> namedPropertyGetter(v8::Local<v8::String>, const v8::AccessorInfo&); END } if ($hasCustomNamedSetter) { push(@headerContent, <<END); - static v8::Handle<v8::Value> namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> namedPropertySetter(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::AccessorInfo&); END } - if ($hasCustomDeleters || $interfaceName eq "HTMLDocument") { + if ($hasCustomDeleters) { push(@headerContent, <<END); - static v8::Handle<v8::Boolean> namedPropertyDeleter(v8::Local<v8::String> name, const v8::AccessorInfo& info); + static v8::Handle<v8::Boolean> namedPropertyDeleter(v8::Local<v8::String>, const v8::AccessorInfo&); END } if ($hasCustomEnumerator) { push(@headerContent, <<END); - static v8::Handle<v8::Array> namedPropertyEnumerator(const v8::AccessorInfo& info); + static v8::Handle<v8::Array> namedPropertyEnumerator(const v8::AccessorInfo&); + static v8::Handle<v8::Integer> namedPropertyQuery(v8::Local<v8::String>, const v8::AccessorInfo&); END } } @@ -1504,6 +1512,10 @@ sub GenerateImplementationNamedPropertyGetter $hasCustomGetter = 1; } + if ($interfaceName eq "HTMLDocument") { + $hasCustomGetter = 0; + } + my $hasGetter = $dataNode->extendedAttributes->{"HasNameGetter"} || $hasCustomGetter || $namedPropertyGetter; if (!$hasGetter) { return; @@ -1519,8 +1531,7 @@ END } my $hasSetter = $dataNode->extendedAttributes->{"DelegatingPutFunction"}; - # FIXME: Try to remove hard-coded HTMLDocument reference by aligning handling of document.all with JSC bindings. - my $hasDeleter = $dataNode->extendedAttributes->{"CustomDeleteProperty"} || $interfaceName eq "HTMLDocument"; + my $hasDeleter = $dataNode->extendedAttributes->{"CustomDeleteProperty"}; my $hasEnumerator = $dataNode->extendedAttributes->{"CustomGetPropertyNames"}; my $setOn = "Instance"; @@ -1536,7 +1547,8 @@ END push(@implContent, " desc->${setOn}Template()->SetNamedPropertyHandler(V8${interfaceName}::namedPropertyGetter, "); push(@implContent, $hasSetter ? "V8${interfaceName}::namedPropertySetter, " : "0, "); - push(@implContent, "0, "); # NamedPropertyQuery -- not being used at the moment. + # If there is a custom enumerator, there MUST be custom query to properly communicate property attributes. + push(@implContent, $hasEnumerator ? "V8${interfaceName}::namedPropertyQuery, " : "0, "); push(@implContent, $hasDeleter ? "V8${interfaceName}::namedPropertyDeleter, " : "0, "); push(@implContent, $hasEnumerator ? "V8${interfaceName}::namedPropertyEnumerator" : "0"); push(@implContent, ");\n"); @@ -1780,7 +1792,7 @@ END push(@implContentDecls, "} // namespace ${interfaceName}Internal\n\n"); # In namespace WebCore, add generated implementation for 'CanBeConstructed'. - if ($dataNode->extendedAttributes->{"CanBeConstructed"} && !$dataNode->extendedAttributes->{"CustomConstructor"}) { + if ($dataNode->extendedAttributes->{"CanBeConstructed"} && !$dataNode->extendedAttributes->{"CustomConstructor"} && !$dataNode->extendedAttributes->{"V8CustomConstructor"}) { my $v8ConstructFunction; my $callWith = $dataNode->extendedAttributes->{"CallWith"}; if ($callWith and $callWith eq "ScriptExecutionContext") { @@ -1858,7 +1870,7 @@ END END } - if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"}) { + if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"}) { push(@implContent, <<END); desc->SetCallHandler(V8${interfaceName}::constructorCallback); END @@ -2003,6 +2015,11 @@ END instance->SetAccessCheckCallbacks(V8DOMWindow::namedSecurityCheck, V8DOMWindow::indexedSecurityCheck, v8::External::Wrap(&V8DOMWindow::info), false); END } + if ($interfaceName eq "HTMLDocument") { + push(@implContent, <<END); + desc->SetHiddenPrototype(true); +END + } if ($interfaceName eq "Location") { push(@implContent, <<END); @@ -2220,6 +2237,7 @@ sub GenerateCallbackImplementation $implIncludes{"V8CustomVoidCallback.h"} = 1; $implIncludes{"V8Proxy.h"} = 1; + push(@implContent, "#include <wtf/Assertions.h>\n\n"); push(@implContent, "namespace WebCore {\n\n"); push(@implContent, <<END); ${className}::${className}(v8::Local<v8::Object> callback) @@ -2261,15 +2279,20 @@ END push(@implContent, " if (v8Context.IsEmpty())\n"); push(@implContent, " return true;\n\n"); push(@implContent, " v8::Context::Scope scope(v8Context);\n\n"); - push(@implContent, " v8::Handle<v8::Value> argv[] = {\n"); my @argvs = (); foreach my $param (@params) { my $paramName = $param->name; - push(@argvs, " toV8(${paramName})"); + push(@implContent, " v8::Handle<v8::Value> ${paramName}Handle = toV8(${paramName});\n"); + push(@implContent, " if (${paramName}Handle.IsEmpty()) {\n"); + push(@implContent, " CRASH();\n"); + push(@implContent, " return true;\n"); + push(@implContent, " }\n"); + push(@argvs, " ${paramName}Handle"); } - push(@implContent, join(",\n", @argvs)); + push(@implContent, "\n v8::Handle<v8::Value> argv[] = {\n"); + push(@implContent, join(",\n", @argvs)); push(@implContent, "\n };\n\n"); push(@implContent, " bool callbackReturnValue = false;\n"); push(@implContent, " return !invokeCallback(m_callback, " . scalar(@params) . ", argv, callbackReturnValue, context);\n"); @@ -2531,6 +2554,11 @@ sub GenerateFunctionCallString() $result .= $indent . "EmptyScriptState state;\n"; $callWithArg = "&state"; $hasScriptState = 1; + } elsif ($callWith eq "ScriptExecutionContext") { + $result .= $indent . "ScriptExecutionContext* scriptContext = getScriptExecutionContext();\n"; + $result .= $indent . "if (!scriptContext)\n"; + $result .= $indent . " return v8::Undefined();\n"; + $callWithArg = "scriptContext"; } $functionString .= ", " if $index; $functionString .= $callWithArg; diff --git a/WebCore/bindings/scripts/IDLParser.pm b/WebCore/bindings/scripts/IDLParser.pm index 5b7beb3..3df96ab 100644 --- a/WebCore/bindings/scripts/IDLParser.pm +++ b/WebCore/bindings/scripts/IDLParser.pm @@ -21,6 +21,8 @@ package IDLParser; +use strict; + use IPC::Open2; use IDLStructure; @@ -82,7 +84,7 @@ sub Parse print " | *** Starting to parse $fileName...\n |\n" unless $beQuiet; - $pid = open2(\*PP_OUT, \*PP_IN, split(' ', $preprocessor), (map { "-D$_" } split(' ', $defines)), $fileName); + my $pid = open2(\*PP_OUT, \*PP_IN, split(' ', $preprocessor), (map { "-D$_" } split(' ', $defines)), $fileName); close PP_IN; my @documentContent = <PP_OUT>; close PP_OUT; @@ -148,7 +150,7 @@ sub dumpExtendedAttributes } my @temp; - while (($name, $value) = each(%{$attrs})) { + while ((my $name, my $value) = each(%{$attrs})) { push(@temp, "$name=$value"); } @@ -163,11 +165,11 @@ sub parseExtendedAttributes my %attrs = (); foreach my $value (split(/\s*,\s*/, $str)) { - ($name,$value) = split(/\s*=\s*/, $value, 2); + (my $name, my $val) = split(/\s*=\s*/, $value, 2); # Attributes with no value are set to be true - $value = 1 unless defined $value; - $attrs{$name} = $value; + $val = 1 unless defined $val; + $attrs{$name} = $val; die("Invalid extended attribute name: '$name'\n") if $name =~ /\s/; } @@ -232,9 +234,9 @@ sub ParseInterface # Match identifier of the interface, and enclosed data... $data =~ /$IDLStructure::interfaceSelector/; - $interfaceExtendedAttributes = (defined($1) ? $1 : " "); chop($interfaceExtendedAttributes); + my $interfaceExtendedAttributes = (defined($1) ? $1 : " "); chop($interfaceExtendedAttributes); $interfaceName = (defined($2) ? $2 : die("Parsing error!\nSource:\n$data\n)")); - $interfaceBase = (defined($3) ? $3 : ""); + my $interfaceBase = (defined($3) ? $3 : ""); $interfaceData = (defined($4) ? $4 : die("Parsing error!\nSource:\n$data\n)")); # Fill in known parts of the domClass datastructure now... diff --git a/WebCore/bindings/scripts/IDLStructure.pm b/WebCore/bindings/scripts/IDLStructure.pm index e060252..d61fce1 100644 --- a/WebCore/bindings/scripts/IDLStructure.pm +++ b/WebCore/bindings/scripts/IDLStructure.pm @@ -21,6 +21,8 @@ package IDLStructure; +use strict; + use Class::Struct; # Used to represent a parsed IDL document @@ -70,36 +72,36 @@ struct( domConstant => { }); # Helpers -$idlId = '[a-zA-Z0-9]'; # Generic identifier -$idlIdNs = '[a-zA-Z0-9:]'; # Generic identifier including namespace -$idlIdNsList = '[a-zA-Z0-9:,\ ]'; # List of Generic identifiers including namespace +our $idlId = '[a-zA-Z0-9]'; # Generic identifier +our $idlIdNs = '[a-zA-Z0-9:]'; # Generic identifier including namespace +our $idlIdNsList = '[a-zA-Z0-9:,\ ]'; # List of Generic identifiers including namespace -$idlType = '[a-zA-Z0-9_]'; # Generic type/"value string" identifier -$idlDataType = '[a-zA-Z0-9\ ]'; # Generic data type identifier +our $idlType = '[a-zA-Z0-9_]'; # Generic type/"value string" identifier +our $idlDataType = '[a-zA-Z0-9\ ]'; # Generic data type identifier # Magic IDL parsing regular expressions my $supportedTypes = "((?:unsigned )?(?:int|short|(?:long )?long)|(?:$idlIdNs*))"; # Special IDL notations -$extendedAttributeSyntax = '\[[^]]*\]'; # Used for extended attributes +our $extendedAttributeSyntax = '\[[^]]*\]'; # Used for extended attributes # Regular expression based IDL 'syntactical tokenizer' used in the IDLParser -$moduleSelector = 'module\s*(' . $idlId . '*)\s*{'; -$moduleNSSelector = 'module\s*(' . $idlId . '*)\s*\[ns\s*(' . $idlIdNs . '*)\s*(' . $idlIdNs . '*)\]\s*;'; -$constantSelector = 'const\s*' . $supportedTypes . '\s*(' . $idlType . '*)\s*=\s*(' . $idlType . '*)'; -$raisesSelector = 'raises\s*\((' . $idlIdNsList . '*)\s*\)'; -$getterRaisesSelector = '\bgetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)'; -$setterRaisesSelector = '\bsetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)'; +our $moduleSelector = 'module\s*(' . $idlId . '*)\s*{'; +our $moduleNSSelector = 'module\s*(' . $idlId . '*)\s*\[ns\s*(' . $idlIdNs . '*)\s*(' . $idlIdNs . '*)\]\s*;'; +our $constantSelector = 'const\s*' . $supportedTypes . '\s*(' . $idlType . '*)\s*=\s*(' . $idlType . '*)'; +our $raisesSelector = 'raises\s*\((' . $idlIdNsList . '*)\s*\)'; +our $getterRaisesSelector = '\bgetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)'; +our $setterRaisesSelector = '\bsetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)'; -$typeNamespaceSelector = '((?:' . $idlId . '*::)*)\s*(' . $idlDataType . '*)'; +our $typeNamespaceSelector = '((?:' . $idlId . '*::)*)\s*(' . $idlDataType . '*)'; -$exceptionSelector = 'exception\s*(' . $idlIdNs . '*)\s*([a-zA-Z\s{;]*};)'; -$exceptionSubSelector = '{\s*' . $supportedTypes . '\s*(' . $idlType . '*)\s*;\s*}'; +our $exceptionSelector = 'exception\s*(' . $idlIdNs . '*)\s*([a-zA-Z\s{;]*};)'; +our $exceptionSubSelector = '{\s*' . $supportedTypes . '\s*(' . $idlType . '*)\s*;\s*}'; -$interfaceSelector = 'interface\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([a-zA-Z0-9_=\s(),;:\[\]&\|]*)'; -$interfaceMethodSelector = '\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)\s*\(\s*([a-zA-Z0-9:\s,=\[\]]*)'; -$interfaceParameterSelector = 'in\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)'; +our $interfaceSelector = 'interface\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([a-zA-Z0-9_=\s(),;:\[\]&\|]*)'; +our $interfaceMethodSelector = '\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)\s*\(\s*([a-zA-Z0-9:\s,=\[\]]*)'; +our $interfaceParameterSelector = 'in\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . '\s*(' . $idlIdNs . '*)'; -$interfaceAttributeSelector = '\s*(readonly attribute|attribute)\s*(' . $extendedAttributeSyntax . ' )?' . $supportedTypes . '\s*(' . $idlType . '*)'; +our $interfaceAttributeSelector = '\s*(readonly attribute|attribute)\s*(' . $extendedAttributeSyntax . ' )?' . $supportedTypes . '\s*(' . $idlType . '*)'; 1; diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp new file mode 100644 index 0000000..7235793 --- /dev/null +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp @@ -0,0 +1,113 @@ +/* + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" + +#if ENABLE(DATABASE) + +#include "WebDOMTestCallback.h" + +#include "AtomicString.h" +#include "Class1.h" +#include "Class2.h" +#include "Class3.h" +#include "KURL.h" +#include "TestCallback.h" +#include "WebDOMClass1.h" +#include "WebDOMClass2.h" +#include "WebDOMClass3.h" +#include "WebDOMString.h" +#include "WebExceptionHandler.h" +#include <wtf/GetPtr.h> +#include <wtf/RefPtr.h> + +struct WebDOMTestCallback::WebDOMTestCallbackPrivate { + WebDOMTestCallbackPrivate(WebCore::TestCallback* object = 0) + : impl(object) + { + } + + RefPtr<WebCore::TestCallback> impl; +}; + +WebDOMTestCallback::WebDOMTestCallback() + : WebDOMObject() + , m_impl(0) +{ +} + +WebDOMTestCallback::WebDOMTestCallback(WebCore::TestCallback* impl) + : WebDOMObject() + , m_impl(new WebDOMTestCallbackPrivate(impl)) +{ +} + +WebDOMTestCallback::WebDOMTestCallback(const WebDOMTestCallback& copy) + : WebDOMObject() +{ + m_impl = copy.impl() ? new WebDOMTestCallbackPrivate(copy.impl()) : 0; +} + +WebCore::TestCallback* WebDOMTestCallback::impl() const +{ + return m_impl ? m_impl->impl.get() : 0; +} + +WebDOMTestCallback::~WebDOMTestCallback() +{ + delete m_impl; + m_impl = 0; +} + +bool WebDOMTestCallback::callbackWithClass1Param(const WebDOMClass1& class1Param) +{ + if (!impl()) + return false; + + return impl()->callbackWithClass1Param(0, toWebCore(class1Param)); +} + +bool WebDOMTestCallback::callbackWithClass2Param(const WebDOMClass2& class2Param, const WebDOMString& strArg) +{ + if (!impl()) + return false; + + return impl()->callbackWithClass2Param(0, toWebCore(class2Param), strArg); +} + +int WebDOMTestCallback::callbackWithNonBoolReturnType(const WebDOMClass3& class3Param) +{ + if (!impl()) + return 0; + + return impl()->callbackWithNonBoolReturnType(0, toWebCore(class3Param)); +} + +WebCore::TestCallback* toWebCore(const WebDOMTestCallback& wrapper) +{ + return wrapper.impl(); +} + +WebDOMTestCallback toWebKit(WebCore::TestCallback* value) +{ + return WebDOMTestCallback(value); +} + +#endif // ENABLE(DATABASE) diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h new file mode 100644 index 0000000..3fe6837 --- /dev/null +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WebDOMTestCallback_h +#define WebDOMTestCallback_h + +#if ENABLE(DATABASE) + +#include <WebDOMObject.h> +#include <WebDOMString.h> + +namespace WebCore { +class TestCallback; +}; + +class WebDOMClass1; +class WebDOMClass2; +class WebDOMClass3; +class WebDOMClass5; +class WebDOMClass6; + +class WebDOMTestCallback : public WebDOMObject { +public: + WebDOMTestCallback(); + explicit WebDOMTestCallback(WebCore::TestCallback*); + WebDOMTestCallback(const WebDOMTestCallback&); + ~WebDOMTestCallback(); + + bool callbackWithClass1Param(const WebDOMClass1& class1Param); + bool callbackWithClass2Param(const WebDOMClass2& class2Param, const WebDOMString& strArg); + int callbackWithNonBoolReturnType(const WebDOMClass3& class3Param); + int customCallback(const WebDOMClass5& class5Param, const WebDOMClass6& class6Param); + + WebCore::TestCallback* impl() const; + +protected: + struct WebDOMTestCallbackPrivate; + WebDOMTestCallbackPrivate* m_impl; +}; + +WebCore::TestCallback* toWebCore(const WebDOMTestCallback&); +WebDOMTestCallback toWebKit(WebCore::TestCallback*); + +#endif +#endif // ENABLE(DATABASE) + diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp new file mode 100644 index 0000000..0b20841 --- /dev/null +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp @@ -0,0 +1,75 @@ +/* + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WebDOMTestInterface.h" + +#include "TestInterface.h" +#include "WebExceptionHandler.h" +#include <wtf/GetPtr.h> +#include <wtf/RefPtr.h> + +struct WebDOMTestInterface::WebDOMTestInterfacePrivate { + WebDOMTestInterfacePrivate(WebCore::TestInterface* object = 0) + : impl(object) + { + } + + RefPtr<WebCore::TestInterface> impl; +}; + +WebDOMTestInterface::WebDOMTestInterface() + : WebDOMObject() + , m_impl(0) +{ +} + +WebDOMTestInterface::WebDOMTestInterface(WebCore::TestInterface* impl) + : WebDOMObject() + , m_impl(new WebDOMTestInterfacePrivate(impl)) +{ +} + +WebDOMTestInterface::WebDOMTestInterface(const WebDOMTestInterface& copy) + : WebDOMObject() +{ + m_impl = copy.impl() ? new WebDOMTestInterfacePrivate(copy.impl()) : 0; +} + +WebCore::TestInterface* WebDOMTestInterface::impl() const +{ + return m_impl ? m_impl->impl.get() : 0; +} + +WebDOMTestInterface::~WebDOMTestInterface() +{ + delete m_impl; + m_impl = 0; +} + +WebCore::TestInterface* toWebCore(const WebDOMTestInterface& wrapper) +{ + return wrapper.impl(); +} + +WebDOMTestInterface toWebKit(WebCore::TestInterface* value) +{ + return WebDOMTestInterface(value); +} diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h new file mode 100644 index 0000000..d0cee5b --- /dev/null +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WebDOMTestInterface_h +#define WebDOMTestInterface_h + +#include <WebDOMObject.h> +#include <WebDOMString.h> + +namespace WebCore { +class TestInterface; +}; + + +class WebDOMTestInterface : public WebDOMObject { +public: + WebDOMTestInterface(); + explicit WebDOMTestInterface(WebCore::TestInterface*); + WebDOMTestInterface(const WebDOMTestInterface&); + ~WebDOMTestInterface(); + + + WebCore::TestInterface* impl() const; + +protected: + struct WebDOMTestInterfacePrivate; + WebDOMTestInterfacePrivate* m_impl; +}; + +WebCore::TestInterface* toWebCore(const WebDOMTestInterface&); +WebDOMTestInterface toWebKit(WebCore::TestInterface*); + +#endif diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp new file mode 100644 index 0000000..e540a57 --- /dev/null +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp @@ -0,0 +1,441 @@ +/* + * This file is part of the WebKit open source project. + * This file has been generated by generate-bindings.pl. DO NOT MODIFY! + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WebDOMTestObj.h" + +#include "AtomicString.h" +#include "KURL.h" +#include "SerializedScriptValue.h" +#include "TestObj.h" +#include "WebDOMString.h" +#include "WebExceptionHandler.h" +#include "WebNativeEventListener.h" +#include <wtf/GetPtr.h> +#include <wtf/RefPtr.h> + +struct WebDOMTestObj::WebDOMTestObjPrivate { + WebDOMTestObjPrivate(WebCore::TestObj* object = 0) + : impl(object) + { + } + + RefPtr<WebCore::TestObj> impl; +}; + +WebDOMTestObj::WebDOMTestObj() + : WebDOMObject() + , m_impl(0) +{ +} + +WebDOMTestObj::WebDOMTestObj(WebCore::TestObj* impl) + : WebDOMObject() + , m_impl(new WebDOMTestObjPrivate(impl)) +{ +} + +WebDOMTestObj::WebDOMTestObj(const WebDOMTestObj& copy) + : WebDOMObject() +{ + m_impl = copy.impl() ? new WebDOMTestObjPrivate(copy.impl()) : 0; +} + +WebCore::TestObj* WebDOMTestObj::impl() const +{ + return m_impl ? m_impl->impl.get() : 0; +} + +WebDOMTestObj::~WebDOMTestObj() +{ + delete m_impl; + m_impl = 0; +} + +int WebDOMTestObj::readOnlyIntAttr() const +{ + if (!impl()) + return 0; + + return impl()->readOnlyIntAttr(); +} + +WebDOMString WebDOMTestObj::readOnlyStringAttr() const +{ + if (!impl()) + return WebDOMString(); + + return static_cast<const WebCore::String&>(impl()->readOnlyStringAttr()); +} + +WebDOMTestObj WebDOMTestObj::readOnlyTestObjAttr() const +{ + if (!impl()) + return WebDOMTestObj(); + + return toWebKit(WTF::getPtr(impl()->readOnlyTestObjAttr())); +} + +int WebDOMTestObj::intAttr() const +{ + if (!impl()) + return 0; + + return impl()->intAttr(); +} + +void WebDOMTestObj::setIntAttr(int newIntAttr) +{ + if (!impl()) + return; + + impl()->setIntAttr(newIntAttr); +} + +long long WebDOMTestObj::longLongAttr() const +{ + if (!impl()) + return 0; + + return impl()->longLongAttr(); +} + +void WebDOMTestObj::setLongLongAttr(long long newLongLongAttr) +{ + if (!impl()) + return; + + impl()->setLongLongAttr(newLongLongAttr); +} + +unsigned long long WebDOMTestObj::unsignedLongLongAttr() const +{ + if (!impl()) + return 0; + + return impl()->unsignedLongLongAttr(); +} + +void WebDOMTestObj::setUnsignedLongLongAttr(unsigned long long newUnsignedLongLongAttr) +{ + if (!impl()) + return; + + impl()->setUnsignedLongLongAttr(newUnsignedLongLongAttr); +} + +WebDOMString WebDOMTestObj::stringAttr() const +{ + if (!impl()) + return WebDOMString(); + + return static_cast<const WebCore::String&>(impl()->stringAttr()); +} + +void WebDOMTestObj::setStringAttr(const WebDOMString& newStringAttr) +{ + if (!impl()) + return; + + impl()->setStringAttr(newStringAttr); +} + +WebDOMTestObj WebDOMTestObj::testObjAttr() const +{ + if (!impl()) + return WebDOMTestObj(); + + return toWebKit(WTF::getPtr(impl()->testObjAttr())); +} + +void WebDOMTestObj::setTestObjAttr(const WebDOMTestObj& newTestObjAttr) +{ + if (!impl()) + return; + + impl()->setTestObjAttr(toWebCore(newTestObjAttr)); +} + +int WebDOMTestObj::attrWithException() const +{ + if (!impl()) + return 0; + + return impl()->attrWithException(); +} + +void WebDOMTestObj::setAttrWithException(int newAttrWithException) +{ + if (!impl()) + return; + + impl()->setAttrWithException(newAttrWithException); +} + +int WebDOMTestObj::attrWithSetterException() const +{ + if (!impl()) + return 0; + + WebCore::ExceptionCode ec = 0; + int result = impl()->attrWithSetterException(ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); + return result; +} + +void WebDOMTestObj::setAttrWithSetterException(int newAttrWithSetterException) +{ + if (!impl()) + return; + + WebCore::ExceptionCode ec = 0; + impl()->setAttrWithSetterException(newAttrWithSetterException, ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); +} + +int WebDOMTestObj::attrWithGetterException() const +{ + if (!impl()) + return 0; + + return impl()->attrWithGetterException(); +} + +void WebDOMTestObj::setAttrWithGetterException(int newAttrWithGetterException) +{ + if (!impl()) + return; + + WebCore::ExceptionCode ec = 0; + impl()->setAttrWithGetterException(newAttrWithGetterException, ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); +} + +WebDOMString WebDOMTestObj::scriptStringAttr() const +{ + if (!impl()) + return WebDOMString(); + + return static_cast<const WebCore::String&>(impl()->scriptStringAttr()); +} + +void WebDOMTestObj::voidMethod() +{ + if (!impl()) + return; + + impl()->voidMethod(); +} + +void WebDOMTestObj::voidMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg) +{ + if (!impl()) + return; + + impl()->voidMethodWithArgs(intArg, strArg, toWebCore(objArg)); +} + +int WebDOMTestObj::intMethod() +{ + if (!impl()) + return 0; + + return impl()->intMethod(); +} + +int WebDOMTestObj::intMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg) +{ + if (!impl()) + return 0; + + return impl()->intMethodWithArgs(intArg, strArg, toWebCore(objArg)); +} + +WebDOMTestObj WebDOMTestObj::objMethod() +{ + if (!impl()) + return WebDOMTestObj(); + + return toWebKit(WTF::getPtr(impl()->objMethod())); +} + +WebDOMTestObj WebDOMTestObj::objMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg) +{ + if (!impl()) + return WebDOMTestObj(); + + return toWebKit(WTF::getPtr(impl()->objMethodWithArgs(intArg, strArg, toWebCore(objArg)))); +} + +WebDOMTestObj WebDOMTestObj::methodThatRequiresAllArgs(const WebDOMString& strArg, const WebDOMTestObj& objArg) +{ + if (!impl()) + return WebDOMTestObj(); + + return toWebKit(WTF::getPtr(impl()->methodThatRequiresAllArgs(strArg, toWebCore(objArg)))); +} + +WebDOMTestObj WebDOMTestObj::methodThatRequiresAllArgsAndThrows(const WebDOMString& strArg, const WebDOMTestObj& objArg) +{ + if (!impl()) + return WebDOMTestObj(); + + WebCore::ExceptionCode ec = 0; + WebDOMTestObj result = toWebKit(WTF::getPtr(impl()->methodThatRequiresAllArgsAndThrows(strArg, toWebCore(objArg), ec))); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); + return result; +} + +void WebDOMTestObj::serializedValue(const WebDOMString& serializedArg) +{ + if (!impl()) + return; + + impl()->serializedValue(WebCore::SerializedScriptValue::create(WebCore::String(serializedArg))); +} + +void WebDOMTestObj::methodWithException() +{ + if (!impl()) + return; + + WebCore::ExceptionCode ec = 0; + impl()->methodWithException(ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); +} + +void WebDOMTestObj::addEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture) +{ + if (!impl()) + return; + + impl()->addEventListener(type, toWebCore(listener), useCapture); +} + +void WebDOMTestObj::removeEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture) +{ + if (!impl()) + return; + + impl()->removeEventListener(type, toWebCore(listener), useCapture); +} + +void WebDOMTestObj::withDynamicFrame() +{ + if (!impl()) + return; + + impl()->withDynamicFrame(); +} + +void WebDOMTestObj::withDynamicFrameAndArg(int intArg) +{ + if (!impl()) + return; + + impl()->withDynamicFrameAndArg(intArg); +} + +void WebDOMTestObj::withDynamicFrameAndOptionalArg(int intArg, int optionalArg) +{ + if (!impl()) + return; + + impl()->withDynamicFrameAndOptionalArg(intArg, optionalArg); +} + +void WebDOMTestObj::withScriptStateVoid() +{ + if (!impl()) + return; + + impl()->withScriptStateVoid(); +} + +WebDOMTestObj WebDOMTestObj::withScriptStateObj() +{ + if (!impl()) + return WebDOMTestObj(); + + return toWebKit(WTF::getPtr(impl()->withScriptStateObj())); +} + +void WebDOMTestObj::withScriptStateVoidException() +{ + if (!impl()) + return; + + WebCore::ExceptionCode ec = 0; + impl()->withScriptStateVoidException(ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); +} + +WebDOMTestObj WebDOMTestObj::withScriptStateObjException() +{ + if (!impl()) + return WebDOMTestObj(); + + WebCore::ExceptionCode ec = 0; + WebDOMTestObj result = toWebKit(WTF::getPtr(impl()->withScriptStateObjException(ec))); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); + return result; +} + +void WebDOMTestObj::withScriptExecutionContext() +{ + if (!impl()) + return; + + impl()->withScriptExecutionContext(); +} + +void WebDOMTestObj::methodWithOptionalArg(int opt) +{ + if (!impl()) + return; + + impl()->methodWithOptionalArg(opt); +} + +void WebDOMTestObj::methodWithNonOptionalArgAndOptionalArg(int nonOpt, int opt) +{ + if (!impl()) + return; + + impl()->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt); +} + +void WebDOMTestObj::methodWithNonOptionalArgAndTwoOptionalArgs(int nonOpt, int opt1, int opt2) +{ + if (!impl()) + return; + + impl()->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2); +} + +WebCore::TestObj* toWebCore(const WebDOMTestObj& wrapper) +{ + return wrapper.impl(); +} + +WebDOMTestObj toWebKit(WebCore::TestObj* value) +{ + return WebDOMTestObj(value); +} diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h new file mode 100644 index 0000000..7bcd988 --- /dev/null +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h @@ -0,0 +1,105 @@ +/* + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WebDOMTestObj_h +#define WebDOMTestObj_h + +#include <WebDOMObject.h> +#include <WebDOMString.h> + +namespace WebCore { +class TestObj; +}; + +class WebDOMEventListener; +class WebDOMString; +class WebDOMTestObj; + +class WebDOMTestObj : public WebDOMObject { +public: + WebDOMTestObj(); + explicit WebDOMTestObj(WebCore::TestObj*); + WebDOMTestObj(const WebDOMTestObj&); + ~WebDOMTestObj(); + + int readOnlyIntAttr() const; + WebDOMString readOnlyStringAttr() const; + WebDOMTestObj readOnlyTestObjAttr() const; + int intAttr() const; + void setIntAttr(int); + long long longLongAttr() const; + void setLongLongAttr(long long); + unsigned long long unsignedLongLongAttr() const; + void setUnsignedLongLongAttr(unsigned long long); + WebDOMString stringAttr() const; + void setStringAttr(const WebDOMString&); + WebDOMTestObj testObjAttr() const; + void setTestObjAttr(const WebDOMTestObj&); + int attrWithException() const; + void setAttrWithException(int); + int attrWithSetterException() const; + void setAttrWithSetterException(int); + int attrWithGetterException() const; + void setAttrWithGetterException(int); + int customAttr() const; + void setCustomAttr(int); + WebDOMString scriptStringAttr() const; + + void voidMethod(); + void voidMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); + int intMethod(); + int intMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); + WebDOMTestObj objMethod(); + WebDOMTestObj objMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); + WebDOMTestObj methodThatRequiresAllArgs(const WebDOMString& strArg, const WebDOMTestObj& objArg); + WebDOMTestObj methodThatRequiresAllArgsAndThrows(const WebDOMString& strArg, const WebDOMTestObj& objArg); + void serializedValue(const WebDOMString& serializedArg); + void methodWithException(); + void customMethod(); + void customMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); + void addEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture); + void removeEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture); + void withDynamicFrame(); + void withDynamicFrameAndArg(int intArg); + void withDynamicFrameAndOptionalArg(int intArg, int optionalArg); + void withDynamicFrameAndUserGesture(int intArg); + void withDynamicFrameAndUserGestureASAD(int intArg, int optionalArg); + void withScriptStateVoid(); + WebDOMTestObj withScriptStateObj(); + void withScriptStateVoidException(); + WebDOMTestObj withScriptStateObjException(); + void withScriptExecutionContext(); + void methodWithOptionalArg(int opt); + void methodWithNonOptionalArgAndOptionalArg(int nonOpt, int opt); + void methodWithNonOptionalArgAndTwoOptionalArgs(int nonOpt, int opt1, int opt2); + + WebCore::TestObj* impl() const; + +protected: + struct WebDOMTestObjPrivate; + WebDOMTestObjPrivate* m_impl; +}; + +WebCore::TestObj* toWebCore(const WebDOMTestObj&); +WebDOMTestObj toWebKit(WebCore::TestObj*); + +#endif diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp index 505b59b..a67b6ac 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp @@ -53,7 +53,7 @@ gpointer kit(WebCore::TestCallback* obj) } // namespace WebKit // gboolean -webkit_dom_test_callback_callback_with_class1param (WebKitDOMTestCallback *self, WebKitDOMClass1* class1param) +webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param) { g_return_val_if_fail (self, 0); WebCore::TestCallback * item = WebKit::core(self); @@ -62,11 +62,10 @@ webkit_dom_test_callback_callback_with_class1param (WebKitDOMTestCallback *self, g_return_val_if_fail (_g_class1param, 0); gboolean res = item->callbackWithClass1Param(_g_class1param); return res; - } gboolean -webkit_dom_test_callback_callback_with_class2param (WebKitDOMTestCallback *self, WebKitDOMClass2* class2param, gchar* str_arg) +webkit_dom_test_callback_callback_with_class2param(WebKitDOMTestCallback* self, WebKitDOMClass2* class2param, gchar* str_arg) { g_return_val_if_fail (self, 0); WebCore::TestCallback * item = WebKit::core(self); @@ -77,11 +76,10 @@ webkit_dom_test_callback_callback_with_class2param (WebKitDOMTestCallback *self, WebCore::String _g_str_arg = WebCore::String::fromUTF8(str_arg); gboolean res = item->callbackWithClass2Param(_g_class2param, _g_str_arg); return res; - } glong -webkit_dom_test_callback_callback_with_non_bool_return_type (WebKitDOMTestCallback *self, WebKitDOMClass3* class3param) +webkit_dom_test_callback_callback_with_non_bool_return_type(WebKitDOMTestCallback* self, WebKitDOMClass3* class3param) { g_return_val_if_fail (self, 0); WebCore::TestCallback * item = WebKit::core(self); @@ -90,7 +88,6 @@ webkit_dom_test_callback_callback_with_non_bool_return_type (WebKitDOMTestCallba g_return_val_if_fail (_g_class3param, 0); glong res = item->callbackWithNonBoolReturnType(_g_class3param); return res; - } @@ -132,8 +129,8 @@ static void webkit_dom_test_callback_finalize(GObject* object) static void webkit_dom_test_callback_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) { - switch (prop_id) { - default: + switch (prop_id) { + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } @@ -142,8 +139,8 @@ static void webkit_dom_test_callback_set_property(GObject* object, guint prop_id static void webkit_dom_test_callback_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) { - switch (prop_id) { - default: + switch (prop_id) { + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h index 088c457..cfc883d 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h @@ -47,13 +47,13 @@ WEBKIT_API GType webkit_dom_test_callback_get_type (void); WEBKIT_API gboolean -webkit_dom_test_callback_callback_with_class1param (WebKitDOMTestCallback *self, WebKitDOMClass1* class1param); +webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param); WEBKIT_API gboolean -webkit_dom_test_callback_callback_with_class2param (WebKitDOMTestCallback *self, WebKitDOMClass2* class2param, gchar* str_arg); +webkit_dom_test_callback_callback_with_class2param(WebKitDOMTestCallback* self, WebKitDOMClass2* class2param, gchar* str_arg); WEBKIT_API glong -webkit_dom_test_callback_callback_with_non_bool_return_type (WebKitDOMTestCallback *self, WebKitDOMClass3* class3param); +webkit_dom_test_callback_callback_with_non_bool_return_type(WebKitDOMTestCallback* self, WebKitDOMClass3* class3param); G_END_DECLS diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp index 17548d9..0d0021d 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp @@ -85,8 +85,8 @@ static void webkit_dom_test_interface_finalize(GObject* object) static void webkit_dom_test_interface_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) { - switch (prop_id) { - default: + switch (prop_id) { + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } @@ -95,8 +95,8 @@ static void webkit_dom_test_interface_set_property(GObject* object, guint prop_i static void webkit_dom_test_interface_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) { - switch (prop_id) { - default: + switch (prop_id) { + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp index 2fa8c00..5dfb255 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -49,16 +49,15 @@ gpointer kit(WebCore::TestObj* obj) } // namespace WebKit // void -webkit_dom_test_obj_void_method (WebKitDOMTestObj *self) +webkit_dom_test_obj_void_method(WebKitDOMTestObj* self) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->voidMethod(); - } void -webkit_dom_test_obj_void_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) +webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); @@ -68,21 +67,19 @@ webkit_dom_test_obj_void_method_with_args (WebKitDOMTestObj *self, glong int_arg WebCore::TestObj * _g_obj_arg = WebKit::core(obj_arg); g_return_if_fail (_g_obj_arg); item->voidMethodWithArgs(int_arg, _g_str_arg, _g_obj_arg); - } glong -webkit_dom_test_obj_int_method (WebKitDOMTestObj *self) +webkit_dom_test_obj_int_method(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); glong res = item->intMethod(); return res; - } glong -webkit_dom_test_obj_int_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) +webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); @@ -93,22 +90,20 @@ webkit_dom_test_obj_int_method_with_args (WebKitDOMTestObj *self, glong int_arg, g_return_val_if_fail (_g_obj_arg, 0); glong res = item->intMethodWithArgs(int_arg, _g_str_arg, _g_obj_arg); return res; - } WebKitDOMTestObj* -webkit_dom_test_obj_obj_method (WebKitDOMTestObj *self) +webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->objMethod()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; - } WebKitDOMTestObj* -webkit_dom_test_obj_obj_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) +webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); @@ -120,11 +115,10 @@ webkit_dom_test_obj_obj_method_with_args (WebKitDOMTestObj *self, glong int_arg, PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->objMethodWithArgs(int_arg, _g_str_arg, _g_obj_arg)); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; - } WebKitDOMTestObj* -webkit_dom_test_obj_method_that_requires_all_args (WebKitDOMTestObj *self, gchar* str_arg, WebKitDOMTestObj* obj_arg) +webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); @@ -136,11 +130,10 @@ webkit_dom_test_obj_method_that_requires_all_args (WebKitDOMTestObj *self, gchar PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->methodThatRequiresAllArgs(_g_str_arg, _g_obj_arg)); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; - } WebKitDOMTestObj* -webkit_dom_test_obj_method_that_requires_all_args_and_throws (WebKitDOMTestObj *self, gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error) +webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); @@ -158,11 +151,10 @@ webkit_dom_test_obj_method_that_requires_all_args_and_throws (WebKitDOMTestObj * } WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; - } void -webkit_dom_test_obj_serialized_value (WebKitDOMTestObj *self, WebKitDOMSerializedScriptValue* serialized_arg) +webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerializedScriptValue* serialized_arg) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); @@ -170,11 +162,10 @@ webkit_dom_test_obj_serialized_value (WebKitDOMTestObj *self, WebKitDOMSerialize WebCore::SerializedScriptValue * _g_serialized_arg = WebKit::core(serialized_arg); g_return_if_fail (_g_serialized_arg); item->serializedValue(_g_serialized_arg); - } void -webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **error) +webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); @@ -185,7 +176,6 @@ webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **erro WebCore::getExceptionCodeDescription(ec, ecdesc); g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); } - } @@ -195,72 +185,65 @@ webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **erro /* TODO: event function webkit_dom_test_obj_remove_event_listener */ void -webkit_dom_test_obj_with_dynamic_frame (WebKitDOMTestObj *self) +webkit_dom_test_obj_with_dynamic_frame(WebKitDOMTestObj* self) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrame(); - } void -webkit_dom_test_obj_with_dynamic_frame_and_arg (WebKitDOMTestObj *self, glong int_arg) +webkit_dom_test_obj_with_dynamic_frame_and_arg(WebKitDOMTestObj* self, glong int_arg) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrameAndArg(int_arg); - } void -webkit_dom_test_obj_with_dynamic_frame_and_optional_arg (WebKitDOMTestObj *self, glong int_arg, glong optional_arg) +webkit_dom_test_obj_with_dynamic_frame_and_optional_arg(WebKitDOMTestObj* self, glong int_arg, glong optional_arg) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrameAndOptionalArg(int_arg, optional_arg); - } void -webkit_dom_test_obj_with_dynamic_frame_and_user_gesture (WebKitDOMTestObj *self, glong int_arg) +webkit_dom_test_obj_with_dynamic_frame_and_user_gesture(WebKitDOMTestObj* self, glong int_arg) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrameAndUserGesture(int_arg); - } void -webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad (WebKitDOMTestObj *self, glong int_arg, glong optional_arg) +webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* self, glong int_arg, glong optional_arg) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrameAndUserGestureASAD(int_arg, optional_arg); - } void -webkit_dom_test_obj_with_script_state_void (WebKitDOMTestObj *self) +webkit_dom_test_obj_with_script_state_void(WebKitDOMTestObj* self) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->withScriptStateVoid(); - } WebKitDOMTestObj* -webkit_dom_test_obj_with_script_state_obj (WebKitDOMTestObj *self) +webkit_dom_test_obj_with_script_state_obj(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptStateObj()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; - } void -webkit_dom_test_obj_with_script_state_void_exception (WebKitDOMTestObj *self, GError **error) +webkit_dom_test_obj_with_script_state_void_exception(WebKitDOMTestObj* self, GError **error) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); @@ -271,11 +254,10 @@ webkit_dom_test_obj_with_script_state_void_exception (WebKitDOMTestObj *self, GE WebCore::getExceptionCodeDescription(ec, ecdesc); g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); } - } WebKitDOMTestObj* -webkit_dom_test_obj_with_script_state_obj_exception (WebKitDOMTestObj *self, GError **error) +webkit_dom_test_obj_with_script_state_obj_exception(WebKitDOMTestObj* self, GError **error) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); @@ -288,158 +270,150 @@ webkit_dom_test_obj_with_script_state_obj_exception (WebKitDOMTestObj *self, GEr } WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; +} +void +webkit_dom_test_obj_with_script_execution_context(WebKitDOMTestObj* self) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->withScriptExecutionContext(); } void -webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt) +webkit_dom_test_obj_method_with_optional_arg(WebKitDOMTestObj* self, glong opt) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->methodWithOptionalArg(opt); - } void -webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg (WebKitDOMTestObj *self, glong non_opt, glong opt) +webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg(WebKitDOMTestObj* self, glong non_opt, glong opt) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->methodWithNonOptionalArgAndOptionalArg(non_opt, opt); - } void -webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args (WebKitDOMTestObj *self, glong non_opt, glong opt1, glong opt2) +webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOMTestObj* self, glong non_opt, glong opt1, glong opt2) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->methodWithNonOptionalArgAndTwoOptionalArgs(non_opt, opt1, opt2); - } glong -webkit_dom_test_obj_get_read_only_int_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); glong res = item->readOnlyIntAttr(); return res; - } gchar* -webkit_dom_test_obj_get_read_only_string_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_read_only_string_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->readOnlyStringAttr()); return res; - } WebKitDOMTestObj* -webkit_dom_test_obj_get_read_only_test_obj_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_read_only_test_obj_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->readOnlyTestObjAttr()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; - } glong -webkit_dom_test_obj_get_int_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_int_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); glong res = item->intAttr(); return res; - } void -webkit_dom_test_obj_set_int_attr (WebKitDOMTestObj *self, glong value) +webkit_dom_test_obj_set_int_attr(WebKitDOMTestObj* self, glong value) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->setIntAttr(value); - } gint64 -webkit_dom_test_obj_get_long_long_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_long_long_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); gint64 res = item->longLongAttr(); return res; - } void -webkit_dom_test_obj_set_long_long_attr (WebKitDOMTestObj *self, gint64 value) +webkit_dom_test_obj_set_long_long_attr(WebKitDOMTestObj* self, gint64 value) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->setLongLongAttr(value); - } guint64 -webkit_dom_test_obj_get_unsigned_long_long_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_unsigned_long_long_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); guint64 res = item->unsignedLongLongAttr(); return res; - } void -webkit_dom_test_obj_set_unsigned_long_long_attr (WebKitDOMTestObj *self, guint64 value) +webkit_dom_test_obj_set_unsigned_long_long_attr(WebKitDOMTestObj* self, guint64 value) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->setUnsignedLongLongAttr(value); - } gchar* -webkit_dom_test_obj_get_string_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_string_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->stringAttr()); return res; - } void -webkit_dom_test_obj_set_string_attr (WebKitDOMTestObj *self, gchar* value) +webkit_dom_test_obj_set_string_attr(WebKitDOMTestObj* self, gchar* value) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); g_return_if_fail (value); WebCore::String _g_value = WebCore::String::fromUTF8(value); item->setStringAttr(_g_value); - } WebKitDOMTestObj* -webkit_dom_test_obj_get_test_obj_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_test_obj_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->testObjAttr()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); return res; - } void -webkit_dom_test_obj_set_test_obj_attr (WebKitDOMTestObj *self, WebKitDOMTestObj* value) +webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); @@ -447,30 +421,27 @@ webkit_dom_test_obj_set_test_obj_attr (WebKitDOMTestObj *self, WebKitDOMTestObj* WebCore::TestObj * _g_value = WebKit::core(value); g_return_if_fail (_g_value); item->setTestObjAttr(_g_value); - } glong -webkit_dom_test_obj_get_attr_with_exception (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_attr_with_exception(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); glong res = item->attrWithException(); return res; - } void -webkit_dom_test_obj_set_attr_with_exception (WebKitDOMTestObj *self, glong value) +webkit_dom_test_obj_set_attr_with_exception(WebKitDOMTestObj* self, glong value) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); item->setAttrWithException(value); - } glong -webkit_dom_test_obj_get_attr_with_setter_exception (WebKitDOMTestObj *self, GError **error) +webkit_dom_test_obj_get_attr_with_setter_exception(WebKitDOMTestObj* self, GError **error) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); @@ -482,11 +453,10 @@ webkit_dom_test_obj_get_attr_with_setter_exception (WebKitDOMTestObj *self, GErr g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); } return res; - } void -webkit_dom_test_obj_set_attr_with_setter_exception (WebKitDOMTestObj *self, glong value, GError **error) +webkit_dom_test_obj_set_attr_with_setter_exception(WebKitDOMTestObj* self, glong value, GError **error) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); @@ -497,21 +467,19 @@ webkit_dom_test_obj_set_attr_with_setter_exception (WebKitDOMTestObj *self, glon WebCore::getExceptionCodeDescription(ec, ecdesc); g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); } - } glong -webkit_dom_test_obj_get_attr_with_getter_exception (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); glong res = item->attrWithGetterException(); return res; - } void -webkit_dom_test_obj_set_attr_with_getter_exception (WebKitDOMTestObj *self, glong value, GError **error) +webkit_dom_test_obj_set_attr_with_getter_exception(WebKitDOMTestObj* self, glong value, GError **error) { g_return_if_fail (self); WebCore::TestObj * item = WebKit::core(self); @@ -522,17 +490,50 @@ webkit_dom_test_obj_set_attr_with_getter_exception (WebKitDOMTestObj *self, glon WebCore::getExceptionCodeDescription(ec, ecdesc); g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); } - } gchar* -webkit_dom_test_obj_get_script_string_attr (WebKitDOMTestObj *self) +webkit_dom_test_obj_get_script_string_attr(WebKitDOMTestObj* self) { g_return_val_if_fail (self, 0); WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->scriptStringAttr()); return res; +} +glong +webkit_dom_test_obj_get_description(WebKitDOMTestObj* self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + glong res = item->description(); + return res; +} + +glong +webkit_dom_test_obj_get_id(WebKitDOMTestObj* self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + glong res = item->id(); + return res; +} + +void +webkit_dom_test_obj_set_id(WebKitDOMTestObj* self, glong value) +{ + g_return_if_fail (self); + WebCore::TestObj * item = WebKit::core(self); + item->setId(value); +} + +gchar* +webkit_dom_test_obj_get_hash(WebKitDOMTestObj* self) +{ + g_return_val_if_fail (self, 0); + WebCore::TestObj * item = WebKit::core(self); + gchar* res = convertToUTF8String(item->hash()); + return res; } @@ -566,6 +567,9 @@ enum { PROP_ATTR_WITH_GETTER_EXCEPTION, PROP_CUSTOM_ATTR, PROP_SCRIPT_STRING_ATTR, + PROP_DESCRIPTION, + PROP_ID, + PROP_HASH, }; @@ -587,42 +591,47 @@ static void webkit_dom_test_obj_finalize(GObject* object) static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) { - WebKitDOMTestObj *self = WEBKIT_DOM_TEST_OBJ(object); + WebKitDOMTestObj* self = WEBKIT_DOM_TEST_OBJ(object); WebCore::TestObj* coreSelf = WebKit::core(self); - switch (prop_id) { + switch (prop_id) { case PROP_INT_ATTR: { - coreSelf->setIntAttr((g_value_get_long(value)) ); - break; + coreSelf->setIntAttr((g_value_get_long(value))); + break; } case PROP_UNSIGNED_LONG_LONG_ATTR: { - coreSelf->setUnsignedLongLongAttr((g_value_get_uint64(value)) ); - break; + coreSelf->setUnsignedLongLongAttr((g_value_get_uint64(value))); + break; } case PROP_STRING_ATTR: { - coreSelf->setStringAttr(WebCore::String::fromUTF8(g_value_get_string(value)) ); - break; + coreSelf->setStringAttr(WebCore::String::fromUTF8(g_value_get_string(value))); + break; } case PROP_ATTR_WITH_EXCEPTION: { - coreSelf->setAttrWithException((g_value_get_long(value)) ); - break; + coreSelf->setAttrWithException((g_value_get_long(value))); + break; } case PROP_ATTR_WITH_SETTER_EXCEPTION: { - WebCore::ExceptionCode ec = 0; - coreSelf->setAttrWithSetterException((g_value_get_long(value)) , ec ); - break; + WebCore::ExceptionCode ec = 0; + coreSelf->setAttrWithSetterException((g_value_get_long(value)), ec); + break; } case PROP_ATTR_WITH_GETTER_EXCEPTION: { - WebCore::ExceptionCode ec = 0; - coreSelf->setAttrWithGetterException((g_value_get_long(value)) , ec ); - break; + WebCore::ExceptionCode ec = 0; + coreSelf->setAttrWithGetterException((g_value_get_long(value)), ec); + break; } - default: + case PROP_ID: + { + coreSelf->setId((g_value_get_long(value))); + break; + } + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } @@ -631,73 +640,88 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) { - WebKitDOMTestObj* self = WEBKIT_DOM_TEST_OBJ(object); + WebKitDOMTestObj* self = WEBKIT_DOM_TEST_OBJ(object); WebCore::TestObj* coreSelf = WebKit::core(self); - switch (prop_id) { + switch (prop_id) { case PROP_READ_ONLY_INT_ATTR: { - g_value_set_long(value, coreSelf->readOnlyIntAttr()); - break; + g_value_set_long(value, coreSelf->readOnlyIntAttr()); + break; } case PROP_READ_ONLY_STRING_ATTR: { - g_value_take_string(value, convertToUTF8String(coreSelf->readOnlyStringAttr())); - break; + g_value_take_string(value, convertToUTF8String(coreSelf->readOnlyStringAttr())); + break; } case PROP_READ_ONLY_TEST_OBJ_ATTR: { - RefPtr<WebCore::TestObj> ptr = coreSelf->readOnlyTestObjAttr(); + RefPtr<WebCore::TestObj> ptr = coreSelf->readOnlyTestObjAttr(); g_value_set_object(value, WebKit::kit(ptr.get())); - break; + break; } case PROP_INT_ATTR: { - g_value_set_long(value, coreSelf->intAttr()); - break; + g_value_set_long(value, coreSelf->intAttr()); + break; } case PROP_LONG_LONG_ATTR: { - g_value_set_int64(value, coreSelf->longLongAttr()); - break; + g_value_set_int64(value, coreSelf->longLongAttr()); + break; } case PROP_UNSIGNED_LONG_LONG_ATTR: { - g_value_set_uint64(value, coreSelf->unsignedLongLongAttr()); - break; + g_value_set_uint64(value, coreSelf->unsignedLongLongAttr()); + break; } case PROP_STRING_ATTR: { - g_value_take_string(value, convertToUTF8String(coreSelf->stringAttr())); - break; + g_value_take_string(value, convertToUTF8String(coreSelf->stringAttr())); + break; } case PROP_TEST_OBJ_ATTR: { - RefPtr<WebCore::TestObj> ptr = coreSelf->testObjAttr(); + RefPtr<WebCore::TestObj> ptr = coreSelf->testObjAttr(); g_value_set_object(value, WebKit::kit(ptr.get())); - break; + break; } case PROP_ATTR_WITH_EXCEPTION: { - g_value_set_long(value, coreSelf->attrWithException()); - break; + g_value_set_long(value, coreSelf->attrWithException()); + break; } case PROP_ATTR_WITH_SETTER_EXCEPTION: { - WebCore::ExceptionCode ec = 0; - g_value_set_long(value, coreSelf->attrWithSetterException(ec)); - break; + WebCore::ExceptionCode ec = 0; + g_value_set_long(value, coreSelf->attrWithSetterException(ec)); + break; } case PROP_ATTR_WITH_GETTER_EXCEPTION: { - g_value_set_long(value, coreSelf->attrWithGetterException()); - break; + g_value_set_long(value, coreSelf->attrWithGetterException()); + break; } case PROP_SCRIPT_STRING_ATTR: { - g_value_take_string(value, convertToUTF8String(coreSelf->scriptStringAttr())); - break; + g_value_take_string(value, convertToUTF8String(coreSelf->scriptStringAttr())); + break; + } + case PROP_DESCRIPTION: + { + g_value_set_long(value, coreSelf->description()); + break; + } + case PROP_ID: + { + g_value_set_long(value, coreSelf->id()); + break; } - default: + case PROP_HASH: + { + g_value_take_string(value, convertToUTF8String(coreSelf->hash())); + break; + } + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } @@ -720,21 +744,21 @@ static void webkit_dom_test_obj_class_init(WebKitDOMTestObjClass* requestClass) G_MAXLONG, /* max */ 0, /* default */ WEBKIT_PARAM_READABLE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_READ_ONLY_STRING_ATTR, g_param_spec_string("read-only-string-attr", /* name */ "test_obj_read-only-string-attr", /* short description */ "read-only gchar* TestObj.read-only-string-attr", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READABLE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_READ_ONLY_TEST_OBJ_ATTR, g_param_spec_object("read-only-test-obj-attr", /* name */ "test_obj_read-only-test-obj-attr", /* short description */ "read-only WebKitDOMTestObj* TestObj.read-only-test-obj-attr", /* longer - could do with some extra doc stuff here */ WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */ WEBKIT_PARAM_READABLE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_INT_ATTR, g_param_spec_long("int-attr", /* name */ "test_obj_int-attr", /* short description */ @@ -743,7 +767,7 @@ G_MAXLONG, /* max */ G_MAXLONG, /* max */ 0, /* default */ WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_LONG_LONG_ATTR, g_param_spec_int64("long-long-attr", /* name */ "test_obj_long-long-attr", /* short description */ @@ -752,7 +776,7 @@ G_MAXLONG, /* max */ G_MAXINT64, /* max */ 0, /* default */ WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_UNSIGNED_LONG_LONG_ATTR, g_param_spec_uint64("unsigned-long-long-attr", /* name */ "test_obj_unsigned-long-long-attr", /* short description */ @@ -761,21 +785,21 @@ G_MAXINT64, /* max */ G_MAXUINT64, /* min */ 0, /* default */ WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_STRING_ATTR, g_param_spec_string("string-attr", /* name */ "test_obj_string-attr", /* short description */ "read-write gchar* TestObj.string-attr", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_TEST_OBJ_ATTR, g_param_spec_object("test-obj-attr", /* name */ "test_obj_test-obj-attr", /* short description */ "read-write WebKitDOMTestObj* TestObj.test-obj-attr", /* longer - could do with some extra doc stuff here */ WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */ WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_ATTR_WITH_EXCEPTION, g_param_spec_long("attr-with-exception", /* name */ "test_obj_attr-with-exception", /* short description */ @@ -784,7 +808,7 @@ G_MAXUINT64, /* min */ G_MAXLONG, /* max */ 0, /* default */ WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_ATTR_WITH_SETTER_EXCEPTION, g_param_spec_long("attr-with-setter-exception", /* name */ "test_obj_attr-with-setter-exception", /* short description */ @@ -793,7 +817,7 @@ G_MAXLONG, /* max */ G_MAXLONG, /* max */ 0, /* default */ WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_ATTR_WITH_GETTER_EXCEPTION, g_param_spec_long("attr-with-getter-exception", /* name */ "test_obj_attr-with-getter-exception", /* short description */ @@ -802,13 +826,38 @@ G_MAXLONG, /* max */ G_MAXLONG, /* max */ 0, /* default */ WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, + g_object_class_install_property(gobjectClass, PROP_SCRIPT_STRING_ATTR, g_param_spec_string("script-string-attr", /* name */ "test_obj_script-string-attr", /* short description */ "read-only gchar* TestObj.script-string-attr", /* longer - could do with some extra doc stuff here */ "", /* default */ WEBKIT_PARAM_READABLE)); + g_object_class_install_property(gobjectClass, + PROP_DESCRIPTION, + g_param_spec_long("description", /* name */ + "test_obj_description", /* short description */ + "read-only glong TestObj.description", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ +0, /* default */ + WEBKIT_PARAM_READABLE)); + g_object_class_install_property(gobjectClass, + PROP_ID, + g_param_spec_long("id", /* name */ + "test_obj_id", /* short description */ + "read-write glong TestObj.id", /* longer - could do with some extra doc stuff here */ + G_MINLONG, /* min */ +G_MAXLONG, /* max */ +0, /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_HASH, + g_param_spec_string("hash", /* name */ + "test_obj_hash", /* short description */ + "read-only gchar* TestObj.hash", /* longer - could do with some extra doc stuff here */ + "", /* default */ + WEBKIT_PARAM_READABLE)); } diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h index 282edb8..ef5ccb8 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h @@ -47,34 +47,34 @@ WEBKIT_API GType webkit_dom_test_obj_get_type (void); WEBKIT_API void -webkit_dom_test_obj_void_method (WebKitDOMTestObj *self); +webkit_dom_test_obj_void_method(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_void_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); +webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); WEBKIT_API glong -webkit_dom_test_obj_int_method (WebKitDOMTestObj *self); +webkit_dom_test_obj_int_method(WebKitDOMTestObj* self); WEBKIT_API glong -webkit_dom_test_obj_int_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); +webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_obj_method (WebKitDOMTestObj *self); +webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self); WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_obj_method_with_args (WebKitDOMTestObj *self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); +webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg, gchar* str_arg, WebKitDOMTestObj* obj_arg); WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_method_that_requires_all_args (WebKitDOMTestObj *self, gchar* str_arg, WebKitDOMTestObj* obj_arg); +webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg); WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_method_that_requires_all_args_and_throws (WebKitDOMTestObj *self, gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error); +webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* self, gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error); WEBKIT_API void -webkit_dom_test_obj_serialized_value (WebKitDOMTestObj *self, WebKitDOMSerializedScriptValue* serialized_arg); +webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerializedScriptValue* serialized_arg); WEBKIT_API void -webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **error); +webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error); /* TODO: event function webkit_dom_test_obj_add_event_listener */ @@ -83,100 +83,115 @@ webkit_dom_test_obj_method_with_exception (WebKitDOMTestObj *self, GError **erro /* TODO: event function webkit_dom_test_obj_remove_event_listener */ WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame (WebKitDOMTestObj *self); +webkit_dom_test_obj_with_dynamic_frame(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame_and_arg (WebKitDOMTestObj *self, glong int_arg); +webkit_dom_test_obj_with_dynamic_frame_and_arg(WebKitDOMTestObj* self, glong int_arg); WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame_and_optional_arg (WebKitDOMTestObj *self, glong int_arg, glong optional_arg); +webkit_dom_test_obj_with_dynamic_frame_and_optional_arg(WebKitDOMTestObj* self, glong int_arg, glong optional_arg); WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame_and_user_gesture (WebKitDOMTestObj *self, glong int_arg); +webkit_dom_test_obj_with_dynamic_frame_and_user_gesture(WebKitDOMTestObj* self, glong int_arg); WEBKIT_API void -webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad (WebKitDOMTestObj *self, glong int_arg, glong optional_arg); +webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* self, glong int_arg, glong optional_arg); WEBKIT_API void -webkit_dom_test_obj_with_script_state_void (WebKitDOMTestObj *self); +webkit_dom_test_obj_with_script_state_void(WebKitDOMTestObj* self); WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_with_script_state_obj (WebKitDOMTestObj *self); +webkit_dom_test_obj_with_script_state_obj(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_with_script_state_void_exception (WebKitDOMTestObj *self, GError **error); +webkit_dom_test_obj_with_script_state_void_exception(WebKitDOMTestObj* self, GError **error); WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_with_script_state_obj_exception (WebKitDOMTestObj *self, GError **error); +webkit_dom_test_obj_with_script_state_obj_exception(WebKitDOMTestObj* self, GError **error); WEBKIT_API void -webkit_dom_test_obj_method_with_optional_arg (WebKitDOMTestObj *self, glong opt); +webkit_dom_test_obj_with_script_execution_context(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg (WebKitDOMTestObj *self, glong non_opt, glong opt); +webkit_dom_test_obj_method_with_optional_arg(WebKitDOMTestObj* self, glong opt); WEBKIT_API void -webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args (WebKitDOMTestObj *self, glong non_opt, glong opt1, glong opt2); +webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg(WebKitDOMTestObj* self, glong non_opt, glong opt); + +WEBKIT_API void +webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOMTestObj* self, glong non_opt, glong opt1, glong opt2); WEBKIT_API glong -webkit_dom_test_obj_get_read_only_int_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self); WEBKIT_API gchar* -webkit_dom_test_obj_get_read_only_string_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_read_only_string_attr(WebKitDOMTestObj* self); WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_get_read_only_test_obj_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_read_only_test_obj_attr(WebKitDOMTestObj* self); WEBKIT_API glong -webkit_dom_test_obj_get_int_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_int_attr(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_int_attr (WebKitDOMTestObj *self, glong value); +webkit_dom_test_obj_set_int_attr(WebKitDOMTestObj* self, glong value); WEBKIT_API gint64 -webkit_dom_test_obj_get_long_long_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_long_long_attr(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_long_long_attr (WebKitDOMTestObj *self, gint64 value); +webkit_dom_test_obj_set_long_long_attr(WebKitDOMTestObj* self, gint64 value); WEBKIT_API guint64 -webkit_dom_test_obj_get_unsigned_long_long_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_unsigned_long_long_attr(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_unsigned_long_long_attr (WebKitDOMTestObj *self, guint64 value); +webkit_dom_test_obj_set_unsigned_long_long_attr(WebKitDOMTestObj* self, guint64 value); WEBKIT_API gchar* -webkit_dom_test_obj_get_string_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_string_attr(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_string_attr (WebKitDOMTestObj *self, gchar* value); +webkit_dom_test_obj_set_string_attr(WebKitDOMTestObj* self, gchar* value); WEBKIT_API WebKitDOMTestObj* -webkit_dom_test_obj_get_test_obj_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_test_obj_attr(WebKitDOMTestObj* self); + +WEBKIT_API void +webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value); + +WEBKIT_API glong +webkit_dom_test_obj_get_attr_with_exception(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_test_obj_attr (WebKitDOMTestObj *self, WebKitDOMTestObj* value); +webkit_dom_test_obj_set_attr_with_exception(WebKitDOMTestObj* self, glong value); WEBKIT_API glong -webkit_dom_test_obj_get_attr_with_exception (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_attr_with_setter_exception(WebKitDOMTestObj* self, GError **error); WEBKIT_API void -webkit_dom_test_obj_set_attr_with_exception (WebKitDOMTestObj *self, glong value); +webkit_dom_test_obj_set_attr_with_setter_exception(WebKitDOMTestObj* self, glong value, GError **error); WEBKIT_API glong -webkit_dom_test_obj_get_attr_with_setter_exception (WebKitDOMTestObj *self, GError **error); +webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_attr_with_setter_exception (WebKitDOMTestObj *self, glong value, GError **error); +webkit_dom_test_obj_set_attr_with_getter_exception(WebKitDOMTestObj* self, glong value, GError **error); + +WEBKIT_API gchar* +webkit_dom_test_obj_get_script_string_attr(WebKitDOMTestObj* self); + +WEBKIT_API glong +webkit_dom_test_obj_get_description(WebKitDOMTestObj* self); WEBKIT_API glong -webkit_dom_test_obj_get_attr_with_getter_exception (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_id(WebKitDOMTestObj* self); WEBKIT_API void -webkit_dom_test_obj_set_attr_with_getter_exception (WebKitDOMTestObj *self, glong value, GError **error); +webkit_dom_test_obj_set_id(WebKitDOMTestObj* self, glong value); WEBKIT_API gchar* -webkit_dom_test_obj_get_script_string_attr (WebKitDOMTestObj *self); +webkit_dom_test_obj_get_hash(WebKitDOMTestObj* self); G_END_DECLS diff --git a/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp index a230aef..693a48b 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -78,12 +78,12 @@ public: protected: static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags; - static JSObject* constructTestInterface(ExecState* exec, JSObject* constructor, const ArgList&) + static EncodedJSValue JSC_HOST_CALL constructTestInterface(ExecState* exec) { - ScriptExecutionContext* context = static_cast<JSTestInterfaceConstructor*>(constructor)->scriptExecutionContext(); + ScriptExecutionContext* context = static_cast<JSTestInterfaceConstructor*>(exec->callee())->scriptExecutionContext(); if (!context) - return throwError(exec, ReferenceError); - return asObject(toJS(exec, static_cast<JSTestInterfaceConstructor*>(constructor)->globalObject(), TestInterface::create(context))); + return throwVMError(exec, createReferenceError(exec, "Reference error")); + return JSValue::encode(asObject(toJS(exec, static_cast<JSTestInterfaceConstructor*>(exec->callee())->globalObject(), TestInterface::create(context)))); } virtual ConstructType getConstructData(ConstructData& constructData) { diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 1e563c6..09b69cd 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -46,7 +46,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSTestObj); #define THUNK_GENERATOR(generator) #endif -static const HashTableValue JSTestObjTableValues[15] = +static const HashTableValue JSTestObjTableValues[18] = { { "readOnlyIntAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyIntAttr), (intptr_t)0 THUNK_GENERATOR(0) }, { "readOnlyStringAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyStringAttr), (intptr_t)0 THUNK_GENERATOR(0) }, @@ -61,12 +61,15 @@ static const HashTableValue JSTestObjTableValues[15] = { "attrWithGetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithGetterException), (intptr_t)setJSTestObjAttrWithGetterException THUNK_GENERATOR(0) }, { "customAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCustomAttr), (intptr_t)setJSTestObjCustomAttr THUNK_GENERATOR(0) }, { "scriptStringAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjScriptStringAttr), (intptr_t)0 THUNK_GENERATOR(0) }, + { "description", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjDescription), (intptr_t)0 THUNK_GENERATOR(0) }, + { "id", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjId), (intptr_t)setJSTestObjId THUNK_GENERATOR(0) }, + { "hash", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjHash), (intptr_t)0 THUNK_GENERATOR(0) }, { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, { 0, 0, 0, 0 THUNK_GENERATOR(0) } }; #undef THUNK_GENERATOR -static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 34, 31, JSTestObjTableValues, 0 }; +static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 65, 63, JSTestObjTableValues, 0 }; /* Hash table for constructor */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator @@ -121,7 +124,7 @@ bool JSTestObjConstructor::getOwnPropertyDescriptor(ExecState* exec, const Ident #define THUNK_GENERATOR(generator) #endif -static const HashTableValue JSTestObjPrototypeTableValues[29] = +static const HashTableValue JSTestObjPrototypeTableValues[30] = { { "voidMethod", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethod), (intptr_t)0 THUNK_GENERATOR(0) }, { "voidMethodWithArgs", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) }, @@ -147,6 +150,7 @@ static const HashTableValue JSTestObjPrototypeTableValues[29] = { "withScriptStateObj", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateObj), (intptr_t)0 THUNK_GENERATOR(0) }, { "withScriptStateVoidException", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateVoidException), (intptr_t)0 THUNK_GENERATOR(0) }, { "withScriptStateObjException", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateObjException), (intptr_t)0 THUNK_GENERATOR(0) }, + { "withScriptExecutionContext", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptExecutionContext), (intptr_t)0 THUNK_GENERATOR(0) }, { "methodWithOptionalArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) }, { "methodWithNonOptionalArgAndOptionalArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) }, { "methodWithNonOptionalArgAndTwoOptionalArgs", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs), (intptr_t)3 THUNK_GENERATOR(0) }, @@ -316,6 +320,33 @@ JSValue jsTestObjScriptStringAttr(ExecState* exec, JSValue slotBase, const Ident return result; } +JSValue jsTestObjDescription(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->description()); + return result; +} + +JSValue jsTestObjId(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(exec, imp->id()); + return result; +} + +JSValue jsTestObjHash(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsString(exec, imp->hash()); + return result; +} + JSValue jsTestObjConstructor(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* domObject = static_cast<JSTestObj*>(asObject(slotBase)); @@ -391,28 +422,35 @@ void setJSTestObjCustomAttr(ExecState* exec, JSObject* thisObject, JSValue value static_cast<JSTestObj*>(thisObject)->setCustomAttr(exec, value); } +void setJSTestObjId(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setId(value.toInt32(exec)); +} + JSValue JSTestObj::getConstructor(ExecState* exec, JSGlobalObject* globalObject) { return getDOMConstructor<JSTestObjConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); imp->voidMethod(); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int intArg = exec->argument(0).toInt32(exec); @@ -420,27 +458,27 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecState* ex TestObj* objArg = toTestObj(exec->argument(2)); imp->voidMethodWithArgs(intArg, strArg, objArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); JSC::JSValue result = jsNumber(exec, imp->intMethod()); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int intArg = exec->argument(0).toInt32(exec); @@ -449,27 +487,27 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exe JSC::JSValue result = jsNumber(exec, imp->intMethodWithArgs(intArg, strArg, objArg)); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objMethod())); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int intArg = exec->argument(0).toInt32(exec); @@ -478,35 +516,35 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecState* exe JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objMethodWithArgs(intArg, strArg, objArg))); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); if (exec->argumentCount() < 2) - return jsUndefined(); + return JSValue::encode(jsUndefined()); const String& strArg = ustringToString(exec->argument(0).toString(exec)); TestObj* objArg = toTestObj(exec->argument(1)); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->methodThatRequiresAllArgs(strArg, objArg))); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); if (exec->argumentCount() < 2) - return throwError(exec, SyntaxError, "Not enough arguments"); + return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); ExceptionCode ec = 0; const String& strArg = ustringToString(exec->argument(0).toString(exec)); TestObj* objArg = toTestObj(exec->argument(1)); @@ -514,59 +552,59 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThro JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec))); setDOMException(exec, ec); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(exec, exec->argument(0)); imp->serializedValue(serializedArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; imp->methodWithException(ec); setDOMException(exec, ec); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); - return castedThis->customMethod(exec); + return JSValue::encode(castedThis->customMethod(exec)); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); - return castedThis->customMethodWithArgs(exec); + return JSValue::encode(castedThis->customMethodWithArgs(exec)); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; @@ -575,178 +613,178 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState imp->customArgsAndException(intArg, &callStack, ec); setDOMException(exec, ec); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); JSValue listener = exec->argument(1); if (!listener.isObject()) - return jsUndefined(); + return JSValue::encode(jsUndefined()); imp->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); JSValue listener = exec->argument(1); if (!listener.isObject()) - return jsUndefined(); + return JSValue::encode(jsUndefined()); imp->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) - return jsUndefined(); + return JSValue::encode(jsUndefined()); imp->withDynamicFrame(dynamicFrame); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) - return jsUndefined(); - int intArg = exec->argument(1).toInt32(exec); + return JSValue::encode(jsUndefined()); + int intArg = exec->argument(0).toInt32(exec); imp->withDynamicFrameAndArg(dynamicFrame, intArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) - return jsUndefined(); - int intArg = exec->argument(1).toInt32(exec); + return JSValue::encode(jsUndefined()); + int intArg = exec->argument(0).toInt32(exec); int argsCount = exec->argumentCount(); - if (argsCount < 3) { + if (argsCount < 2) { imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } - int optionalArg = exec->argument(2).toInt32(exec); + int optionalArg = exec->argument(1).toInt32(exec); imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg, optionalArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) - return jsUndefined(); - int intArg = exec->argument(1).toInt32(exec); + return JSValue::encode(jsUndefined()); + int intArg = exec->argument(0).toInt32(exec); imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture(exec)); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) - return jsUndefined(); - int intArg = exec->argument(1).toInt32(exec); + return JSValue::encode(jsUndefined()); + int intArg = exec->argument(0).toInt32(exec); int argsCount = exec->argumentCount(); - if (argsCount < 3) { + if (argsCount < 2) { imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } - int optionalArg = exec->argument(2).toInt32(exec); + int optionalArg = exec->argument(1).toInt32(exec); imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture(exec)); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); imp->withScriptStateVoid(exec); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->withScriptStateObj(exec))); if (exec->hadException()) - return jsUndefined(); - return result; + return JSValue::encode(jsUndefined()); + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; imp->withScriptStateVoidException(exec, ec); setDOMException(exec, ec); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; @@ -755,35 +793,50 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(Exec JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->withScriptStateObjException(exec, ec))); setDOMException(exec, ec); if (exec->hadException()) - return jsUndefined(); - return result; + return JSValue::encode(jsUndefined()); + return JSValue::encode(result); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptExecutionContext(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); + if (!scriptContext) + return JSValue::encode(jsUndefined()); + + imp->withScriptExecutionContext(scriptContext); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int argsCount = exec->argumentCount(); if (argsCount < 1) { imp->methodWithOptionalArg(); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } int opt = exec->argument(0).toInt32(exec); imp->methodWithOptionalArg(opt); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int nonOpt = exec->argument(0).toInt32(exec); @@ -791,20 +844,20 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptio int argsCount = exec->argumentCount(); if (argsCount < 2) { imp->methodWithNonOptionalArgAndOptionalArg(nonOpt); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } int opt = exec->argument(1).toInt32(exec); imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int nonOpt = exec->argument(0).toInt32(exec); @@ -812,35 +865,35 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOp int argsCount = exec->argumentCount(); if (argsCount < 2) { imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } int opt1 = exec->argument(1).toInt32(exec); int opt2 = exec->argument(2).toInt32(exec); imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); TestObj* objArg = toTestObj(exec->argument(0)); const String& strArg = ustringToString(exec->argument(1).toString(exec)); imp->overloadedMethod(objArg, strArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); TestObj* objArg = toTestObj(exec->argument(0)); @@ -848,52 +901,52 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exe int argsCount = exec->argumentCount(); if (argsCount < 2) { imp->overloadedMethod(objArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } int intArg = exec->argument(1).toInt32(exec); imp->overloadedMethod(objArg, intArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); const String& strArg = ustringToString(exec->argument(0).toString(exec)); imp->overloadedMethod(strArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int intArg = exec->argument(0).toInt32(exec); imp->overloadedMethod(intArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec) { - if ((exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(JSTestObj::s_info) && (exec->argument(1).isNull() || exec->argument(1).isUndefined() || exec->argument(1).isString() || exec->argument(1).isObject()))) + if ((exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(&JSTestObj::s_info)) && (exec->argument(1).isNull() || exec->argument(1).isUndefined() || exec->argument(1).isString() || exec->argument(1).isObject()))) return jsTestObjPrototypeFunctionOverloadedMethod1(exec); - if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(JSTestObj::s_info)) || (exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(JSTestObj::s_info))) + if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(&JSTestObj::s_info))) || (exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(&JSTestObj::s_info)))) return jsTestObjPrototypeFunctionOverloadedMethod2(exec); if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || exec->argument(0).isUndefined() || exec->argument(0).isString() || exec->argument(0).isObject()))) return jsTestObjPrototypeFunctionOverloadedMethod3(exec); if (exec->argumentCount() == 1) return jsTestObjPrototypeFunctionOverloadedMethod4(exec); - return throwError(exec, TypeError); + return throwTypeError(exec); } JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestObj* object) diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.h b/WebCore/bindings/scripts/test/JS/JSTestObj.h index 38cf8c2..dd84005 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.h +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.h @@ -86,34 +86,35 @@ protected: // Functions -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(JSC::ExecState*); -JSC::JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptExecutionContext(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(JSC::ExecState*); // Attributes JSC::JSValue jsTestObjReadOnlyIntAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); @@ -138,6 +139,10 @@ void setJSTestObjAttrWithGetterException(JSC::ExecState*, JSC::JSObject*, JSC::J JSC::JSValue jsTestObjCustomAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjCustomAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjScriptStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestObjDescription(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestObjId(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjId(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjHash(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); JSC::JSValue jsTestObjConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); } // namespace WebCore diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h index 247f4a3..6b50246 100644 --- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h @@ -56,6 +56,10 @@ - (int)customAttr; - (void)setCustomAttr:(int)newCustomAttr; - (NSString *)scriptStringAttr; +- (int)descriptionName; +- (int)idName; +- (void)setIdName:(int)newIdName; +- (NSString *)hashName; - (void)voidMethod; - (void)voidMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; - (int)intMethod; @@ -80,6 +84,7 @@ - (DOMTestObj *)withScriptStateObj; - (void)withScriptStateVoidException; - (DOMTestObj *)withScriptStateObjException; +- (void)withScriptExecutionContext; - (void)methodWithOptionalArg:(int)opt; - (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt; - (void)methodWithNonOptionalArgAndTwoOptionalArgs:(int)nonOpt opt1:(int)opt1 opt2:(int)opt2; diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm index 0f3fb66..e57ed87 100644 --- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm @@ -212,6 +212,30 @@ return IMPL->scriptStringAttr(); } +- (int)descriptionName +{ + WebCore::JSMainThreadNullState state; + return IMPL->description(); +} + +- (int)idName +{ + WebCore::JSMainThreadNullState state; + return IMPL->id(); +} + +- (void)setIdName:(int)newIdName +{ + WebCore::JSMainThreadNullState state; + IMPL->setId(newIdName); +} + +- (NSString *)hashName +{ + WebCore::JSMainThreadNullState state; + return IMPL->hash(); +} + - (void)voidMethod { WebCore::JSMainThreadNullState state; @@ -370,6 +394,12 @@ return result; } +- (void)withScriptExecutionContext +{ + WebCore::JSMainThreadNullState state; + IMPL->withScriptExecutionContext(); +} + - (void)methodWithOptionalArg:(int)opt { WebCore::JSMainThreadNullState state; diff --git a/WebCore/bindings/scripts/test/TestObj.idl b/WebCore/bindings/scripts/test/TestObj.idl index bda2586..1cb004c 100644 --- a/WebCore/bindings/scripts/test/TestObj.idl +++ b/WebCore/bindings/scripts/test/TestObj.idl @@ -87,6 +87,7 @@ module test { raises(DOMException); [CallWith=ScriptState] TestObj withScriptStateObjException() raises(DOMException); + [CallWith=ScriptExecutionContext] void withScriptExecutionContext(); // 'Optional' extended attribute void methodWithOptionalArg(in [Optional] long opt); @@ -103,5 +104,10 @@ module test { void overloadedMethod(in DOMString strArg); void overloadedMethod(in long intArg); #endif + + // ObjectiveC reserved words. + readonly attribute long description; + attribute long id; + readonly attribute DOMString hash; }; } diff --git a/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp b/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp index e8be71d..fef199a 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp +++ b/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp @@ -29,6 +29,8 @@ #include "V8CustomVoidCallback.h" #include "V8DOMString.h" +#include <wtf/Assertions.h> + namespace WebCore { V8TestCallback::V8TestCallback(v8::Local<v8::Object> callback) @@ -54,8 +56,14 @@ bool V8TestCallback::callbackWithClass1Param(ScriptExecutionContext* context, Cl v8::Context::Scope scope(v8Context); + v8::Handle<v8::Value> class1ParamHandle = toV8(class1Param); + if (class1ParamHandle.IsEmpty()) { + CRASH(); + return true; + } + v8::Handle<v8::Value> argv[] = { - toV8(class1Param) + class1ParamHandle }; bool callbackReturnValue = false; @@ -72,9 +80,20 @@ bool V8TestCallback::callbackWithClass2Param(ScriptExecutionContext* context, Cl v8::Context::Scope scope(v8Context); + v8::Handle<v8::Value> class2ParamHandle = toV8(class2Param); + if (class2ParamHandle.IsEmpty()) { + CRASH(); + return true; + } + v8::Handle<v8::Value> strArgHandle = toV8(strArg); + if (strArgHandle.IsEmpty()) { + CRASH(); + return true; + } + v8::Handle<v8::Value> argv[] = { - toV8(class2Param), - toV8(strArg) + class2ParamHandle, + strArgHandle }; bool callbackReturnValue = false; diff --git a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index 449e086..69c57bb 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -218,6 +218,36 @@ static v8::Handle<v8::Value> scriptStringAttrAttrGetter(v8::Local<v8::String> na return v8StringOrNull(imp->scriptStringAttr()); } +static v8::Handle<v8::Value> descriptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.description._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8::Integer::New(imp->description()); +} + +static v8::Handle<v8::Value> idAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.id._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8::Integer::New(imp->id()); +} + +static void idAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.id._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + int v = toInt32(value); + imp->setId(v); + return; +} + +static v8::Handle<v8::Value> hashAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.hash._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8String(imp->hash()); +} + static v8::Handle<v8::Value> voidMethodCallback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.voidMethod"); @@ -507,6 +537,17 @@ static v8::Handle<v8::Value> withScriptStateObjExceptionCallback(const v8::Argum return v8::Handle<v8::Value>(); } +static v8::Handle<v8::Value> withScriptExecutionContextCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.withScriptExecutionContext"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + ScriptExecutionContext* scriptContext = getScriptExecutionContext(); + if (!scriptContext) + return v8::Undefined(); + imp->withScriptExecutionContext(scriptContext); + return v8::Handle<v8::Value>(); +} + static v8::Handle<v8::Value> methodWithOptionalArgCallback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.methodWithOptionalArg"); @@ -635,6 +676,12 @@ static const BatchedAttribute TestObjAttrs[] = { {"customAttr", V8TestObj::customAttrAccessorGetter, V8TestObj::customAttrAccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'scriptStringAttr' (Type: 'readonly attribute' ExtAttr: 'ConvertScriptString') {"scriptStringAttr", TestObjInternal::scriptStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'description' (Type: 'readonly attribute' ExtAttr: '') + {"description", TestObjInternal::descriptionAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'id' (Type: 'attribute' ExtAttr: '') + {"id", TestObjInternal::idAttrGetter, TestObjInternal::idAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'hash' (Type: 'readonly attribute' ExtAttr: '') + {"hash", TestObjInternal::hashAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, }; static const BatchedCallback TestObjCallbacks[] = { {"voidMethod", TestObjInternal::voidMethodCallback}, @@ -655,6 +702,7 @@ static const BatchedCallback TestObjCallbacks[] = { {"withScriptStateObj", TestObjInternal::withScriptStateObjCallback}, {"withScriptStateVoidException", TestObjInternal::withScriptStateVoidExceptionCallback}, {"withScriptStateObjException", TestObjInternal::withScriptStateObjExceptionCallback}, + {"withScriptExecutionContext", TestObjInternal::withScriptExecutionContextCallback}, {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback}, {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback}, {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback}, |