diff options
Diffstat (limited to 'Source/WebCore/bindings/scripts')
32 files changed, 1238 insertions, 806 deletions
diff --git a/Source/WebCore/bindings/scripts/CodeGenerator.pm b/Source/WebCore/bindings/scripts/CodeGenerator.pm index f94c0b293..86a0cc55f 100644 --- a/Source/WebCore/bindings/scripts/CodeGenerator.pm +++ b/Source/WebCore/bindings/scripts/CodeGenerator.pm @@ -147,8 +147,6 @@ sub ProcessDocument print "Generating $useGenerator bindings code for IDL interface \"" . $class->name . "\"...\n" if $verbose; $codeGenerator->GenerateInterface($class, $defines); } - - $codeGenerator->finish(); } sub FileNamePrefix @@ -163,6 +161,17 @@ sub FileNamePrefix return $codeGenerator->FileNamePrefix(); } +sub UpdateFile +{ + my $object = shift; + my $fileName = shift; + my $contents = shift; + + open FH, "> $fileName" or die "Couldn't open $fileName: $!\n"; + print FH $contents; + close FH; +} + sub ForAllParents { my $object = shift; @@ -539,11 +548,7 @@ sub GetterExpression my $functionName; if ($attribute->signature->extendedAttributes->{"URL"}) { - if ($attribute->signature->extendedAttributes->{"NonEmpty"}) { - $functionName = "getNonEmptyURLAttribute"; - } else { - $functionName = "getURLAttribute"; - } + $functionName = "getURLAttribute"; } elsif ($attribute->signature->type eq "boolean") { $functionName = "hasAttribute"; } elsif ($attribute->signature->type eq "long") { diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm b/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm index d3145929f..b57c69f2b 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm @@ -107,11 +107,6 @@ sub new return $reference; } -sub finish -{ - my $object = shift; -} - # Params: 'domClass' struct sub GenerateInterface { @@ -192,7 +187,7 @@ sub GetParent return $parent; } -sub ShouldSkipTypeInImplementation +sub ShouldSkipType { my $typeInfo = shift; @@ -210,21 +205,6 @@ sub ShouldSkipTypeInImplementation 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; @@ -339,7 +319,7 @@ sub GetNamespaceForClass { my $type = shift; return "WTF" if (($type eq "ArrayBuffer") or ($type eq "ArrayBufferView")); - return "WTF" if (($type eq "Uint8Array") or ($type eq "Uint16Array") or ($type eq "Uint32Array")); + return "WTF" if (($type eq "Uint8Array") or ($type eq "Uint8ClampedArray") or ($type eq "Uint16Array") or ($type eq "Uint32Array")); return "WTF" if (($type eq "Int8Array") or ($type eq "Int16Array") or ($type eq "Int32Array")); return "WTF" if (($type eq "Float32Array") or ($type eq "Float64Array")); return "WebCore"; @@ -443,7 +423,7 @@ sub GenerateHeader # - Add attribute getters/setters. if ($numAttributes > 0) { foreach my $attribute (@{$dataNode->attributes}) { - next if ShouldSkipTypeInHeader($attribute); + next if ShouldSkipType($attribute); my $attributeConditionalString = GenerateConditionalString($attribute->signature); my $attributeName = $attribute->signature->name; @@ -482,7 +462,7 @@ sub GenerateHeader # - Add functions. if ($numFunctions > 0) { foreach my $function (@{$dataNode->functions}) { - next if ShouldSkipTypeInHeader($function); + next if ShouldSkipType($function); my $functionName = $function->signature->name; my $returnType = GetCPPType($function->signature->type, 0); @@ -694,7 +674,7 @@ sub GenerateImplementation # - Attributes if ($numAttributes > 0) { foreach my $attribute (@{$dataNode->attributes}) { - next if ShouldSkipTypeInImplementation($attribute); + next if ShouldSkipType($attribute); AddIncludesForType($attribute->signature->type); my $idlType = $codeGenerator->StripModule($attribute->signature->type); @@ -805,7 +785,7 @@ sub GenerateImplementation 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"}; + next if ShouldSkipType($function) || $dataNode->extendedAttributes->{"PureInterface"}; AddIncludesForType($function->signature->type); my $functionName = $function->signature->name; @@ -854,7 +834,7 @@ sub GenerateImplementation my $implementedBy = $function->signature->extendedAttributes->{"ImplementedBy"}; $implIncludes{"${implementedBy}.h"} = 1; unshift(@parameterNames, "impl()"); - $content = "${implementedBy}::" . $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")"; + $content = "WebCore::${implementedBy}::" . $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")"; } else { $content = "impl()->" . $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")"; } @@ -952,15 +932,9 @@ sub WriteData 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"; + # Update a .h file if the contents are changed. + my $contents = join "", @headerContentHeader; + $contents .= "\n"; foreach my $class (sort keys(%headerForwardDeclarations)) { if ($class =~ /::/) { my $namespacePart = $class; @@ -969,34 +943,32 @@ sub WriteData my $classPart = $class; $classPart =~ s/${namespacePart}:://; - print HEADER "namespace $namespacePart {\nclass $classPart;\n};\n\n"; + $contents .= "namespace $namespacePart {\nclass $classPart;\n};\n\n"; } else { - print HEADER "class $class;\n" + $contents .= "class $class;\n" } } my $hasForwardDeclarations = keys(%headerForwardDeclarations); - print HEADER "\n" if $hasForwardDeclarations; - print HEADER @headerContent; - close(HEADER); + $contents .= "\n" if $hasForwardDeclarations; + $contents .= join "", @headerContent; + $codeGenerator->UpdateFile($headerFileName, $contents); @headerContentHeader = (); @headerContent = (); %headerForwardDeclarations = (); - # Write implementation file. - open(IMPL, ">$implFileName") or die "Couldn't open file $implFileName"; - - print IMPL @implContentHeader; + # Update a .cpp file if the contents are changed. + $contents = join "", @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"; + $contents .= "#include \"$include\"\n"; } - print IMPL @implContent; - close(IMPL); + $contents .= join "", @implContent; + $codeGenerator->UpdateFile($implFileName, $contents); @implContentHeader = (); @implContent = (); diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm index 702e8e6c8..358b3a963 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm @@ -51,9 +51,6 @@ sub new { bless($reference, $object); } -sub finish { -} - my $licenceTemplate = << "EOF"; /* This file is part of the WebKit open source project. @@ -1172,68 +1169,6 @@ sub GenerateEndHeader { push(@hPrefixGuardEnd, "#endif /* $guard */\n"); } -sub GeneratePrivateHeader { - my $object = shift; - my $dataNode = shift; - - my $interfaceName = $dataNode->name; - my $filename = "$outputDir/" . $className . "Private.h"; - my $guard = uc(decamelize($className)) . "_PRIVATE_H"; - my $parentClassName = GetParentClassName($dataNode); - my $hasLegacyParent = $dataNode->extendedAttributes->{"LegacyParent"}; - my $hasRealParent = @{$dataNode->parents} > 0; - my $hasParent = $hasLegacyParent || $hasRealParent; - - open(PRIVHEADER, ">$filename") or die "Couldn't open file $filename for writing"; - - print PRIVHEADER split("\r", $licenceTemplate); - print PRIVHEADER "\n"; - - my $text = << "EOF"; -#ifndef $guard -#define $guard - -#include <glib-object.h> -#include <webkit/${parentClassName}.h> -#include "${interfaceName}.h" -EOF - - print PRIVHEADER $text; - - print PRIVHEADER map { "#include \"$_\"\n" } sort keys(%hdrPropIncludes); - print PRIVHEADER "\n" if keys(%hdrPropIncludes); - - $text = << "EOF"; -namespace WebKit { - ${className} * - wrap${interfaceName}(WebCore::${interfaceName} *coreObject); - - WebCore::${interfaceName} * - core(${className} *request); - -EOF - - print PRIVHEADER $text; - - if ($className ne "WebKitDOMNode") { - $text = << "EOF"; - ${className}* - kit(WebCore::${interfaceName}* node); - -EOF - print PRIVHEADER $text; - } - - $text = << "EOF"; -} // namespace WebKit - -#endif /* ${guard} */ -EOF - print PRIVHEADER $text; - - close(PRIVHEADER); -} - sub UsesManualKitImplementation { my $type = shift; @@ -1349,16 +1284,71 @@ EOF $object->GenerateHeader($interfaceName, $parentClassName); $object->GenerateCFile($interfaceName, $parentClassName, $parentGObjType, $dataNode); $object->GenerateEndHeader(); - $object->GeneratePrivateHeader($dataNode); - } # Internal helper sub WriteData { - my ($object, $name) = @_; + my $object = shift; + my $dataNode = shift; + + # Write a private header. + my $interfaceName = $dataNode->name; + my $filename = "$outputDir/" . $className . "Private.h"; + my $guard = uc(decamelize($className)) . "_PRIVATE_H"; + my $parentClassName = GetParentClassName($dataNode); + + open(PRIVHEADER, ">$filename") or die "Couldn't open file $filename for writing"; + + print PRIVHEADER split("\r", $licenceTemplate); + print PRIVHEADER "\n"; + + my $text = << "EOF"; +#ifndef $guard +#define $guard + +#include <glib-object.h> +#include <webkit/${parentClassName}.h> +#include "${interfaceName}.h" +EOF + + print PRIVHEADER $text; + print PRIVHEADER map { "#include \"$_\"\n" } sort keys(%hdrPropIncludes); + print PRIVHEADER "\n" if keys(%hdrPropIncludes); + $text = << "EOF"; +namespace WebKit { + ${className} * + wrap${interfaceName}(WebCore::${interfaceName} *coreObject); + + WebCore::${interfaceName} * + core(${className} *request); + +EOF + + print PRIVHEADER $text; + + if ($className ne "WebKitDOMNode") { + $text = << "EOF"; + ${className}* + kit(WebCore::${interfaceName}* node); + +EOF + print PRIVHEADER $text; + } + + $text = << "EOF"; +} // namespace WebKit + +#endif /* ${guard} */ +EOF + print PRIVHEADER $text; + + close(PRIVHEADER); + + my $basename = FileNamePrefix . $interfaceName; + $basename =~ s/_//g; # Write public header. - my $hdrFName = "$outputDir/" . $name . ".h"; + my $hdrFName = "$outputDir/" . $basename . ".h"; open(HEADER, ">$hdrFName") or die "Couldn't open file $hdrFName"; print HEADER @hPrefix; @@ -1376,7 +1366,7 @@ sub WriteData { close(HEADER); # Write the implementation sources - my $implFileName = "$outputDir/" . $name . ".cpp"; + my $implFileName = "$outputDir/" . $basename . ".cpp"; open(IMPL, ">$implFileName") or die "Couldn't open file $implFileName"; print IMPL @cPrefix; @@ -1407,16 +1397,12 @@ sub WriteData { sub GenerateInterface { my ($object, $dataNode, $defines) = @_; - my $name = $dataNode->name; # Set up some global variables $className = GetClassName($dataNode->name); - $object->Generate($dataNode); - # Write changes - my $fname = FileNamePrefix . $name; - $fname =~ s/_//g; - $object->WriteData($fname); + $object->Generate($dataNode); + $object->WriteData($dataNode); } 1; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm index 10106ecbe..b184e6d84 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -30,7 +30,7 @@ use strict; use constant FileNamePrefix => "JS"; -my ($codeGenerator, $IMPL, $HEADER, $DEPS); +my ($codeGenerator); my $module = ""; my $outputDir = ""; @@ -88,14 +88,6 @@ sub new return $reference; } -sub finish -{ - my $object = shift; - - # Commit changes! - $object->WriteData(); -} - sub leftShift($$) { my ($value, $distance) = @_; return (($value << $distance) & 0xFFFFFFFF); @@ -119,22 +111,7 @@ sub GenerateInterface $object->GenerateImplementation($dataNode); } - my $name = $dataNode->name; - - # Open files for writing - my $prefix = FileNamePrefix; - my $headerFileName = "$outputDir/$prefix$name.h"; - my $implFileName = "$outputDir/$prefix$name.cpp"; - my $depsFileName = "$outputDir/$prefix$name.dep"; - - # Remove old dependency file. - unlink($depsFileName); - - open($IMPL, ">$implFileName") || die "Couldn't open file $implFileName"; - open($HEADER, ">$headerFileName") || die "Couldn't open file $headerFileName"; - if (@depsContent) { - open($DEPS, ">$depsFileName") || die "Couldn't open file $depsFileName"; - } + $object->WriteData($dataNode); } sub GenerateAttributeEventListenerCall @@ -188,7 +165,7 @@ END JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); - impl->${functionName}EventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), $wrapperObject, false, currentWorld(exec))$passRefPtrHandling, exec->argument(2).toBoolean(exec)); + impl->${functionName}EventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), $wrapperObject, false, currentWorld(exec))$passRefPtrHandling, exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); END return @GenerateEventListenerImpl; @@ -353,7 +330,7 @@ sub IsTypedArrayType { my $type = shift; return 1 if (($type eq "ArrayBuffer") or ($type eq "ArrayBufferView")); - return 1 if (($type eq "Uint8Array") or ($type eq "Uint16Array") or ($type eq "Uint32Array")); + return 1 if (($type eq "Uint8Array") or ($type eq "Uint8ClampedArray") or ($type eq "Uint16Array") or ($type eq "Uint32Array")); return 1 if (($type eq "Int8Array") or ($type eq "Int16Array") or ($type eq "Int32Array")); return 1 if (($type eq "Float32Array") or ($type eq "Float64Array")); return 0; @@ -456,7 +433,7 @@ sub GenerateGetOwnPropertySlotBody &$manualLookupGetterGeneration(); } - if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { push(@getOwnPropertySlotImpl, " bool ok;\n"); push(@getOwnPropertySlotImpl, " unsigned index = propertyName.toUInt32(ok);\n"); @@ -467,7 +444,7 @@ sub GenerateGetOwnPropertySlotBody } else { push(@getOwnPropertySlotImpl, " if (ok && index < static_cast<$implClassName*>(thisObject->impl())->length()) {\n"); } - if ($dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + if ($dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { push(@getOwnPropertySlotImpl, " slot.setValue(thisObject->getByIndex(exec, index));\n"); } else { push(@getOwnPropertySlotImpl, " slot.setCustomIndex(thisObject, index, indexGetter);\n"); @@ -550,13 +527,13 @@ sub GenerateGetOwnPropertyDescriptorBody &$manualLookupGetterGeneration(); } - if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { push(@getOwnPropertyDescriptorImpl, " bool ok;\n"); push(@getOwnPropertyDescriptorImpl, " unsigned index = propertyName.toUInt32(ok);\n"); push(@getOwnPropertyDescriptorImpl, " if (ok && index < static_cast<$implClassName*>(thisObject->impl())->length()) {\n"); - if ($dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + if ($dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { # Assume that if there's a setter, the index will be writable - if ($dataNode->extendedAttributes->{"HasIndexSetter"} || $dataNode->extendedAttributes->{"HasCustomIndexSetter"}) { + if ($dataNode->extendedAttributes->{"HasCustomIndexSetter"}) { push(@getOwnPropertyDescriptorImpl, " descriptor.setDescriptor(thisObject->getByIndex(exec, index), ${namespaceMaybe}DontDelete);\n"); } else { push(@getOwnPropertyDescriptorImpl, " descriptor.setDescriptor(thisObject->getByIndex(exec, index), ${namespaceMaybe}DontDelete | ${namespaceMaybe}ReadOnly);\n"); @@ -565,7 +542,7 @@ sub GenerateGetOwnPropertyDescriptorBody push(@getOwnPropertyDescriptorImpl, " ${namespaceMaybe}PropertySlot slot;\n"); push(@getOwnPropertyDescriptorImpl, " slot.setCustomIndex(thisObject, index, indexGetter);\n"); # Assume that if there's a setter, the index will be writable - if ($dataNode->extendedAttributes->{"HasIndexSetter"} || $dataNode->extendedAttributes->{"HasCustomIndexSetter"}) { + if ($dataNode->extendedAttributes->{"HasCustomIndexSetter"}) { push(@getOwnPropertyDescriptorImpl, " descriptor.setDescriptor(slot.getValue(exec, propertyName), ${namespaceMaybe}DontDelete);\n"); } else { push(@getOwnPropertyDescriptorImpl, " descriptor.setDescriptor(slot.getValue(exec, propertyName), ${namespaceMaybe}DontDelete | ${namespaceMaybe}ReadOnly);\n"); @@ -779,7 +756,6 @@ sub GenerateHeader my $hasGetter = $numAttributes > 0 || !$dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"HasIndexGetter"} - || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"} || $dataNode->extendedAttributes->{"DelegatingGetOwnPropertySlot"} @@ -790,7 +766,7 @@ sub GenerateHeader if ($hasGetter) { push(@headerContent, " static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);\n"); push(@headerContent, " static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);\n"); - push(@headerContent, " static bool getOwnPropertySlotByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);\n") if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) && !$dataNode->extendedAttributes->{"HasOverridingNameGetter"}; + push(@headerContent, " static bool getOwnPropertySlotByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);\n") if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) && !$dataNode->extendedAttributes->{"HasOverridingNameGetter"}; push(@headerContent, " bool getOwnPropertySlotDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);\n") if $dataNode->extendedAttributes->{"DelegatingGetOwnPropertySlot"}; push(@headerContent, " bool getOwnPropertyDescriptorDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);\n") if $dataNode->extendedAttributes->{"DelegatingGetOwnPropertySlot"}; $structureFlags{"JSC::OverridesGetOwnPropertySlot"} = 1; @@ -855,7 +831,7 @@ sub GenerateHeader push(@headerContent, " static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&, bool shouldThrow);\n") if $interfaceName eq "DOMWindow"; # Custom getOwnPropertyNames function - if ($dataNode->extendedAttributes->{"CustomGetPropertyNames"} || $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + if ($dataNode->extendedAttributes->{"CustomGetPropertyNames"} || $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { push(@headerContent, " static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode mode = JSC::ExcludeDontEnumProperties);\n"); $structureFlags{"JSC::OverridesGetPropertyNames"} = 1; } @@ -902,26 +878,12 @@ sub GenerateHeader push(@headerContent, "\n // Custom attributes\n"); foreach my $attribute (@{$dataNode->attributes}) { - if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCCustom"}) { - push(@headerContent, " JSC::JSValue " . $codeGenerator->WK_lcfirst($attribute->signature->name) . "(JSC::ExecState*) const;\n"); - if ($attribute->type !~ /^readonly/) { - push(@headerContent, " void set" . $codeGenerator->WK_ucfirst($attribute->signature->name) . "(JSC::ExecState*, JSC::JSValue);\n"); - } - } elsif (($attribute->signature->extendedAttributes->{"CustomGetter"} || $attribute->signature->extendedAttributes->{"JSCCustomGetter"})) { + if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCCustom"} || $attribute->signature->extendedAttributes->{"CustomGetter"} || $attribute->signature->extendedAttributes->{"JSCCustomGetter"}) { my $methodName = $codeGenerator->WK_lcfirst($attribute->signature->name); - if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { - push(@headerContent, " JSC::JSValue " . $methodName . "(" . $interfaceName . "*, JSC::ExecState*) const;\n"); - } else { - push(@headerContent, " JSC::JSValue " . $methodName . "(JSC::ExecState*) const;\n"); - } - } elsif (($attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCCustomSetter"})) { - if ($attribute->type !~ /^readonly/) { - if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { - push(@headerContent, " void set" . $codeGenerator->WK_ucfirst($attribute->signature->name) . "(" . $interfaceName . "*, JSC::ExecState*, JSC::JSValue);\n"); - } else { - push(@headerContent, " void set" . $codeGenerator->WK_ucfirst($attribute->signature->name) . "(JSC::ExecState*, JSC::JSValue);\n"); - } - } + push(@headerContent, " JSC::JSValue " . $methodName . "(JSC::ExecState*) const;\n"); + } + if (($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCCustom"} || $attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCCustomSetter"}) && $attribute->type !~ /^readonly/) { + push(@headerContent, " void set" . $codeGenerator->WK_ucfirst($attribute->signature->name) . "(JSC::ExecState*, JSC::JSValue);\n"); } } } @@ -959,6 +921,7 @@ sub GenerateHeader push(@headerContent, "TypedArrayInt16") if $implType eq "Int16Array"; push(@headerContent, "TypedArrayInt32") if $implType eq "Int32Array"; push(@headerContent, "TypedArrayUint8") if $implType eq "Uint8Array"; + push(@headerContent, "TypedArrayUint8Clamped") if $implType eq "Uint8ClampedArray"; push(@headerContent, "TypedArrayUint16") if $implType eq "Uint16Array"; push(@headerContent, "TypedArrayUint32") if $implType eq "Uint32Array"; push(@headerContent, "TypedArrayFloat32") if $implType eq "Float32Array"; @@ -990,7 +953,7 @@ sub GenerateHeader if ($dataNode->extendedAttributes->{"HasIndexGetter"}) { push(@headerContent, " static JSC::JSValue indexGetter(JSC::ExecState*, JSC::JSValue, unsigned);\n"); } - if ($dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + if ($dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { push(@headerContent, " JSC::JSValue getByIndex(JSC::ExecState*, unsigned index);\n"); } @@ -1079,11 +1042,9 @@ sub GenerateHeader push(@headerContent, " }\n\n"); push(@headerContent, " static const JSC::ClassInfo s_info;\n"); - if ($numFunctions > 0 || $numConstants > 0 || $dataNode->extendedAttributes->{"DelegatingPrototypeGetOwnPropertySlot"}) { + if ($numFunctions > 0 || $numConstants > 0) { push(@headerContent, " static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);\n"); push(@headerContent, " static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);\n"); - push(@headerContent, " bool getOwnPropertySlotDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);\n") if $dataNode->extendedAttributes->{"DelegatingPrototypeGetOwnPropertySlot"}; - push(@headerContent, " bool getOwnPropertyDescriptorDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);\n") if $dataNode->extendedAttributes->{"DelegatingPrototypeGetOwnPropertySlot"}; $structureFlags{"JSC::OverridesGetOwnPropertySlot"} = 1; } if ($dataNode->extendedAttributes->{"CustomMarkFunction"} or $needsMarkChildren) { @@ -1376,7 +1337,7 @@ sub GenerateImplementation AddIncludesForSVGAnimatedType($interfaceName) if $className =~ /^JSSVGAnimated/; $implIncludes{"<wtf/GetPtr.h>"} = 1; - $implIncludes{"<runtime/PropertyNameArray.h>"} = 1 if $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}; + $implIncludes{"<runtime/PropertyNameArray.h>"} = 1 if $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}; AddIncludesForTypeInImpl($interfaceName); @@ -1531,16 +1492,11 @@ sub GenerateImplementation push(@implContent, "}\n\n"); } - if ($numConstants > 0 || $numFunctions > 0 || $dataNode->extendedAttributes->{"DelegatingPrototypeGetOwnPropertySlot"}) { + if ($numConstants > 0 || $numFunctions > 0) { push(@implContent, "bool ${className}Prototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)\n"); push(@implContent, "{\n"); push(@implContent, " ${className}Prototype* thisObject = jsCast<${className}Prototype*>(cell);\n"); - if ($dataNode->extendedAttributes->{"DelegatingPrototypeGetOwnPropertySlot"}) { - push(@implContent, " if (thisObject->getOwnPropertySlotDelegate(exec, propertyName, slot))\n"); - push(@implContent, " return true;\n"); - } - if ($numConstants eq 0 && $numFunctions eq 0) { push(@implContent, " return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);\n"); } elsif ($numConstants eq 0) { @@ -1556,11 +1512,6 @@ sub GenerateImplementation push(@implContent, "{\n"); push(@implContent, " ${className}Prototype* thisObject = jsCast<${className}Prototype*>(object);\n"); - if ($dataNode->extendedAttributes->{"DelegatingPrototypeGetOwnPropertySlot"}) { - push(@implContent, " if (thisObject->getOwnPropertyDescriptorDelegate(exec, propertyName, descriptor))\n"); - push(@implContent, " return true;\n"); - } - if ($numConstants eq 0 && $numFunctions eq 0) { push(@implContent, " return Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);\n"); } elsif ($numConstants eq 0) { @@ -1678,7 +1629,6 @@ sub GenerateImplementation my $hasGetter = $numAttributes > 0 || !$dataNode->extendedAttributes->{"OmitConstructor"} || $dataNode->extendedAttributes->{"HasIndexGetter"} - || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"} || $dataNode->extendedAttributes->{"DelegatingGetOwnPropertySlot"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"} @@ -1702,14 +1652,14 @@ sub GenerateImplementation push(@implContent, "}\n\n"); } - if (($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) + if (($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) && !$dataNode->extendedAttributes->{"HasOverridingNameGetter"}) { push(@implContent, "bool ${className}::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot)\n"); push(@implContent, "{\n"); push(@implContent, " ${className}* thisObject = jsCast<${className}*>(cell);\n"); push(@implContent, " ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);\n"); push(@implContent, " if (propertyName < static_cast<$implClassName*>(thisObject->impl())->length()) {\n"); - if ($dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + if ($dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { push(@implContent, " slot.setValue(thisObject->getByIndex(exec, propertyName));\n"); } else { push(@implContent, " slot.setCustomIndex(thisObject, propertyName, thisObject->indexGetter);\n"); @@ -1746,21 +1696,11 @@ sub GenerateImplementation } if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCCustom"} || $attribute->signature->extendedAttributes->{"CustomGetter"} || $attribute->signature->extendedAttributes->{"JSCCustomGetter"}) { - if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { - push(@implContent, " ${interfaceName}* impl = static_cast<${interfaceName}*>(castedThis->impl());\n"); - push(@implContent, " return castedThis->$implGetterFunctionName(impl, exec);\n"); - } else { - push(@implContent, " return castedThis->$implGetterFunctionName(exec);\n"); - } - } elsif ($attribute->signature->extendedAttributes->{"allowAccessToNode"}) { - $implIncludes{"JSDOMBinding.h"} = 1; - push(@implContent, " $implClassName* impl = static_cast<$implClassName*>(castedThis->impl());\n"); - push(@implContent, " return allowAccessToNode(exec, impl->$implGetterFunctionName()) ? " . NativeToJSValue($attribute->signature, 0, $implClassName, "impl->$implGetterFunctionName()", "castedThis") . " : jsUndefined();\n"); - } elsif ($attribute->signature->extendedAttributes->{"CheckFrameSecurity"}) { - $implIncludes{"Document.h"} = 1; + push(@implContent, " return castedThis->$implGetterFunctionName(exec);\n"); + } elsif ($attribute->signature->extendedAttributes->{"CheckAccessToNode"}) { $implIncludes{"JSDOMBinding.h"} = 1; push(@implContent, " $implClassName* impl = static_cast<$implClassName*>(castedThis->impl());\n"); - push(@implContent, " return allowAccessToNode(exec, impl->contentDocument()) ? " . NativeToJSValue($attribute->signature, 0, $implClassName, "impl->$implGetterFunctionName()", "castedThis") . " : jsUndefined();\n"); + push(@implContent, " return allowAccessToNode(exec, impl->" . $attribute->signature->name . "()) ? " . NativeToJSValue($attribute->signature, 0, $implClassName, "impl->$implGetterFunctionName()", "castedThis") . " : jsUndefined();\n"); } elsif ($type eq "EventListener") { $implIncludes{"EventListener.h"} = 1; push(@implContent, " UNUSED_PARAM(exec);\n"); @@ -1783,23 +1723,32 @@ sub GenerateImplementation # Once JSDOMWrappers have a back-pointer to the globalObject we can pass castedThis->globalObject() push(@implContent, " return JS" . $constructorType . "::getConstructor(exec, castedThis);\n"); } elsif (!@{$attribute->getterExceptions}) { - push(@implContent, " UNUSED_PARAM(exec);\n"); + my $callWith = $attribute->signature->extendedAttributes->{"CallWith"}; + my $callWithArg = ""; + + push(@implContent, " UNUSED_PARAM(exec);\n") if (!$callWith); + my $cacheIndex = 0; if ($attribute->signature->extendedAttributes->{"CachedAttribute"}) { $cacheIndex = $currentCachedAttribute; $currentCachedAttribute++; - push(@implContent, " if (JSValue cachedValue = m_" . $attribute->signature->name . ".get())\n"); + push(@implContent, " if (JSValue cachedValue = castedThis->m_" . $attribute->signature->name . ".get())\n"); push(@implContent, " return cachedValue;\n"); } + if ($callWith) { + $callWithArg = GenerateCallWith($callWith, \@implContent, "jsUndefined()"); + } + if ($svgListPropertyType) { - push(@implContent, " JSValue result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "castedThis->impl()->$implGetterFunctionName()", "castedThis") . ";\n"); + push(@implContent, " JSValue result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "castedThis->impl()->$implGetterFunctionName($callWithArg)", "castedThis") . ";\n"); } elsif ($svgPropertyOrListPropertyType) { push(@implContent, " $svgPropertyOrListPropertyType& impl = castedThis->impl()->propertyReference();\n"); if ($svgPropertyOrListPropertyType eq "float") { # Special case for JSSVGNumber push(@implContent, " JSValue result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "impl", "castedThis") . ";\n"); } else { - push(@implContent, " JSValue result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "impl.$implGetterFunctionName()", "castedThis") . ";\n"); + push(@implContent, " JSValue result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "impl.$implGetterFunctionName($callWithArg)", "castedThis") . ";\n"); + } } else { my ($functionName, @arguments) = $codeGenerator->GetterExpression(\%implIncludes, $interfaceName, $attribute); @@ -1812,6 +1761,10 @@ sub GenerateImplementation $functionName = "impl->${functionName}"; } + if ($callWith) { + unshift(@arguments, $callWithArg); + } + my $jsType = NativeToJSValue($attribute->signature, 0, $implClassName, "${functionName}(" . join(", ", @arguments) . ")", "castedThis"); push(@implContent, " $implClassName* impl = static_cast<$implClassName*>(castedThis->impl());\n"); if ($codeGenerator->IsSVGAnimatedType($type)) { @@ -1822,17 +1775,25 @@ sub GenerateImplementation } } - push(@implContent, " m_" . $attribute->signature->name . ".set(exec->globalData(), this, result);\n") if ($attribute->signature->extendedAttributes->{"CachedAttribute"}); + push(@implContent, " castedThis->m_" . $attribute->signature->name . ".set(exec->globalData(), castedThis, result);\n") if ($attribute->signature->extendedAttributes->{"CachedAttribute"}); push(@implContent, " return result;\n"); } else { + my $callWith = $attribute->signature->extendedAttributes->{"CallWith"}; + my @arguments = ("ec"); + push(@implContent, " ExceptionCode ec = 0;\n"); + + if ($callWith) { + unshift(@arguments, GenerateCallWith($callWith, \@implContent, "jsUndefined()")); + } + if ($svgPropertyOrListPropertyType) { push(@implContent, " $svgPropertyOrListPropertyType impl(*castedThis->impl());\n"); - push(@implContent, " JSC::JSValue result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "impl.$implGetterFunctionName(ec)", "castedThis") . ";\n"); + push(@implContent, " JSC::JSValue result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "impl.$implGetterFunctionName(" . join(", ", @arguments) . ")", "castedThis") . ";\n"); } else { push(@implContent, " $implClassName* impl = static_cast<$implClassName*>(castedThis->impl());\n"); - push(@implContent, " JSC::JSValue result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "impl->$implGetterFunctionName(ec)", "castedThis") . ";\n"); + push(@implContent, " JSC::JSValue result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "impl->$implGetterFunctionName(" . join(", ", @arguments) . ")", "castedThis") . ";\n"); } push(@implContent, " setDOMException(exec, ec);\n"); @@ -1934,13 +1895,7 @@ sub GenerateImplementation } if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCCustom"} || $attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCCustomSetter"}) { - if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { - push(@implContent, " ${className}* castedThis = static_cast<${className}*>(thisObject);\n"); - push(@implContent, " ${interfaceName}* impl = static_cast<${interfaceName}*>(castedThis->impl());\n"); - push(@implContent, " castedThis->set$implSetterFunctionName(impl, exec, value);\n"); - } else { - push(@implContent, " static_cast<$className*>(thisObject)->set$implSetterFunctionName(exec, value);\n"); - } + push(@implContent, " static_cast<$className*>(thisObject)->set$implSetterFunctionName(exec, value);\n"); } elsif ($type eq "EventListener") { $implIncludes{"JSEventListener.h"} = 1; push(@implContent, " UNUSED_PARAM(exec);\n"); @@ -2034,6 +1989,12 @@ sub GenerateImplementation } else { $functionName = "impl->${functionName}"; } + + my $callWith = $attribute->signature->extendedAttributes->{"CallWith"}; + if ($callWith) { + unshift(@arguments, GenerateCallWith($callWith, \@implContent, "")); + } + push(@arguments, "ec") if @{$attribute->setterExceptions}; push(@implContent, " ${functionName}(" . join(", ", @arguments) . ");\n"); push(@implContent, " setDOMException(exec, ec);\n") if @{$attribute->setterExceptions}; @@ -2073,12 +2034,12 @@ sub GenerateImplementation } } - if (($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) && !$dataNode->extendedAttributes->{"CustomGetPropertyNames"}) { + if (($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) && !$dataNode->extendedAttributes->{"CustomGetPropertyNames"}) { push(@implContent, "void ${className}::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)\n"); push(@implContent, "{\n"); push(@implContent, " ${className}* thisObject = jsCast<${className}*>(object);\n"); push(@implContent, " ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);\n"); - if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { push(@implContent, " for (unsigned i = 0; i < static_cast<${implClassName}*>(thisObject->impl())->length(); ++i)\n"); push(@implContent, " propertyNames.add(Identifier::from(exec, i));\n"); } @@ -2169,8 +2130,8 @@ sub GenerateImplementation push(@implContent, " ExceptionCode ec = 0;\n"); } - if ($function->signature->extendedAttributes->{"SVGCheckSecurityDocument"} and !$function->isStatic) { - push(@implContent, " if (!allowAccessToNode(exec, impl->getSVGDocument(" . (@{$function->raisesExceptions} ? "ec" : "") .")))\n"); + if ($function->signature->extendedAttributes->{"CheckAccessToNode"} and !$function->isStatic) { + push(@implContent, " if (!allowAccessToNode(exec, impl->" . $function->signature->name . "(" . (@{$function->raisesExceptions} ? "ec" : "") .")))\n"); push(@implContent, " return JSValue::encode(jsUndefined());\n"); $implIncludes{"JSDOMBinding.h"} = 1; } @@ -2386,6 +2347,25 @@ sub GenerateImplementation push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString; } +sub GenerateCallWith +{ + my $callWith = shift; + my $outputArray = shift; + my $returnValue = shift; + my $callWithArg = "COMPILE_ASSERT(false)"; + + if ($callWith eq "ScriptState") { + $callWithArg = "exec"; + } elsif ($callWith eq "ScriptExecutionContext") { + push(@$outputArray, " ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();\n"); + push(@$outputArray, " if (!scriptContext)\n"); + push(@$outputArray, " return" . ($returnValue ? " " . $returnValue : "") . ";\n"); + $callWithArg = "scriptContext"; + } + + return $callWithArg; +} + sub GenerateArgumentsCountCheck { my $outputArray = shift; @@ -2447,16 +2427,7 @@ sub GenerateParametersCheck my $callWith = $function->signature->extendedAttributes->{"CallWith"}; if ($callWith and !$function->signature->extendedAttributes->{"Constructor"}) { - my $callWithArg = "COMPILE_ASSERT(false)"; - if ($callWith eq "ScriptState") { - $callWithArg = "exec"; - } elsif ($callWith eq "ScriptExecutionContext") { - push(@$outputArray, " ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();\n"); - push(@$outputArray, " if (!scriptContext)\n"); - push(@$outputArray, " return JSValue::encode(jsUndefined());\n"); - $callWithArg = "scriptContext"; - } - push @arguments, $callWithArg; + push(@arguments, GenerateCallWith($callWith, \@$outputArray, "JSValue::encode(jsUndefined())")); } $implIncludes{"ExceptionCode.h"} = 1; @@ -2897,9 +2868,9 @@ sub JSValueToNative return "static_cast<Range::CompareHow>($value.toInt32(exec))" if $type eq "CompareHow"; if ($type eq "DOMString") { - return "valueToStringWithNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertNullToNullString"} || $signature->extendedAttributes->{"Reflect"}; + return "valueToStringWithNullCheck(exec, $value)" if ($signature->extendedAttributes->{"TreatNullAs"} and $signature->extendedAttributes->{"TreatNullAs"} eq "EmptyString") or $signature->extendedAttributes->{"Reflect"}; return "valueToStringWithUndefinedOrNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"}; - return "ustringToString($value.isEmpty() ? UString() : $value.toString(exec))"; + return "ustringToString($value.isEmpty() ? UString() : $value.toString(exec)->value(exec))"; } if ($type eq "DOMObject") { @@ -3007,7 +2978,7 @@ sub NativeToJSValue AddToImplIncludes("$joinedName.h", $conditional); } elsif ($type eq "SerializedScriptValue" or $type eq "any") { AddToImplIncludes("SerializedScriptValue.h", $conditional); - return "$value ? $value->deserialize(exec, castedThis->globalObject()) : jsNull()"; + return "$value ? $value->deserialize(exec, castedThis->globalObject(), 0) : jsNull()"; } else { # Default, include header with same name. AddToImplIncludes("JS$type.h", $conditional); @@ -3235,84 +3206,85 @@ sub GenerateHashValue # Internal helper sub WriteData { - if (defined($IMPL)) { - # Write content to file. - print $IMPL @implContentHeader; - - my @includes = (); - my %implIncludeConditions = (); - foreach my $include (keys %implIncludes) { - my $condition = $implIncludes{$include}; - my $checkType = $include; - $checkType =~ s/\.h//; - next if $codeGenerator->IsSVGAnimatedType($checkType); - - $include = "\"$include\"" unless $include =~ /^["<]/; # " - - if ($condition eq 1) { - push @includes, $include; - } else { - push @{$implIncludeConditions{$condition}}, $include; - } - } - foreach my $include (sort @includes) { - print $IMPL "#include $include\n"; - } - foreach my $condition (sort keys %implIncludeConditions) { - print $IMPL "\n#if " . $codeGenerator->GenerateConditionalStringFromAttributeValue($condition) . "\n"; - foreach my $include (sort @{$implIncludeConditions{$condition}}) { - print $IMPL "#include $include\n"; - } - print $IMPL "#endif\n"; - } + my $object = shift; + my $dataNode = shift; - print $IMPL @implContent; - close($IMPL); - undef($IMPL); + my $name = $dataNode->name; + my $prefix = FileNamePrefix; + my $headerFileName = "$outputDir/$prefix$name.h"; + my $implFileName = "$outputDir/$prefix$name.cpp"; + my $depsFileName = "$outputDir/$prefix$name.dep"; - @implContentHeader = (); - @implContent = (); - %implIncludes = (); - } + # Update a .cpp file if the contents are changed. + my $contents = join "", @implContentHeader; - if (defined($HEADER)) { - # Write content to file. - print $HEADER @headerContentHeader; + my @includes = (); + my %implIncludeConditions = (); + foreach my $include (keys %implIncludes) { + my $condition = $implIncludes{$include}; + my $checkType = $include; + $checkType =~ s/\.h//; + next if $codeGenerator->IsSVGAnimatedType($checkType); - my @includes = (); - foreach my $include (keys %headerIncludes) { - $include = "\"$include\"" unless $include =~ /^["<]/; # " + $include = "\"$include\"" unless $include =~ /^["<]/; # " + + if ($condition eq 1) { push @includes, $include; + } else { + push @{$implIncludeConditions{$condition}}, $include; } - foreach my $include (sort @includes) { - print $HEADER "#include $include\n"; + } + foreach my $include (sort @includes) { + $contents .= "#include $include\n"; + } + foreach my $condition (sort keys %implIncludeConditions) { + $contents .= "\n#if " . $codeGenerator->GenerateConditionalStringFromAttributeValue($condition) . "\n"; + foreach my $include (sort @{$implIncludeConditions{$condition}}) { + $contents .= "#include $include\n"; } + $contents .= "#endif\n"; + } - print $HEADER @headerContent; + $contents .= join "", @implContent; + $codeGenerator->UpdateFile($implFileName, $contents); - @includes = (); - foreach my $include (keys %headerTrailingIncludes) { - $include = "\"$include\"" unless $include =~ /^["<]/; # " - push @includes, $include; - } - foreach my $include (sort @includes) { - print $HEADER "#include $include\n"; - } + @implContentHeader = (); + @implContent = (); + %implIncludes = (); - close($HEADER); - undef($HEADER); + # Update a .h file if the contents are changed. + $contents = join "", @headerContentHeader; - @headerContentHeader = (); - @headerContent = (); - %headerIncludes = (); - %headerTrailingIncludes = (); + @includes = (); + foreach my $include (keys %headerIncludes) { + $include = "\"$include\"" unless $include =~ /^["<]/; # " + push @includes, $include; + } + foreach my $include (sort @includes) { + $contents .= "#include $include\n"; } - if (defined($DEPS)) { - # Write dependency file. - print $DEPS @depsContent; - close($DEPS); - undef($DEPS); + $contents .= join "", @headerContent; + + @includes = (); + foreach my $include (keys %headerTrailingIncludes) { + $include = "\"$include\"" unless $include =~ /^["<]/; # " + push @includes, $include; + } + foreach my $include (sort @includes) { + $contents .= "#include $include\n"; + } + $codeGenerator->UpdateFile($headerFileName, $contents); + + @headerContentHeader = (); + @headerContent = (); + %headerIncludes = (); + %headerTrailingIncludes = (); + + if (@depsContent) { + # Update a .dep file if the contents are changed. + $contents = join "", @depsContent; + $codeGenerator->UpdateFile($depsFileName, $contents); @depsContent = (); } @@ -3479,7 +3451,7 @@ EncodedJSValue JSC_HOST_CALL ${constructorClassName}::construct${className}(Exec if (!executionContext) return throwVMError(exec, createReferenceError(exec, "Constructor associated execution context is unavailable")); - AtomicString eventType = ustringToAtomicString(exec->argument(0).toString(exec)); + AtomicString eventType = ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); @@ -3606,7 +3578,7 @@ sub IsConstructable { my $dataNode = shift; - return $dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"JSCustomConstructor"} || $dataNode->extendedAttributes->{"Constructor"} || $dataNode->extendedAttributes->{"NamedConstructor"} || $dataNode->extendedAttributes->{"JSConstructorTemplate"} || $dataNode->extendedAttributes->{"ConstructorTemplate"}; + return $dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"JSCustomConstructor"} || $dataNode->extendedAttributes->{"Constructor"} || $dataNode->extendedAttributes->{"NamedConstructor"} || $dataNode->extendedAttributes->{"ConstructorTemplate"}; } sub IsConstructorTemplate @@ -3614,7 +3586,7 @@ sub IsConstructorTemplate my $dataNode = shift; my $template = shift; - return ($dataNode->extendedAttributes->{"JSConstructorTemplate"} && $dataNode->extendedAttributes->{"JSConstructorTemplate"} eq $template) || ($dataNode->extendedAttributes->{"ConstructorTemplate"} && $dataNode->extendedAttributes->{"ConstructorTemplate"} eq $template); + return $dataNode->extendedAttributes->{"ConstructorTemplate"} && $dataNode->extendedAttributes->{"ConstructorTemplate"} eq $template; } 1; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm index 93739daa9..a31f77a02 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm @@ -208,11 +208,6 @@ sub new return $reference; } -sub finish -{ - my $object = shift; -} - sub ReadPublicInterfaces { my $class = shift; @@ -882,10 +877,8 @@ sub GenerateHeader $typesToForwardDeclare{$param->type} = 1; if ($parameterIndex >= 1) { - my $paramPrefix = $param->extendedAttributes->{"ObjCPrefix"}; - $paramPrefix = $paramName unless defined($paramPrefix); - $functionSig .= " $paramPrefix"; - $methodName .= $paramPrefix; + $functionSig .= " $paramName"; + $methodName .= $paramName; } $functionSig .= ":($paramType)$paramName"; @@ -1509,9 +1502,7 @@ sub GenerateImplementation } if ($parameterIndex >= 1) { - my $paramPrefix = $param->extendedAttributes->{"ObjCPrefix"}; - $paramPrefix = $param->name unless defined($paramPrefix); - $functionSig .= " $paramPrefix"; + $functionSig .= " " . $param->name; } $functionSig .= ":($paramType)$paramName"; @@ -1776,25 +1767,15 @@ sub WriteData my $internalHeaderFileName = "$outputDir/" . $name . "Internal.h"; my $depsFileName = "$outputDir/" . $name . ".dep"; - # Remove old files. - unlink($headerFileName); - unlink($privateHeaderFileName); - unlink($implFileName); - unlink($internalHeaderFileName); - unlink($depsFileName); - # Write public header. - open(HEADER, ">$headerFileName") or die "Couldn't open file $headerFileName"; - - print HEADER @headerContentHeader; - print HEADER map { "\@class $_;\n" } sort keys(%headerForwardDeclarations); - print HEADER map { "\@protocol $_;\n" } sort keys(%headerForwardDeclarationsForProtocols); + my $contents = join "", @headerContentHeader; + map { $contents .= "\@class $_;\n" } sort keys(%headerForwardDeclarations); + map { $contents .= "\@protocol $_;\n" } sort keys(%headerForwardDeclarationsForProtocols); my $hasForwardDeclarations = keys(%headerForwardDeclarations) + keys(%headerForwardDeclarationsForProtocols); - print HEADER "\n" if $hasForwardDeclarations; - print HEADER @headerContent; - - close(HEADER); + $contents .= "\n" if $hasForwardDeclarations; + $contents .= join "", @headerContent; + $codeGenerator->UpdateFile($headerFileName, $contents); @headerContentHeader = (); @headerContent = (); @@ -1802,17 +1783,14 @@ sub WriteData %headerForwardDeclarationsForProtocols = (); if (@privateHeaderContent > 0) { - open(PRIVATE_HEADER, ">$privateHeaderFileName") or die "Couldn't open file $privateHeaderFileName"; - - print PRIVATE_HEADER @privateHeaderContentHeader; - print PRIVATE_HEADER map { "\@class $_;\n" } sort keys(%privateHeaderForwardDeclarations); - print PRIVATE_HEADER map { "\@protocol $_;\n" } sort keys(%privateHeaderForwardDeclarationsForProtocols); + $contents = join "", @privateHeaderContentHeader; + map { $contents .= "\@class $_;\n" } sort keys(%privateHeaderForwardDeclarations); + map { $contents .= "\@protocol $_;\n" } sort keys(%privateHeaderForwardDeclarationsForProtocols); $hasForwardDeclarations = keys(%privateHeaderForwardDeclarations) + keys(%privateHeaderForwardDeclarationsForProtocols); - print PRIVATE_HEADER "\n" if $hasForwardDeclarations; - print PRIVATE_HEADER @privateHeaderContent; - - close(PRIVATE_HEADER); + $contents .= "\n" if $hasForwardDeclarations; + $contents .= join "", @privateHeaderContent; + $codeGenerator->UpdateFile($privateHeaderFileName, $contents); @privateHeaderContentHeader = (); @privateHeaderContent = (); @@ -1822,34 +1800,28 @@ sub WriteData # Write implementation file. unless ($noImpl) { - open(IMPL, ">$implFileName") or die "Couldn't open file $implFileName"; - - print IMPL @implContentHeader; - print IMPL map { "#import \"$_\"\n" } sort keys(%implIncludes); - print IMPL @implContent; - - close(IMPL); + $contents = join "", @implContentHeader; + map { $contents .= "#import \"$_\"\n" } sort keys(%implIncludes); + $contents .= join "", @implContent; + $codeGenerator->UpdateFile($implFileName, $contents); @implContentHeader = (); @implContent = (); %implIncludes = (); } - - if (@internalHeaderContent > 0) { - open(INTERNAL_HEADER, ">$internalHeaderFileName") or die "Couldn't open file $internalHeaderFileName"; - - print INTERNAL_HEADER @internalHeaderContent; - close(INTERNAL_HEADER); + if (@internalHeaderContent > 0) { + $contents = join "", @internalHeaderContent; + $codeGenerator->UpdateFile($internalHeaderFileName, $contents); - @internalHeaderContent = (); + @internalHeaderContent = (); } # Write dependency file. if (@depsContent) { - open(DEPS, ">$depsFileName") or die "Couldn't open file $depsFileName"; - print DEPS @depsContent; - close(DEPS); + $contents = join "", @depsContent; + $codeGenerator->UpdateFile($depsFileName, $contents); + @depsContent = (); } } diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index c016cf9a0..62909b8d4 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -32,7 +32,7 @@ use Digest::MD5; use constant FileNamePrefix => "V8"; -my ($codeGenerator, $IMPL, $HEADER); +my ($codeGenerator); my $module = ""; my $outputDir = ""; @@ -85,14 +85,6 @@ sub new return $reference; } -sub finish -{ - my $object = shift; - - # Commit changes! - $object->WriteData(); -} - # Params: 'domClass' struct sub GenerateInterface { @@ -109,15 +101,7 @@ sub GenerateInterface $object->GenerateImplementation($dataNode); } - my $name = $dataNode->name; - - # Open files for writing - my $prefix = FileNamePrefix; - my $headerFileName = "$outputHeadersDir/$prefix$name.h"; - my $implFileName = "$outputDir/$prefix$name.cpp"; - - open($IMPL, ">$implFileName") || die "Couldn't open file $implFileName"; - open($HEADER, ">$headerFileName") || die "Couldn't open file $headerFileName"; + $object->WriteData($dataNode); } # Params: 'idlDocument' struct @@ -400,7 +384,7 @@ END my $name = $function->signature->name; my $attrExt = $function->signature->extendedAttributes; - if (($attrExt->{"Custom"} || $attrExt->{"V8Custom"}) && $function->{overloadIndex} == 1) { + if (($attrExt->{"Custom"} || $attrExt->{"V8Custom"}) && !$attrExt->{"ImplementedBy"} && $function->{overloadIndex} == 1) { push(@headerContent, <<END); static v8::Handle<v8::Value> ${name}Callback(const v8::Arguments&); END @@ -721,7 +705,7 @@ sub IsConstructable { my $dataNode = shift; - return $dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"Constructor"} || $dataNode->extendedAttributes->{"V8ConstructorTemplate"} || $dataNode->extendedAttributes->{"ConstructorTemplate"}; + return $dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"Constructor"} || $dataNode->extendedAttributes->{"ConstructorTemplate"}; } sub IsConstructorTemplate @@ -729,7 +713,7 @@ sub IsConstructorTemplate my $dataNode = shift; my $template = shift; - return ($dataNode->extendedAttributes->{"V8ConstructorTemplate"} && $dataNode->extendedAttributes->{"V8ConstructorTemplate"} eq $template) || ($dataNode->extendedAttributes->{"ConstructorTemplate"} && $dataNode->extendedAttributes->{"ConstructorTemplate"} eq $template); + return $dataNode->extendedAttributes->{"ConstructorTemplate"} && $dataNode->extendedAttributes->{"ConstructorTemplate"} eq $template; } sub GenerateDomainSafeFunctionGetter @@ -845,7 +829,7 @@ END END } } - } elsif ($attrExt->{"v8OnProto"} || $attrExt->{"V8DisallowShadowing"}) { + } elsif ($attrExt->{"v8OnProto"} || $attrExt->{"V8Unforgeable"}) { if ($interfaceName eq "DOMWindow") { push(@implContentDecls, <<END); v8::Handle<v8::Object> holder = info.Holder(); @@ -881,10 +865,8 @@ END } # Generate security checks if necessary - if ($attribute->signature->extendedAttributes->{"allowAccessToNode"}) { - push(@implContentDecls, " if (!V8BindingSecurity::allowAccessToNode(V8BindingState::Only(), imp->$attrName()))\n return v8::Handle<v8::Value>();\n\n"); - } elsif ($attribute->signature->extendedAttributes->{"CheckFrameSecurity"}) { - push(@implContentDecls, " if (!V8BindingSecurity::allowAccessToNode(V8BindingState::Only(), imp->contentDocument()))\n return v8::Handle<v8::Value>();\n\n"); + if ($attribute->signature->extendedAttributes->{"CheckAccessToNode"}) { + push(@implContentDecls, " if (!V8BindingSecurity::allowAccessToNode(V8BindingState::Only(), imp->" . $attribute->signature->name . "()))\n return v8::Handle<v8::Value>();\n\n"); } my $useExceptions = 1 if @{$attribute->getterExceptions}; @@ -893,14 +875,17 @@ END push(@implContentDecls, " ExceptionCode ec = 0;\n"); } - if ($attribute->signature->extendedAttributes->{"v8referenceattr"}) { - $attrName = $attribute->signature->extendedAttributes->{"v8referenceattr"}; - } - my $returnType = GetTypeFromSignature($attribute->signature); my $getterString; + my $callWith = $attribute->signature->extendedAttributes->{"CallWith"} || ""; + if ($getterStringUsesImp) { my ($functionName, @arguments) = $codeGenerator->GetterExpression(\%implIncludes, $interfaceName, $attribute); + + if ($callWith) { + push(@arguments, GenerateCallWith($callWith, \@implContentDecls, " ", 0, 0)); + } + push(@arguments, "ec") if $useExceptions; if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { my $implementedBy = $attribute->signature->extendedAttributes->{"ImplementedBy"}; @@ -930,6 +915,12 @@ END push(@implContentDecls, " $nativeType v = $getterString;\n"); } push(@implContentDecls, GenerateSetDOMException(" ")); + + if ($callWith eq "ScriptState") { + push(@implContentDecls, " if (state.hadException())\n"); + push(@implContentDecls, " return throwError(state.exception());\n"); + } + $result = "v"; $result .= ".release()" if (IsRefPtrType($returnType)); } else { @@ -1128,6 +1119,8 @@ END push(@implContentDecls, " ExceptionCode ec = 0;\n"); } + my $callWith = $attribute->signature->extendedAttributes->{"CallWith"} || ""; + if ($implClassName eq "SVGNumber") { push(@implContentDecls, " *imp = $result;\n"); } else { @@ -1152,6 +1145,11 @@ END push(@implContentDecls, ");\n"); } else { my ($functionName, @arguments) = $codeGenerator->SetterExpression(\%implIncludes, $interfaceName, $attribute); + + if ($callWith) { + push(@arguments, GenerateCallWith($callWith, \@implContentDecls, " ", 1, 0)); + } + push(@arguments, $result); push(@arguments, "ec") if $useExceptions; if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { @@ -1171,6 +1169,11 @@ END push(@implContentDecls, " V8Proxy::setDOMException(ec);\n"); } + if ($callWith eq "ScriptState") { + push(@implContentDecls, " if (state.hadException())\n"); + push(@implContentDecls, " throwError(state.exception());\n"); + } + if ($svgNativeType) { if ($useExceptions) { push(@implContentDecls, " if (!ec)\n"); @@ -1430,10 +1433,9 @@ END AddToImplIncludes("ScriptCallStack.h"); AddToImplIncludes("ScriptCallStackFactory.h"); } - if ($function->signature->extendedAttributes->{"SVGCheckSecurityDocument"}) { - push(@implContentDecls, <<END); - if (!V8BindingSecurity::allowAccessToNode(V8BindingState::Only(), imp->getSVGDocument(ec))) - return v8::Handle<v8::Value>(); + if ($function->signature->extendedAttributes->{"CheckAccessToNode"}) { + push(@implContentDecls, " if (!V8BindingSecurity::allowAccessToNode(V8BindingState::Only(), imp->" . $function->signature->name . "(ec)))\n"); + push(@implContentDecls, " return v8::Handle<v8::Value>();\n"); END } @@ -1454,6 +1456,35 @@ END push(@implContentDecls, "#endif // ${conditionalString}\n\n") if $conditionalString; } +sub GenerateCallWith +{ + my $callWith = shift; + my $outputArray = shift; + my $indent = shift; + my $returnVoid = shift; + my $emptyContext = shift; + my $callWithArg = "COMPILE_ASSERT(false)"; + + if ($callWith eq "ScriptState") { + if ($emptyContext) { + push(@$outputArray, $indent . "EmptyScriptState state;\n"); + $callWithArg = "&state"; + } else { + push(@$outputArray, $indent . "ScriptState* state = ScriptState::current();\n"); + push(@$outputArray, $indent . "if (!state)\n"); + push(@$outputArray, $indent . " return" . ($returnVoid ? "" : " v8::Undefined()") . ";\n"); + $callWithArg = "state"; + } + } elsif ($callWith eq "ScriptExecutionContext") { + push(@$outputArray, $indent . "ScriptExecutionContext* scriptContext = getScriptExecutionContext();\n"); + push(@$outputArray, $indent . "if (!scriptContext)\n"); + push(@$outputArray, $indent . " return" . ($returnVoid ? "" : " v8::Undefined()") . ";\n"); + $callWithArg = "scriptContext"; + } + + return $callWithArg; +} + sub GenerateArgumentsCountCheck { my $function = shift; @@ -1916,7 +1947,7 @@ sub GenerateSingleBatchedAttribute $accessControl .= " | v8::ALL_CAN_WRITE"; } } - if ($attrExt->{"V8DisallowShadowing"}) { + if ($attrExt->{"V8Unforgeable"}) { $accessControl .= " | v8::PROHIBITS_OVERWRITING"; } $accessControl = "static_cast<v8::AccessControl>(" . $accessControl . ")"; @@ -1931,12 +1962,7 @@ sub GenerateSingleBatchedAttribute ""; if ($customAccessor eq 1) { # use the naming convension, interface + (capitalize) attr name - if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { - $customAccessor = $attribute->signature->extendedAttributes->{"ImplementedBy"} . "::" . $attrName; - AddToImplIncludes("V8" . $attribute->signature->extendedAttributes->{"ImplementedBy"} . ".h"); - } else { - $customAccessor = $interfaceName . "::" . $attrName; - } + $customAccessor = $interfaceName . "::" . $attrName; } my $getter; @@ -1948,7 +1974,7 @@ sub GenerateSingleBatchedAttribute if ($attrExt->{"DontEnum"}) { $propAttr .= " | v8::DontEnum"; } - if ($attrExt->{"V8DisallowShadowing"}) { + if ($attrExt->{"V8Unforgeable"}) { $propAttr .= " | v8::DontDelete"; } @@ -2194,7 +2220,7 @@ sub IsTypedArrayType { my $type = shift; return 1 if (($type eq "ArrayBuffer") or ($type eq "ArrayBufferView")); - return 1 if (($type eq "Uint8Array") or ($type eq "Uint16Array") or ($type eq "Uint32Array")); + return 1 if (($type eq "Uint8Array") or ($type eq "Uint8ClampedArray") or ($type eq "Uint16Array") or ($type eq "Uint32Array")); return 1 if (($type eq "Int8Array") or ($type eq "Int16Array") or ($type eq "Int32Array")); return 1 if (($type eq "Float32Array") or ($type eq "Float64Array")); return 0; @@ -2339,7 +2365,7 @@ sub GenerateImplementation my @normal; foreach my $attribute (@$attributes) { - if ($interfaceName eq "DOMWindow" && $attribute->signature->extendedAttributes->{"V8DisallowShadowing"}) { + if ($interfaceName eq "DOMWindow" && $attribute->signature->extendedAttributes->{"V8Unforgeable"}) { push(@disallowsShadowing, $attribute); } elsif ($attribute->signature->extendedAttributes->{"EnabledAtRuntime"}) { push(@enabledAtRuntime, $attribute); @@ -3174,10 +3200,6 @@ sub GenerateFunctionCallString() my $isSVGTearOffType = ($codeGenerator->IsSVGTypeNeedingTearOff($returnType) and not $implClassName =~ /List$/); $nativeReturnType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($returnType) if $isSVGTearOffType; - if ($function->signature->extendedAttributes->{"v8implname"}) { - $name = $function->signature->extendedAttributes->{"v8implname"}; - } - if ($function->signature->extendedAttributes->{"ImplementationFunction"}) { $name = $function->signature->extendedAttributes->{"ImplementationFunction"}; } @@ -3198,20 +3220,11 @@ sub GenerateFunctionCallString() $functionName = "imp->${name}"; } - my $callWith = $function->signature->extendedAttributes->{"CallWith"}; + my $callWith = $function->signature->extendedAttributes->{"CallWith"} || ""; if ($callWith) { - my $callWithArg = "COMPILE_ASSERT(false)"; - if ($callWith eq "ScriptState") { - $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"; - } - push @arguments, $callWithArg; + my @callWithOutput = (); + push(@arguments, GenerateCallWith($callWith, \@callWithOutput, $indent, 0, 1)); + $result .= join("", @callWithOutput); $index++; $numberOfParameters++ } @@ -3254,7 +3267,7 @@ sub GenerateFunctionCallString() if ($returnType eq "void") { $result .= $indent . "$functionString;\n"; - } elsif ($hasScriptState or @{$function->raisesExceptions}) { + } elsif ($callWith eq "ScriptState" or @{$function->raisesExceptions}) { $result .= $indent . $nativeReturnType . " result = $functionString;\n"; } else { # Can inline the function call into the return statement to avoid overhead of using a Ref<> temporary @@ -3271,7 +3284,7 @@ sub GenerateFunctionCallString() $result .= $indent . " goto fail;\n"; } - if ($hasScriptState) { + if ($callWith eq "ScriptState") { $result .= $indent . "if (state.hadException())\n"; $result .= $indent . " return throwError(state.exception());\n" } @@ -3322,7 +3335,7 @@ sub GetNativeTypeFromSignature my $mode = ""; if ($signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"}) { $mode = "WithUndefinedOrNullCheck"; - } elsif ($signature->extendedAttributes->{"ConvertNullToNullString"} || $signature->extendedAttributes->{"Reflect"}) { + } elsif (($signature->extendedAttributes->{"TreatNullAs"} and $signature->extendedAttributes->{"TreatNullAs"} eq "EmptyString") or $signature->extendedAttributes->{"Reflect"}) { $mode = "WithNullCheck"; } $type .= "<$mode>"; @@ -3767,63 +3780,62 @@ sub ReturnNativeToJSValue # Internal helper sub WriteData { - if (defined($IMPL)) { - # Write content to file. - print $IMPL @implContentHeader; + my $object = shift; + my $dataNode = shift; - print $IMPL @implFixedHeader; + my $name = $dataNode->name; + my $prefix = FileNamePrefix; + my $headerFileName = "$outputHeadersDir/$prefix$name.h"; + my $implFileName = "$outputDir/$prefix$name.cpp"; - my @includes = (); - my %implIncludeConditions = (); - foreach my $include (keys %implIncludes) { - my $condition = $implIncludes{$include}; - my $checkType = $include; - $checkType =~ s/\.h//; - next if $codeGenerator->IsSVGAnimatedType($checkType); + # Update a .cpp file if the contents are changed. + my $contents = join "", @implContentHeader, @implFixedHeader; - if ($include =~ /wtf/) { - $include = "\<$include\>"; - } else { - $include = "\"$include\""; - } + my @includes = (); + my %implIncludeConditions = (); + foreach my $include (keys %implIncludes) { + my $condition = $implIncludes{$include}; + my $checkType = $include; + $checkType =~ s/\.h//; + next if $codeGenerator->IsSVGAnimatedType($checkType); - if ($condition eq 1) { - push @includes, $include; - } else { - push @{$implIncludeConditions{$condition}}, $include; - } + if ($include =~ /wtf/) { + $include = "\<$include\>"; + } else { + $include = "\"$include\""; } - foreach my $include (sort @includes) { - print $IMPL "#include $include\n"; + + if ($condition eq 1) { + push @includes, $include; + } else { + push @{$implIncludeConditions{$condition}}, $include; } - foreach my $condition (sort keys %implIncludeConditions) { - print $IMPL "\n#if " . $codeGenerator->GenerateConditionalStringFromAttributeValue($condition) . "\n"; - foreach my $include (sort @{$implIncludeConditions{$condition}}) { - print $IMPL "#include $include\n"; - } - print $IMPL "#endif\n"; + } + foreach my $include (sort @includes) { + $contents .= "#include $include\n"; + } + foreach my $condition (sort keys %implIncludeConditions) { + $contents .= "\n#if " . $codeGenerator->GenerateConditionalStringFromAttributeValue($condition) . "\n"; + foreach my $include (sort @{$implIncludeConditions{$condition}}) { + $contents .= "#include $include\n"; } + $contents .= "#endif\n"; + } - print $IMPL "\n"; - print $IMPL @implContentDecls; - print $IMPL @implContent; - close($IMPL); - undef($IMPL); + $contents .= "\n"; + $contents .= join "", @implContentDecls, @implContent; + $codeGenerator->UpdateFile($implFileName, $contents); - %implIncludes = (); - @implFixedHeader = (); - @implContentDecls = (); - @implContent = (); - } + %implIncludes = (); + @implFixedHeader = (); + @implContentDecls = (); + @implContent = (); - if (defined($HEADER)) { - # Write content to file. - print $HEADER @headerContent; - close($HEADER); - undef($HEADER); + # Update a .h file if the contents are changed. + $contents = join "", @headerContent; + $codeGenerator->UpdateFile($headerFileName, $contents); - @headerContent = (); - } + @headerContent = (); } sub GetVisibleInterfaceName diff --git a/Source/WebCore/bindings/scripts/generate-bindings.pl b/Source/WebCore/bindings/scripts/generate-bindings.pl index cb51f2c6d..5e3895609 100755 --- a/Source/WebCore/bindings/scripts/generate-bindings.pl +++ b/Source/WebCore/bindings/scripts/generate-bindings.pl @@ -148,6 +148,7 @@ foreach my $idlFile (@supplementedIdlFiles) { } die "Not found an interface ${targetInterfaceName} in ${targetInterfaceName}.idl." unless defined $targetDataNode; + # Support [Supplemental] for attributes. foreach my $attribute (@{$dataNode->attributes}) { # Record that this attribute is implemented by $interfaceName. $attribute->signature->extendedAttributes->{"ImplementedBy"} = $interfaceName; @@ -160,17 +161,31 @@ foreach my $idlFile (@supplementedIdlFiles) { push(@{$targetDataNode->attributes}, $attribute); } + # Support [Supplemental] for methods. foreach my $function (@{$dataNode->functions}) { - # Record that this attribute is implemented by $interfaceName. + # Record that this method is implemented by $interfaceName. $function->signature->extendedAttributes->{"ImplementedBy"} = $interfaceName; - # Add interface-wide extended attributes to each attribute. + # Add interface-wide extended attributes to each method. foreach my $extendedAttributeName (keys %{$dataNode->extendedAttributes}) { next if ($extendedAttributeName eq "Supplemental"); $function->signature->extendedAttributes->{$extendedAttributeName} = $dataNode->extendedAttributes->{$extendedAttributeName}; } push(@{$targetDataNode->functions}, $function); } + + # Support [Supplemental] for constants. + foreach my $constant (@{$dataNode->constants}) { + # Record that this constant is implemented by $interfaceName. + $constant->extendedAttributes->{"ImplementedBy"} = $interfaceName; + + # Add interface-wide extended attributes to each constant. + foreach my $extendedAttributeName (keys %{$dataNode->extendedAttributes}) { + next if ($extendedAttributeName eq "Supplemental"); + $constant->extendedAttributes->{$extendedAttributeName} = $dataNode->extendedAttributes->{$extendedAttributeName}; + } + push(@{$targetDataNode->constants}, $constant); + } } } } diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h index 1a55a3550..cec8b6c3c 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h @@ -35,8 +35,6 @@ class TestCallback; class WebDOMClass1; class WebDOMClass2; class WebDOMClass3; -class WebDOMClass5; -class WebDOMClass6; class WebDOMDOMStringList; class WebDOMTestCallback : public WebDOMObject { @@ -51,7 +49,6 @@ public: 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); bool callbackWithStringList(const WebDOMDOMStringList& listParam); WebCore::TestCallback* impl() const; diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp index 7d08ba1fd..a90991088 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.cpp @@ -115,7 +115,7 @@ void WebDOMTestInterface::supplementalMethod1() if (!impl()) return; - TestSupplemental::supplementalMethod1(impl()); + WebCore::TestSupplemental::supplementalMethod1(impl()); } #endif @@ -128,7 +128,7 @@ WebDOMTestObj WebDOMTestInterface::supplementalMethod2(const WebDOMString& strAr return WebDOMTestObj(); WebCore::ExceptionCode ec = 0; - WebDOMTestObj result = toWebKit(WTF::getPtr(TestSupplemental::supplementalMethod2(impl(), strArg, toWebCore(objArg), ec))); + WebDOMTestObj result = toWebKit(WTF::getPtr(WebCore::TestSupplemental::supplementalMethod2(impl(), strArg, toWebCore(objArg), ec))); webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); return result; } diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h index 3d48186e2..4c7f666bf 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestInterface.h @@ -42,6 +42,16 @@ public: WebDOMTestInterface& operator=(const WebDOMTestInterface&); virtual ~WebDOMTestInterface(); + enum { +#if ENABLE(Condition11) || ENABLE(Condition12) + WEBDOM_SUPPLEMENTALCONSTANT1 = 1, +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) + WEBDOM_SUPPLEMENTALCONSTANT2 = 2 +#endif + + }; + #if ENABLE(Condition11) || ENABLE(Condition12) WebDOMString supplementalStr1() const; #endif diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp index 9dac2da8a..d81871fa6 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp @@ -345,22 +345,6 @@ void WebDOMTestObj::setReflectedURLAttr(const WebDOMString& newReflectedURLAttr) impl()->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, newReflectedURLAttr); } -WebDOMString WebDOMTestObj::reflectedNonEmptyURLAttr() const -{ - if (!impl()) - return WebDOMString(); - - return static_cast<const WTF::String&>(impl()->getNonEmptyURLAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr)); -} - -void WebDOMTestObj::setReflectedNonEmptyURLAttr(const WebDOMString& newReflectedNonEmptyURLAttr) -{ - if (!impl()) - return; - - impl()->setAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr, newReflectedNonEmptyURLAttr); -} - WebDOMString WebDOMTestObj::reflectedStringAttr() const { if (!impl()) @@ -425,22 +409,6 @@ void WebDOMTestObj::setReflectedCustomURLAttr(const WebDOMString& newReflectedCu impl()->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, newReflectedCustomURLAttr); } -WebDOMString WebDOMTestObj::reflectedCustomNonEmptyURLAttr() const -{ - if (!impl()) - return WebDOMString(); - - return static_cast<const WTF::String&>(impl()->getNonEmptyURLAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr)); -} - -void WebDOMTestObj::setReflectedCustomNonEmptyURLAttr(const WebDOMString& newReflectedCustomNonEmptyURLAttr) -{ - if (!impl()) - return; - - impl()->setAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr, newReflectedCustomNonEmptyURLAttr); -} - int WebDOMTestObj::attrWithGetterException() const { if (!impl()) @@ -519,6 +487,80 @@ void WebDOMTestObj::setStringAttrWithSetterException(const WebDOMString& newStri webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); } +int WebDOMTestObj::withScriptStateAttribute() const +{ + if (!impl()) + return 0; + + return impl()->withScriptStateAttribute(); +} + +void WebDOMTestObj::setWithScriptStateAttribute(int newWithScriptStateAttribute) +{ + if (!impl()) + return; + + impl()->setWithScriptStateAttribute(newWithScriptStateAttribute); +} + +WebDOMTestObj WebDOMTestObj::withScriptExecutionContextAttribute() const +{ + if (!impl()) + return WebDOMTestObj(); + + return toWebKit(WTF::getPtr(impl()->withScriptExecutionContextAttribute())); +} + +void WebDOMTestObj::setWithScriptExecutionContextAttribute(const WebDOMTestObj& newWithScriptExecutionContextAttribute) +{ + if (!impl()) + return; + + impl()->setWithScriptExecutionContextAttribute(toWebCore(newWithScriptExecutionContextAttribute)); +} + +WebDOMTestObj WebDOMTestObj::withScriptStateAttributeRaises() const +{ + if (!impl()) + return WebDOMTestObj(); + + WebCore::ExceptionCode ec = 0; + WebDOMTestObj result = toWebKit(WTF::getPtr(impl()->withScriptStateAttributeRaises(ec))); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); + return result; +} + +void WebDOMTestObj::setWithScriptStateAttributeRaises(const WebDOMTestObj& newWithScriptStateAttributeRaises) +{ + if (!impl()) + return; + + WebCore::ExceptionCode ec = 0; + impl()->setWithScriptStateAttributeRaises(toWebCore(newWithScriptStateAttributeRaises), ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); +} + +WebDOMTestObj WebDOMTestObj::withScriptExecutionContextAttributeRaises() const +{ + if (!impl()) + return WebDOMTestObj(); + + WebCore::ExceptionCode ec = 0; + WebDOMTestObj result = toWebKit(WTF::getPtr(impl()->withScriptExecutionContextAttributeRaises(ec))); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); + return result; +} + +void WebDOMTestObj::setWithScriptExecutionContextAttributeRaises(const WebDOMTestObj& newWithScriptExecutionContextAttributeRaises) +{ + if (!impl()) + return; + + WebCore::ExceptionCode ec = 0; + impl()->setWithScriptExecutionContextAttributeRaises(toWebCore(newWithScriptExecutionContextAttributeRaises), ec); + webDOMRaiseError(static_cast<WebDOMExceptionCode>(ec)); +} + WebDOMString WebDOMTestObj::scriptStringAttr() const { if (!impl()) diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h index e9b03bc3a..6f9101d12 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h @@ -104,8 +104,6 @@ public: void setReflectedBooleanAttr(bool); WebDOMString reflectedURLAttr() const; void setReflectedURLAttr(const WebDOMString&); - WebDOMString reflectedNonEmptyURLAttr() const; - void setReflectedNonEmptyURLAttr(const WebDOMString&); WebDOMString reflectedStringAttr() const; void setReflectedStringAttr(const WebDOMString&); int reflectedCustomIntegralAttr() const; @@ -114,8 +112,6 @@ public: void setReflectedCustomBooleanAttr(bool); WebDOMString reflectedCustomURLAttr() const; void setReflectedCustomURLAttr(const WebDOMString&); - WebDOMString reflectedCustomNonEmptyURLAttr() const; - void setReflectedCustomNonEmptyURLAttr(const WebDOMString&); int attrWithGetterException() const; void setAttrWithGetterException(int); int attrWithSetterException() const; @@ -124,8 +120,14 @@ public: void setStringAttrWithGetterException(const WebDOMString&); WebDOMString stringAttrWithSetterException() const; void setStringAttrWithSetterException(const WebDOMString&); - int customAttr() const; - void setCustomAttr(int); + int withScriptStateAttribute() const; + void setWithScriptStateAttribute(int); + WebDOMTestObj withScriptExecutionContextAttribute() const; + void setWithScriptExecutionContextAttribute(const WebDOMTestObj&); + WebDOMTestObj withScriptStateAttributeRaises() const; + void setWithScriptStateAttributeRaises(const WebDOMTestObj&); + WebDOMTestObj withScriptExecutionContextAttributeRaises() const; + void setWithScriptExecutionContextAttributeRaises(const WebDOMTestObj&); WebDOMString scriptStringAttr() const; #if ENABLE(Condition1) int conditionalAttr1() const; @@ -174,8 +176,6 @@ public: void idbKey(const WebDOMIDBKey& key); void optionsObject(const WebDOMOptionsObject& oo, const WebDOMOptionsObject& ooo); 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 withScriptStateVoid(); diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp index 70147cb81..63a37b67b 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -855,27 +855,6 @@ webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, const gchar* } gchar* -webkit_dom_test_obj_get_reflected_non_empty_url_attr(WebKitDOMTestObj* self) -{ - g_return_val_if_fail(self, 0); - WebCore::JSMainThreadNullState state; - WebCore::TestObj * item = WebKit::core(self); - gchar* res = convertToUTF8String(item->getNonEmptyURLAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr)); - return res; -} - -void -webkit_dom_test_obj_set_reflected_non_empty_url_attr(WebKitDOMTestObj* self, const gchar* value) -{ - g_return_if_fail(self); - WebCore::JSMainThreadNullState state; - WebCore::TestObj * item = WebKit::core(self); - g_return_if_fail(value); - WTF::String converted_value = WTF::String::fromUTF8(value); - item->setAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr, converted_value); -} - -gchar* webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self) { g_return_val_if_fail(self, 0); @@ -955,27 +934,6 @@ webkit_dom_test_obj_set_reflected_custom_url_attr(WebKitDOMTestObj* self, const item->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, converted_value); } -gchar* -webkit_dom_test_obj_get_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self) -{ - g_return_val_if_fail(self, 0); - WebCore::JSMainThreadNullState state; - WebCore::TestObj * item = WebKit::core(self); - gchar* res = convertToUTF8String(item->getNonEmptyURLAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr)); - return res; -} - -void -webkit_dom_test_obj_set_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self, const gchar* value) -{ - g_return_if_fail(self); - WebCore::JSMainThreadNullState state; - WebCore::TestObj * item = WebKit::core(self); - g_return_if_fail(value); - WTF::String converted_value = WTF::String::fromUTF8(value); - item->setAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr, converted_value); -} - glong webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self, GError **error) { @@ -1082,6 +1040,123 @@ webkit_dom_test_obj_set_string_attr_with_setter_exception(WebKitDOMTestObj* self } } +glong +webkit_dom_test_obj_get_with_script_state_attribute(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + glong res = item->withScriptStateAttribute(); + return res; +} + +void +webkit_dom_test_obj_set_with_script_state_attribute(WebKitDOMTestObj* self, glong value) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + item->setWithScriptStateAttribute(value); +} + +WebKitDOMTestObj* +webkit_dom_test_obj_get_with_script_execution_context_attribute(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptExecutionContextAttribute()); + WebKitDOMTestObj* res = WebKit::kit(g_res.get()); + return res; +} + +void +webkit_dom_test_obj_set_with_script_execution_context_attribute(WebKitDOMTestObj* self, WebKitDOMTestObj* value) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(value); + WebCore::TestObj * converted_value = NULL; + if (value != NULL) { + converted_value = WebKit::core(value); + g_return_if_fail(converted_value); + } + item->setWithScriptExecutionContextAttribute(converted_value); +} + +WebKitDOMTestObj* +webkit_dom_test_obj_get_with_script_state_attribute_raises(WebKitDOMTestObj* self, GError **error) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + WebCore::ExceptionCode ec = 0; + PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptStateAttributeRaises(ec)); + if (ec) { + WebCore::ExceptionCodeDescription ecdesc(ec); + g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); + } + WebKitDOMTestObj* res = WebKit::kit(g_res.get()); + return res; +} + +void +webkit_dom_test_obj_set_with_script_state_attribute_raises(WebKitDOMTestObj* self, WebKitDOMTestObj* value, GError **error) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(value); + WebCore::TestObj * converted_value = NULL; + if (value != NULL) { + converted_value = WebKit::core(value); + g_return_if_fail(converted_value); + } + WebCore::ExceptionCode ec = 0; + item->setWithScriptStateAttributeRaises(converted_value, ec); + if (ec) { + WebCore::ExceptionCodeDescription ecdesc(ec); + g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); + } +} + +WebKitDOMTestObj* +webkit_dom_test_obj_get_with_script_execution_context_attribute_raises(WebKitDOMTestObj* self, GError **error) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + WebCore::ExceptionCode ec = 0; + PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptExecutionContextAttributeRaises(ec)); + if (ec) { + WebCore::ExceptionCodeDescription ecdesc(ec); + g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name); + } + WebKitDOMTestObj* res = WebKit::kit(g_res.get()); + return res; +} + +void +webkit_dom_test_obj_set_with_script_execution_context_attribute_raises(WebKitDOMTestObj* self, WebKitDOMTestObj* value, GError **error) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(value); + WebCore::TestObj * converted_value = NULL; + if (value != NULL) { + converted_value = WebKit::core(value); + g_return_if_fail(converted_value); + } + WebCore::ExceptionCode ec = 0; + item->setWithScriptExecutionContextAttributeRaises(converted_value, ec); + if (ec) { + WebCore::ExceptionCodeDescription ecdesc(ec); + 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) { @@ -1323,17 +1398,19 @@ enum { PROP_REFLECTED_UNSIGNED_INTEGRAL_ATTR, PROP_REFLECTED_BOOLEAN_ATTR, PROP_REFLECTED_URL_ATTR, - PROP_REFLECTED_NON_EMPTY_URL_ATTR, PROP_REFLECTED_STRING_ATTR, PROP_REFLECTED_CUSTOM_INTEGRAL_ATTR, PROP_REFLECTED_CUSTOM_BOOLEAN_ATTR, PROP_REFLECTED_CUSTOM_URL_ATTR, - PROP_REFLECTED_CUSTOM_NON_EMPTY_URL_ATTR, PROP_ATTR_WITH_GETTER_EXCEPTION, PROP_ATTR_WITH_SETTER_EXCEPTION, PROP_STRING_ATTR_WITH_GETTER_EXCEPTION, PROP_STRING_ATTR_WITH_SETTER_EXCEPTION, PROP_CUSTOM_ATTR, + PROP_WITH_SCRIPT_STATE_ATTRIBUTE, + PROP_WITH_SCRIPT_EXECUTION_CONTEXT_ATTRIBUTE, + PROP_WITH_SCRIPT_STATE_ATTRIBUTE_RAISES, + PROP_WITH_SCRIPT_EXECUTION_CONTEXT_ATTRIBUTE_RAISES, PROP_SCRIPT_STRING_ATTR, #if ENABLE(Condition1) PROP_CONDITIONAL_ATTR1, @@ -1426,11 +1503,6 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con coreSelf->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, WTF::String::fromUTF8(g_value_get_string(value))); break; } - case PROP_REFLECTED_NON_EMPTY_URL_ATTR: - { - coreSelf->setAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr, WTF::String::fromUTF8(g_value_get_string(value))); - break; - } case PROP_REFLECTED_STRING_ATTR: { coreSelf->setAttribute(WebCore::HTMLNames::customContentStringAttrAttr, WTF::String::fromUTF8(g_value_get_string(value))); @@ -1451,11 +1523,6 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con coreSelf->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, WTF::String::fromUTF8(g_value_get_string(value))); break; } - case PROP_REFLECTED_CUSTOM_NON_EMPTY_URL_ATTR: - { - coreSelf->setAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr, WTF::String::fromUTF8(g_value_get_string(value))); - break; - } case PROP_ATTR_WITH_GETTER_EXCEPTION: { WebCore::ExceptionCode ec = 0; @@ -1480,6 +1547,11 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con coreSelf->setStringAttrWithSetterException(WTF::String::fromUTF8(g_value_get_string(value)), ec); break; } + case PROP_WITH_SCRIPT_STATE_ATTRIBUTE: + { + coreSelf->setWithScriptStateAttribute((g_value_get_long(value))); + break; + } #if ENABLE(Condition1) case PROP_CONDITIONAL_ATTR1: { @@ -1612,11 +1684,6 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GVa g_value_take_string(value, convertToUTF8String(coreSelf->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr))); break; } - case PROP_REFLECTED_NON_EMPTY_URL_ATTR: - { - g_value_take_string(value, convertToUTF8String(coreSelf->getNonEmptyURLAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr))); - break; - } case PROP_REFLECTED_STRING_ATTR: { g_value_take_string(value, convertToUTF8String(coreSelf->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr))); @@ -1637,11 +1704,6 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GVa g_value_take_string(value, convertToUTF8String(coreSelf->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr))); break; } - case PROP_REFLECTED_CUSTOM_NON_EMPTY_URL_ATTR: - { - g_value_take_string(value, convertToUTF8String(coreSelf->getNonEmptyURLAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr))); - break; - } case PROP_ATTR_WITH_GETTER_EXCEPTION: { WebCore::ExceptionCode ec = 0; @@ -1664,6 +1726,31 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GVa g_value_take_string(value, convertToUTF8String(coreSelf->stringAttrWithSetterException())); break; } + case PROP_WITH_SCRIPT_STATE_ATTRIBUTE: + { + g_value_set_long(value, coreSelf->withScriptStateAttribute()); + break; + } + case PROP_WITH_SCRIPT_EXECUTION_CONTEXT_ATTRIBUTE: + { + RefPtr<WebCore::TestObj> ptr = coreSelf->withScriptExecutionContextAttribute(); + g_value_set_object(value, WebKit::kit(ptr.get())); + break; + } + case PROP_WITH_SCRIPT_STATE_ATTRIBUTE_RAISES: + { + WebCore::ExceptionCode ec = 0; + RefPtr<WebCore::TestObj> ptr = coreSelf->withScriptStateAttributeRaises(ec); + g_value_set_object(value, WebKit::kit(ptr.get())); + break; + } + case PROP_WITH_SCRIPT_EXECUTION_CONTEXT_ATTRIBUTE_RAISES: + { + WebCore::ExceptionCode ec = 0; + RefPtr<WebCore::TestObj> ptr = coreSelf->withScriptExecutionContextAttributeRaises(ec); + g_value_set_object(value, WebKit::kit(ptr.get())); + break; + } case PROP_SCRIPT_STRING_ATTR: { g_value_take_string(value, convertToUTF8String(coreSelf->scriptStringAttr())); @@ -1886,13 +1973,6 @@ G_MAXULONG, /* max */ "", /* default */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, - PROP_REFLECTED_NON_EMPTY_URL_ATTR, - g_param_spec_string("reflected-non-empty-url-attr", /* name */ - "test_obj_reflected-non-empty-url-attr", /* short description */ - "read-write gchar* TestObj.reflected-non-empty-url-attr", /* longer - could do with some extra doc stuff here */ - "", /* default */ - WEBKIT_PARAM_READWRITE)); - g_object_class_install_property(gobjectClass, PROP_REFLECTED_STRING_ATTR, g_param_spec_string("reflected-string-attr", /* name */ "test_obj_reflected-string-attr", /* short description */ @@ -1923,13 +2003,6 @@ G_MAXLONG, /* max */ "", /* default */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, - PROP_REFLECTED_CUSTOM_NON_EMPTY_URL_ATTR, - g_param_spec_string("reflected-custom-non-empty-url-attr", /* name */ - "test_obj_reflected-custom-non-empty-url-attr", /* short description */ - "read-write gchar* TestObj.reflected-custom-non-empty-url-attr", /* longer - could do with some extra doc stuff here */ - "", /* default */ - WEBKIT_PARAM_READWRITE)); - 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 */ @@ -1962,6 +2035,36 @@ G_MAXLONG, /* max */ "", /* default */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, + PROP_WITH_SCRIPT_STATE_ATTRIBUTE, + g_param_spec_long("with-script-state-attribute", /* name */ + "test_obj_with-script-state-attribute", /* short description */ + "read-write glong TestObj.with-script-state-attribute", /* 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_WITH_SCRIPT_EXECUTION_CONTEXT_ATTRIBUTE, + g_param_spec_object("with-script-execution-context-attribute", /* name */ + "test_obj_with-script-execution-context-attribute", /* short description */ + "read-write WebKitDOMTestObj* TestObj.with-script-execution-context-attribute", /* 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, + PROP_WITH_SCRIPT_STATE_ATTRIBUTE_RAISES, + g_param_spec_object("with-script-state-attribute-raises", /* name */ + "test_obj_with-script-state-attribute-raises", /* short description */ + "read-write WebKitDOMTestObj* TestObj.with-script-state-attribute-raises", /* 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, + PROP_WITH_SCRIPT_EXECUTION_CONTEXT_ATTRIBUTE_RAISES, + g_param_spec_object("with-script-execution-context-attribute-raises", /* name */ + "test_obj_with-script-execution-context-attribute-raises", /* short description */ + "read-write WebKitDOMTestObj* TestObj.with-script-execution-context-attribute-raises", /* 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, PROP_SCRIPT_STRING_ATTR, g_param_spec_string("script-string-attr", /* name */ "test_obj_script-string-attr", /* short description */ diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h index a60b97eea..f118dd880 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h @@ -758,27 +758,6 @@ WEBKIT_API void webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, const gchar* value); /** - * webkit_dom_test_obj_get_reflected_non_empty_url_attr: - * @self: A #WebKitDOMTestObj - * - * Returns: - * -**/ -WEBKIT_API gchar* -webkit_dom_test_obj_get_reflected_non_empty_url_attr(WebKitDOMTestObj* self); - -/** - * webkit_dom_test_obj_set_reflected_non_empty_url_attr: - * @self: A #WebKitDOMTestObj - * @value: A #gchar - * - * Returns: - * -**/ -WEBKIT_API void -webkit_dom_test_obj_set_reflected_non_empty_url_attr(WebKitDOMTestObj* self, const gchar* value); - -/** * webkit_dom_test_obj_get_reflected_string_attr: * @self: A #WebKitDOMTestObj * @@ -863,27 +842,6 @@ WEBKIT_API void webkit_dom_test_obj_set_reflected_custom_url_attr(WebKitDOMTestObj* self, const gchar* value); /** - * webkit_dom_test_obj_get_reflected_custom_non_empty_url_attr: - * @self: A #WebKitDOMTestObj - * - * Returns: - * -**/ -WEBKIT_API gchar* -webkit_dom_test_obj_get_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self); - -/** - * webkit_dom_test_obj_set_reflected_custom_non_empty_url_attr: - * @self: A #WebKitDOMTestObj - * @value: A #gchar - * - * Returns: - * -**/ -WEBKIT_API void -webkit_dom_test_obj_set_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self, const gchar* value); - -/** * webkit_dom_test_obj_get_attr_with_getter_exception: * @self: A #WebKitDOMTestObj * @error: #GError @@ -974,6 +932,94 @@ WEBKIT_API void webkit_dom_test_obj_set_string_attr_with_setter_exception(WebKitDOMTestObj* self, const gchar* value, GError **error); /** + * webkit_dom_test_obj_get_with_script_state_attribute: + * @self: A #WebKitDOMTestObj + * + * Returns: + * +**/ +WEBKIT_API glong +webkit_dom_test_obj_get_with_script_state_attribute(WebKitDOMTestObj* self); + +/** + * webkit_dom_test_obj_set_with_script_state_attribute: + * @self: A #WebKitDOMTestObj + * @value: A #glong + * + * Returns: + * +**/ +WEBKIT_API void +webkit_dom_test_obj_set_with_script_state_attribute(WebKitDOMTestObj* self, glong value); + +/** + * webkit_dom_test_obj_get_with_script_execution_context_attribute: + * @self: A #WebKitDOMTestObj + * + * Returns: (transfer none): + * +**/ +WEBKIT_API WebKitDOMTestObj* +webkit_dom_test_obj_get_with_script_execution_context_attribute(WebKitDOMTestObj* self); + +/** + * webkit_dom_test_obj_set_with_script_execution_context_attribute: + * @self: A #WebKitDOMTestObj + * @value: A #WebKitDOMTestObj + * + * Returns: (transfer none): + * +**/ +WEBKIT_API void +webkit_dom_test_obj_set_with_script_execution_context_attribute(WebKitDOMTestObj* self, WebKitDOMTestObj* value); + +/** + * webkit_dom_test_obj_get_with_script_state_attribute_raises: + * @self: A #WebKitDOMTestObj + * @error: #GError + * + * Returns: (transfer none): + * +**/ +WEBKIT_API WebKitDOMTestObj* +webkit_dom_test_obj_get_with_script_state_attribute_raises(WebKitDOMTestObj* self, GError **error); + +/** + * webkit_dom_test_obj_set_with_script_state_attribute_raises: + * @self: A #WebKitDOMTestObj + * @value: A #WebKitDOMTestObj + * @error: #GError + * + * Returns: (transfer none): + * +**/ +WEBKIT_API void +webkit_dom_test_obj_set_with_script_state_attribute_raises(WebKitDOMTestObj* self, WebKitDOMTestObj* value, GError **error); + +/** + * webkit_dom_test_obj_get_with_script_execution_context_attribute_raises: + * @self: A #WebKitDOMTestObj + * @error: #GError + * + * Returns: (transfer none): + * +**/ +WEBKIT_API WebKitDOMTestObj* +webkit_dom_test_obj_get_with_script_execution_context_attribute_raises(WebKitDOMTestObj* self, GError **error); + +/** + * webkit_dom_test_obj_set_with_script_execution_context_attribute_raises: + * @self: A #WebKitDOMTestObj + * @value: A #WebKitDOMTestObj + * @error: #GError + * + * Returns: (transfer none): + * +**/ +WEBKIT_API void +webkit_dom_test_obj_set_with_script_execution_context_attribute_raises(WebKitDOMTestObj* self, WebKitDOMTestObj* value, GError **error); + +/** * webkit_dom_test_obj_get_script_string_attr: * @self: A #WebKitDOMTestObj * diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp index d7bfd9f0f..488190ade 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp @@ -203,7 +203,7 @@ EncodedJSValue JSC_HOST_CALL jsTestActiveDOMObjectPrototypeFunctionPostMessage(E TestActiveDOMObject* impl = static_cast<TestActiveDOMObject*>(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createTypeError(exec, "Not enough arguments")); - const String& message(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec))); + const String& message(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); impl->postMessage(message); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp index feb3e1f41..dbe8e5e30 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp @@ -88,7 +88,7 @@ EncodedJSValue JSC_HOST_CALL JSTestEventConstructorConstructor::constructJSTestE if (!executionContext) return throwVMError(exec, createReferenceError(exec, "Constructor associated execution context is unavailable")); - AtomicString eventType = ustringToAtomicString(exec->argument(0).toString(exec)); + AtomicString eventType = ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp index e453a2532..9a522f300 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp @@ -256,7 +256,7 @@ EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionAddEventListener( JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); - impl->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); + impl->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); } @@ -273,7 +273,7 @@ EncodedJSValue JSC_HOST_CALL jsTestEventTargetPrototypeFunctionRemoveEventListen JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); - impl->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); + impl->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); } diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp index fa54a33e9..04c937f71 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -68,10 +68,24 @@ static const HashTable JSTestInterfaceTable = { 9, 7, JSTestInterfaceTableValues static const HashTableValue JSTestInterfaceConstructorTableValues[] = { +#if ENABLE(Condition11) || ENABLE(Condition12) + { "SUPPLEMENTALCONSTANT1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSUPPLEMENTALCONSTANT1), (intptr_t)0, NoIntrinsic }, +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) + { "SUPPLEMENTALCONSTANT2", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSUPPLEMENTALCONSTANT2), (intptr_t)0, NoIntrinsic }, +#endif { 0, 0, 0, 0, NoIntrinsic } }; -static const HashTable JSTestInterfaceConstructorTable = { 1, 0, JSTestInterfaceConstructorTableValues, 0 }; +static const HashTable JSTestInterfaceConstructorTable = { 4, 3, JSTestInterfaceConstructorTableValues, 0 }; + +#if ENABLE(Condition11) || ENABLE(Condition12) +COMPILE_ASSERT(1 == TestInterface::SUPPLEMENTALCONSTANT1, TestInterfaceEnumSUPPLEMENTALCONSTANT1IsWrongUseDontCheckEnums); +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) +COMPILE_ASSERT(2 == TestInterface::CONST_IMPL, TestInterfaceEnumCONST_IMPLIsWrongUseDontCheckEnums); +#endif + ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSTestInterfaceConstructor); const ClassInfo JSTestInterfaceConstructor::s_info = { "TestInterfaceConstructor", &Base::s_info, &JSTestInterfaceConstructorTable, 0, CREATE_METHOD_TABLE(JSTestInterfaceConstructor) }; @@ -104,10 +118,10 @@ EncodedJSValue JSC_HOST_CALL JSTestInterfaceConstructor::constructJSTestInterfac if (exec->argumentCount() < 1) return throwVMError(exec, createTypeError(exec, "Not enough arguments")); ExceptionCode ec = 0; - const String& str1(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec))); + const String& str1(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); - const String& str2(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toString(exec))); + const String& str2(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); ScriptExecutionContext* context = jsConstructor->scriptExecutionContext(); @@ -132,15 +146,24 @@ ConstructType JSTestInterfaceConstructor::getConstructData(JSCell*, ConstructDat static const HashTableValue JSTestInterfacePrototypeTableValues[] = { #if ENABLE(Condition11) || ENABLE(Condition12) + { "SUPPLEMENTALCONSTANT1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSUPPLEMENTALCONSTANT1), (intptr_t)0, NoIntrinsic }, +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) + { "SUPPLEMENTALCONSTANT2", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSUPPLEMENTALCONSTANT2), (intptr_t)0, NoIntrinsic }, +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) { "supplementalMethod1", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod1), (intptr_t)0, NoIntrinsic }, #endif #if ENABLE(Condition11) || ENABLE(Condition12) { "supplementalMethod2", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod2), (intptr_t)2, NoIntrinsic }, #endif +#if ENABLE(Condition11) || ENABLE(Condition12) + { "supplementalMethod3", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod3), (intptr_t)0, NoIntrinsic }, +#endif { 0, 0, 0, 0, NoIntrinsic } }; -static const HashTable JSTestInterfacePrototypeTable = { 5, 3, JSTestInterfacePrototypeTableValues, 0 }; +static const HashTable JSTestInterfacePrototypeTable = { 17, 15, JSTestInterfacePrototypeTableValues, 0 }; const ClassInfo JSTestInterfacePrototype::s_info = { "TestInterfacePrototype", &Base::s_info, &JSTestInterfacePrototypeTable, 0, CREATE_METHOD_TABLE(JSTestInterfacePrototype) }; JSObject* JSTestInterfacePrototype::self(ExecState* exec, JSGlobalObject* globalObject) @@ -151,13 +174,13 @@ JSObject* JSTestInterfacePrototype::self(ExecState* exec, JSGlobalObject* global bool JSTestInterfacePrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { JSTestInterfacePrototype* thisObject = jsCast<JSTestInterfacePrototype*>(cell); - return getStaticFunctionSlot<JSObject>(exec, &JSTestInterfacePrototypeTable, thisObject, propertyName, slot); + return getStaticPropertySlot<JSTestInterfacePrototype, JSObject>(exec, &JSTestInterfacePrototypeTable, thisObject, propertyName, slot); } bool JSTestInterfacePrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { JSTestInterfacePrototype* thisObject = jsCast<JSTestInterfacePrototype*>(object); - return getStaticFunctionDescriptor<JSObject>(exec, &JSTestInterfacePrototypeTable, thisObject, propertyName, descriptor); + return getStaticPropertyDescriptor<JSTestInterfacePrototype, JSObject>(exec, &JSTestInterfacePrototypeTable, thisObject, propertyName, descriptor); } const ClassInfo JSTestInterface::s_info = { "TestInterface", &Base::s_info, &JSTestInterfaceTable, 0 , CREATE_METHOD_TABLE(JSTestInterface) }; @@ -227,8 +250,7 @@ JSValue jsTestInterfaceSupplementalStr2(ExecState* exec, JSValue slotBase, const JSValue jsTestInterfaceSupplementalStr3(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestInterface* castedThis = static_cast<JSTestInterface*>(asObject(slotBase)); - TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); - return castedThis->supplementalStr3(impl, exec); + return castedThis->supplementalStr3(exec); } #endif @@ -253,7 +275,7 @@ void setJSTestInterfaceSupplementalStr2(ExecState* exec, JSObject* thisObject, J { JSTestInterface* castedThis = static_cast<JSTestInterface*>(thisObject); TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); - TestSupplemental::setSupplementalStr2(impl, ustringToString(value.isEmpty() ? UString() : value.toString(exec))); + TestSupplemental::setSupplementalStr2(impl, ustringToString(value.isEmpty() ? UString() : value.toString(exec)->value(exec))); } #endif @@ -261,9 +283,7 @@ void setJSTestInterfaceSupplementalStr2(ExecState* exec, JSObject* thisObject, J #if ENABLE(Condition11) || ENABLE(Condition12) void setJSTestInterfaceSupplementalStr3(ExecState* exec, JSObject* thisObject, JSValue value) { - JSTestInterface* castedThis = static_cast<JSTestInterface*>(thisObject); - TestInterface* impl = static_cast<TestInterface*>(castedThis->impl()); - castedThis->setSupplementalStr3(impl, exec, value); + static_cast<JSTestInterface*>(thisObject)->setSupplementalStr3(exec, value); } #endif @@ -303,7 +323,7 @@ EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod2 ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); if (!scriptContext) return JSValue::encode(jsUndefined()); - const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec))); + const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); TestObj* objArg(toTestObj(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined))); @@ -317,6 +337,37 @@ EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod2 #endif +#if ENABLE(Condition11) || ENABLE(Condition12) +EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod3(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestInterface::s_info)) + return throwVMTypeError(exec); + JSTestInterface* castedThis = static_cast<JSTestInterface*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestInterface::s_info); + return JSValue::encode(castedThis->supplementalMethod3(exec)); +} + +#endif + +// Constant getters + +#if ENABLE(Condition11) || ENABLE(Condition12) +JSValue jsTestInterfaceSUPPLEMENTALCONSTANT1(ExecState* exec, JSValue, const Identifier&) +{ + UNUSED_PARAM(exec); + return jsNumber(static_cast<int>(1)); +} + +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) +JSValue jsTestInterfaceSUPPLEMENTALCONSTANT2(ExecState* exec, JSValue, const Identifier&) +{ + UNUSED_PARAM(exec); + return jsNumber(static_cast<int>(2)); +} + +#endif static inline bool isObservable(JSTestInterface* jsTestInterface) { if (jsTestInterface->hasCustomProperties()) diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h index ec94eed36..c6f3da952 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h @@ -57,7 +57,11 @@ public: static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); // Custom attributes - JSC::JSValue supplementalStr3(TestInterface*, JSC::ExecState*) const; + JSC::JSValue supplementalStr3(JSC::ExecState*) const; + void setSupplementalStr3(JSC::ExecState*, JSC::JSValue); + + // Custom functions + JSC::JSValue supplementalMethod3(JSC::ExecState*); TestInterface* impl() const { return m_impl; } void releaseImpl() { m_impl->deref(); m_impl = 0; } @@ -146,6 +150,7 @@ protected: JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod1(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod2(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod3(JSC::ExecState*); // Attributes JSC::JSValue jsTestInterfaceSupplementalStr1(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); @@ -154,6 +159,14 @@ void setJSTestInterfaceSupplementalStr2(JSC::ExecState*, JSC::JSObject*, JSC::JS JSC::JSValue jsTestInterfaceSupplementalStr3(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestInterfaceSupplementalStr3(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestInterfaceConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +// Constants + +#if ENABLE(Condition11) || ENABLE(Condition12) +JSC::JSValue jsTestInterfaceSUPPLEMENTALCONSTANT1(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) +JSC::JSValue jsTestInterfaceSUPPLEMENTALCONSTANT2(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +#endif } // namespace WebCore diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp index 804be79cf..147f2c19f 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp @@ -97,13 +97,13 @@ EncodedJSValue JSC_HOST_CALL JSTestNamedConstructorNamedConstructor::constructJS if (exec->argumentCount() < 1) return throwVMError(exec, createTypeError(exec, "Not enough arguments")); ExceptionCode ec = 0; - const String& str1(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec))); + const String& str1(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); - const String& str2(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toString(exec))); + const String& str2(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); - const String& str3(ustringToString(MAYBE_MISSING_PARAMETER(exec, 2, MissingIsEmpty).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 2, MissingIsEmpty).toString(exec))); + const String& str3(ustringToString(MAYBE_MISSING_PARAMETER(exec, 2, MissingIsEmpty).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 2, MissingIsEmpty).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); RefPtr<TestNamedConstructor> object = TestNamedConstructor::createForJSConstructor(jsConstructor->document(), str1, str2, str3, ec); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index e91a11403..183227e2a 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -96,17 +96,19 @@ static const HashTableValue JSTestObjTableValues[] = { "reflectedUnsignedIntegralAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedUnsignedIntegralAttr), (intptr_t)setJSTestObjReflectedUnsignedIntegralAttr, NoIntrinsic }, { "reflectedBooleanAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedBooleanAttr), (intptr_t)setJSTestObjReflectedBooleanAttr, NoIntrinsic }, { "reflectedURLAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedURLAttr), (intptr_t)setJSTestObjReflectedURLAttr, NoIntrinsic }, - { "reflectedNonEmptyURLAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedNonEmptyURLAttr), (intptr_t)setJSTestObjReflectedNonEmptyURLAttr, NoIntrinsic }, { "reflectedStringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedStringAttr), (intptr_t)setJSTestObjReflectedStringAttr, NoIntrinsic }, { "reflectedCustomIntegralAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedCustomIntegralAttr), (intptr_t)setJSTestObjReflectedCustomIntegralAttr, NoIntrinsic }, { "reflectedCustomBooleanAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedCustomBooleanAttr), (intptr_t)setJSTestObjReflectedCustomBooleanAttr, NoIntrinsic }, { "reflectedCustomURLAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedCustomURLAttr), (intptr_t)setJSTestObjReflectedCustomURLAttr, NoIntrinsic }, - { "reflectedCustomNonEmptyURLAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedCustomNonEmptyURLAttr), (intptr_t)setJSTestObjReflectedCustomNonEmptyURLAttr, NoIntrinsic }, { "attrWithGetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithGetterException), (intptr_t)setJSTestObjAttrWithGetterException, NoIntrinsic }, { "attrWithSetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithSetterException), (intptr_t)setJSTestObjAttrWithSetterException, NoIntrinsic }, { "stringAttrWithGetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttrWithGetterException), (intptr_t)setJSTestObjStringAttrWithGetterException, NoIntrinsic }, { "stringAttrWithSetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttrWithSetterException), (intptr_t)setJSTestObjStringAttrWithSetterException, NoIntrinsic }, { "customAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCustomAttr), (intptr_t)setJSTestObjCustomAttr, NoIntrinsic }, + { "withScriptStateAttribute", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjWithScriptStateAttribute), (intptr_t)setJSTestObjWithScriptStateAttribute, NoIntrinsic }, + { "withScriptExecutionContextAttribute", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjWithScriptExecutionContextAttribute), (intptr_t)setJSTestObjWithScriptExecutionContextAttribute, NoIntrinsic }, + { "withScriptStateAttributeRaises", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjWithScriptStateAttributeRaises), (intptr_t)setJSTestObjWithScriptStateAttributeRaises, NoIntrinsic }, + { "withScriptExecutionContextAttributeRaises", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjWithScriptExecutionContextAttributeRaises), (intptr_t)setJSTestObjWithScriptExecutionContextAttributeRaises, NoIntrinsic }, { "scriptStringAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjScriptStringAttr), (intptr_t)0, NoIntrinsic }, #if ENABLE(Condition1) { "conditionalAttr1", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConditionalAttr1), (intptr_t)setJSTestObjConditionalAttr1, NoIntrinsic }, @@ -139,7 +141,7 @@ static const HashTableValue JSTestObjTableValues[] = { 0, 0, 0, 0, NoIntrinsic } }; -static const HashTable JSTestObjTable = { 136, 127, JSTestObjTableValues, 0 }; +static const HashTable JSTestObjTable = { 137, 127, JSTestObjTableValues, 0 }; /* Hash table for constructor */ static const HashTableValue JSTestObjConstructorTableValues[] = @@ -522,16 +524,6 @@ JSValue jsTestObjReflectedURLAttr(ExecState* exec, JSValue slotBase, const Ident } -JSValue jsTestObjReflectedNonEmptyURLAttr(ExecState* exec, JSValue slotBase, const Identifier&) -{ - JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); - UNUSED_PARAM(exec); - TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsString(exec, impl->getNonEmptyURLAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr)); - return result; -} - - JSValue jsTestObjReflectedStringAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); @@ -572,16 +564,6 @@ JSValue jsTestObjReflectedCustomURLAttr(ExecState* exec, JSValue slotBase, const } -JSValue jsTestObjReflectedCustomNonEmptyURLAttr(ExecState* exec, JSValue slotBase, const Identifier&) -{ - JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); - UNUSED_PARAM(exec); - TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsString(exec, impl->getNonEmptyURLAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr)); - return result; -} - - JSValue jsTestObjAttrWithGetterException(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); @@ -631,6 +613,52 @@ JSValue jsTestObjCustomAttr(ExecState* exec, JSValue slotBase, const Identifier& } +JSValue jsTestObjWithScriptStateAttribute(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(impl->withScriptStateAttribute(exec)); + return result; +} + + +JSValue jsTestObjWithScriptExecutionContextAttribute(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); + if (!scriptContext) + return jsUndefined(); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->withScriptExecutionContextAttribute(scriptContext))); + return result; +} + + +JSValue jsTestObjWithScriptStateAttributeRaises(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + ExceptionCode ec = 0; + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->withScriptStateAttributeRaises(exec, ec))); + setDOMException(exec, ec); + return result; +} + + +JSValue jsTestObjWithScriptExecutionContextAttributeRaises(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + ExceptionCode ec = 0; + ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); + if (!scriptContext) + return jsUndefined(); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->withScriptExecutionContextAttributeRaises(scriptContext, ec))); + setDOMException(exec, ec); + return result; +} + + JSValue jsTestObjScriptStringAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); @@ -708,11 +736,11 @@ JSValue jsTestObjCachedAttribute1(ExecState* exec, JSValue slotBase, const Ident { JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); - if (JSValue cachedValue = m_cachedAttribute1.get()) + if (JSValue cachedValue = castedThis->m_cachedAttribute1.get()) return cachedValue; TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - JSValue result = impl->cachedAttribute1() ? impl->cachedAttribute1()->deserialize(exec, castedThis->globalObject()) : jsNull(); - m_cachedAttribute1.set(exec->globalData(), this, result); + JSValue result = impl->cachedAttribute1() ? impl->cachedAttribute1()->deserialize(exec, castedThis->globalObject(), 0) : jsNull(); + castedThis->m_cachedAttribute1.set(exec->globalData(), castedThis, result); return result; } @@ -721,11 +749,11 @@ JSValue jsTestObjCachedAttribute2(ExecState* exec, JSValue slotBase, const Ident { JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); - if (JSValue cachedValue = m_cachedAttribute2.get()) + if (JSValue cachedValue = castedThis->m_cachedAttribute2.get()) return cachedValue; TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - JSValue result = impl->cachedAttribute2() ? impl->cachedAttribute2()->deserialize(exec, castedThis->globalObject()) : jsNull(); - m_cachedAttribute2.set(exec->globalData(), this, result); + JSValue result = impl->cachedAttribute2() ? impl->cachedAttribute2()->deserialize(exec, castedThis->globalObject(), 0) : jsNull(); + castedThis->m_cachedAttribute2.set(exec->globalData(), castedThis, result); return result; } @@ -855,7 +883,7 @@ void setJSTestObjStringAttr(ExecState* exec, JSObject* thisObject, JSValue value { JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - impl->setStringAttr(ustringToString(value.isEmpty() ? UString() : value.toString(exec))); + impl->setStringAttr(ustringToString(value.isEmpty() ? UString() : value.toString(exec)->value(exec))); } @@ -923,14 +951,6 @@ void setJSTestObjReflectedURLAttr(ExecState* exec, JSObject* thisObject, JSValue } -void setJSTestObjReflectedNonEmptyURLAttr(ExecState* exec, JSObject* thisObject, JSValue value) -{ - JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); - TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - impl->setAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr, valueToStringWithNullCheck(exec, value)); -} - - void setJSTestObjReflectedStringAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); @@ -963,14 +983,6 @@ void setJSTestObjReflectedCustomURLAttr(ExecState* exec, JSObject* thisObject, J } -void setJSTestObjReflectedCustomNonEmptyURLAttr(ExecState* exec, JSObject* thisObject, JSValue value) -{ - JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); - TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - impl->setAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr, valueToStringWithNullCheck(exec, value)); -} - - void setJSTestObjAttrWithGetterException(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); @@ -996,7 +1008,7 @@ void setJSTestObjStringAttrWithGetterException(ExecState* exec, JSObject* thisOb JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; - impl->setStringAttrWithGetterException(ustringToString(value.isEmpty() ? UString() : value.toString(exec)), ec); + impl->setStringAttrWithGetterException(ustringToString(value.isEmpty() ? UString() : value.toString(exec)->value(exec)), ec); setDOMException(exec, ec); } @@ -1006,7 +1018,7 @@ void setJSTestObjStringAttrWithSetterException(ExecState* exec, JSObject* thisOb JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; - impl->setStringAttrWithSetterException(ustringToString(value.isEmpty() ? UString() : value.toString(exec)), ec); + impl->setStringAttrWithSetterException(ustringToString(value.isEmpty() ? UString() : value.toString(exec)->value(exec)), ec); setDOMException(exec, ec); } @@ -1017,6 +1029,48 @@ void setJSTestObjCustomAttr(ExecState* exec, JSObject* thisObject, JSValue value } +void setJSTestObjWithScriptStateAttribute(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + impl->setWithScriptStateAttribute(exec, value.toInt32(exec)); +} + + +void setJSTestObjWithScriptExecutionContextAttribute(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); + if (!scriptContext) + return; + impl->setWithScriptExecutionContextAttribute(scriptContext, toTestObj(value)); +} + + +void setJSTestObjWithScriptStateAttributeRaises(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + ExceptionCode ec = 0; + impl->setWithScriptStateAttributeRaises(exec, toTestObj(value), ec); + setDOMException(exec, ec); +} + + +void setJSTestObjWithScriptExecutionContextAttributeRaises(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* impl = static_cast<TestObj*>(castedThis->impl()); + ExceptionCode ec = 0; + ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); + if (!scriptContext) + return; + impl->setWithScriptExecutionContextAttributeRaises(scriptContext, toTestObj(value), ec); + setDOMException(exec, ec); +} + + #if ENABLE(Condition1) void setJSTestObjConditionalAttr1(ExecState* exec, JSObject* thisObject, JSValue value) { @@ -1136,7 +1190,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecSt int intArg(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); - const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toString(exec))); + const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); TestObj* objArg(toTestObj(MAYBE_MISSING_PARAMETER(exec, 2, MissingIsUndefined))); @@ -1172,7 +1226,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecSta int intArg(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); - const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toString(exec))); + const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); TestObj* objArg(toTestObj(MAYBE_MISSING_PARAMETER(exec, 2, MissingIsUndefined))); @@ -1209,7 +1263,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecSta int intArg(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); - const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toString(exec))); + const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); TestObj* objArg(toTestObj(MAYBE_MISSING_PARAMETER(exec, 2, MissingIsUndefined))); @@ -1231,7 +1285,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs if (exec->argumentCount() < 2) return throwVMError(exec, createTypeError(exec, "Not enough arguments")); ExceptionCode ec = 0; - const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec))); + const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); TestObj* objArg(toTestObj(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined))); @@ -1372,7 +1426,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecStat JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); - impl->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); + impl->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); } @@ -1389,7 +1443,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(ExecS JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); - impl->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); + impl->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)->value(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); } @@ -1670,7 +1724,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1( TestObj* objArg(toTestObj(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined))); if (exec->hadException()) return JSValue::encode(jsUndefined()); - const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toString(exec))); + const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); impl->overloadedMethod(objArg, strArg); @@ -1714,7 +1768,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3( TestObj* impl = static_cast<TestObj*>(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createTypeError(exec, "Not enough arguments")); - const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec))); + const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); impl->overloadedMethod(strArg); @@ -1856,7 +1910,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod { if (exec->argumentCount() < 1) return throwVMError(exec, createTypeError(exec, "Not enough arguments")); - const String& type(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec))); + const String& type(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); TestObj::overloadedMethod1(type); @@ -2027,7 +2081,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionStrictFunction(ExecState* if (exec->argumentCount() < 3) return throwVMError(exec, createTypeError(exec, "Not enough arguments")); ExceptionCode ec = 0; - const String& str(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec))); + const String& str(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); float a(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toFloat(exec)); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h index ae4041de6..89cc93226 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h @@ -227,8 +227,6 @@ JSC::JSValue jsTestObjReflectedBooleanAttr(JSC::ExecState*, JSC::JSValue, const void setJSTestObjReflectedBooleanAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjReflectedURLAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjReflectedURLAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); -JSC::JSValue jsTestObjReflectedNonEmptyURLAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); -void setJSTestObjReflectedNonEmptyURLAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjReflectedStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjReflectedStringAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjReflectedCustomIntegralAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); @@ -237,8 +235,6 @@ JSC::JSValue jsTestObjReflectedCustomBooleanAttr(JSC::ExecState*, JSC::JSValue, void setJSTestObjReflectedCustomBooleanAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjReflectedCustomURLAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjReflectedCustomURLAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); -JSC::JSValue jsTestObjReflectedCustomNonEmptyURLAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); -void setJSTestObjReflectedCustomNonEmptyURLAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjAttrWithGetterException(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjAttrWithGetterException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjAttrWithSetterException(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); @@ -249,6 +245,14 @@ JSC::JSValue jsTestObjStringAttrWithSetterException(JSC::ExecState*, JSC::JSValu void setJSTestObjStringAttrWithSetterException(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjCustomAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjCustomAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjWithScriptStateAttribute(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjWithScriptStateAttribute(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjWithScriptExecutionContextAttribute(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjWithScriptExecutionContextAttribute(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjWithScriptStateAttributeRaises(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjWithScriptStateAttributeRaises(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjWithScriptExecutionContextAttributeRaises(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjWithScriptExecutionContextAttributeRaises(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjScriptStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); JSC::JSValue jsTestObjConditionalAttr1(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjConditionalAttr1(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestOverridingNameGetter.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestOverridingNameGetter.cpp index 1d87ea91c..ee8db1b84 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestOverridingNameGetter.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestOverridingNameGetter.cpp @@ -176,7 +176,7 @@ EncodedJSValue JSC_HOST_CALL jsTestOverridingNameGetterPrototypeFunctionAnotherF TestOverridingNameGetter* impl = static_cast<TestOverridingNameGetter*>(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createTypeError(exec, "Not enough arguments")); - const String& str(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec))); + const String& str(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); impl->anotherFunction(str); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp index adf7d3f6c..fb2f21d71 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp @@ -87,7 +87,7 @@ EncodedJSValue JSC_HOST_CALL JSTestSerializedScriptValueInterfaceConstructor::co JSTestSerializedScriptValueInterfaceConstructor* jsConstructor = static_cast<JSTestSerializedScriptValueInterfaceConstructor*>(exec->callee()); if (exec->argumentCount() < 2) return throwVMError(exec, createTypeError(exec, "Not enough arguments")); - const String& hello(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec))); + const String& hello(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); RefPtr<SerializedScriptValue> value(SerializedScriptValue::create(exec, MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined))); @@ -162,7 +162,7 @@ JSValue jsTestSerializedScriptValueInterfaceValue(ExecState* exec, JSValue slotB JSTestSerializedScriptValueInterface* castedThis = static_cast<JSTestSerializedScriptValueInterface*>(asObject(slotBase)); UNUSED_PARAM(exec); TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl()); - JSValue result = impl->value() ? impl->value()->deserialize(exec, castedThis->globalObject()) : jsNull(); + JSValue result = impl->value() ? impl->value()->deserialize(exec, castedThis->globalObject(), 0) : jsNull(); return result; } diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h index 4457de6fb..da6f2094c 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.h @@ -31,6 +31,16 @@ @class DOMTestObj; @class NSString; +enum { +#if ENABLE(Condition11) || ENABLE(Condition12) + DOM_SUPPLEMENTALCONSTANT1 = 1, +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) + DOM_SUPPLEMENTALCONSTANT2 = 2 +#endif + +}; + @interface DOMTestInterface : DOMObject #if ENABLE(Condition11) || ENABLE(Condition12) - (NSString *)supplementalStr1; @@ -45,6 +55,7 @@ #endif - (void)supplementalMethod1; - (DOMTestObj *)supplementalMethod2:(NSString *)strArg objArg:(DOMTestObj *)objArg; +- (void)supplementalMethod3; @end #endif diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm index 0e02b9563..d8a17a073 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestInterface.mm @@ -131,6 +131,16 @@ #endif + +#if ENABLE(Condition11) || ENABLE(Condition12) +- (void)supplementalMethod3 +{ + WebCore::JSMainThreadNullState state; + TestSupplemental::supplementalMethod3(IMPL); +} + +#endif + @end WebCore::TestInterface* core(DOMTestInterface *wrapper) diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h index 282995ae8..547455674 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h @@ -97,8 +97,6 @@ enum { - (void)setReflectedBooleanAttr:(BOOL)newReflectedBooleanAttr; - (NSString *)reflectedURLAttr; - (void)setReflectedURLAttr:(NSString *)newReflectedURLAttr; -- (NSString *)reflectedNonEmptyURLAttr; -- (void)setReflectedNonEmptyURLAttr:(NSString *)newReflectedNonEmptyURLAttr; - (NSString *)reflectedStringAttr; - (void)setReflectedStringAttr:(NSString *)newReflectedStringAttr; - (int)reflectedCustomIntegralAttr; @@ -107,8 +105,6 @@ enum { - (void)setReflectedCustomBooleanAttr:(BOOL)newReflectedCustomBooleanAttr; - (NSString *)reflectedCustomURLAttr; - (void)setReflectedCustomURLAttr:(NSString *)newReflectedCustomURLAttr; -- (NSString *)reflectedCustomNonEmptyURLAttr; -- (void)setReflectedCustomNonEmptyURLAttr:(NSString *)newReflectedCustomNonEmptyURLAttr; - (int)attrWithGetterException; - (void)setAttrWithGetterException:(int)newAttrWithGetterException; - (int)attrWithSetterException; @@ -119,6 +115,14 @@ enum { - (void)setStringAttrWithSetterException:(NSString *)newStringAttrWithSetterException; - (int)customAttr; - (void)setCustomAttr:(int)newCustomAttr; +- (int)withScriptStateAttribute; +- (void)setWithScriptStateAttribute:(int)newWithScriptStateAttribute; +- (DOMTestObj *)withScriptExecutionContextAttribute; +- (void)setWithScriptExecutionContextAttribute:(DOMTestObj *)newWithScriptExecutionContextAttribute; +- (DOMTestObj *)withScriptStateAttributeRaises; +- (void)setWithScriptStateAttributeRaises:(DOMTestObj *)newWithScriptStateAttributeRaises; +- (DOMTestObj *)withScriptExecutionContextAttributeRaises; +- (void)setWithScriptExecutionContextAttributeRaises:(DOMTestObj *)newWithScriptExecutionContextAttributeRaises; - (NSString *)scriptStringAttr; #if ENABLE(Condition1) - (int)conditionalAttr1; diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm index 08f1f1e7a..b4ff638c7 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm @@ -290,18 +290,6 @@ IMPL->setAttribute(WebCore::HTMLNames::reflectedurlattrAttr, newReflectedURLAttr); } -- (NSString *)reflectedNonEmptyURLAttr -{ - WebCore::JSMainThreadNullState state; - return IMPL->getNonEmptyURLAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr); -} - -- (void)setReflectedNonEmptyURLAttr:(NSString *)newReflectedNonEmptyURLAttr -{ - WebCore::JSMainThreadNullState state; - IMPL->setAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr, newReflectedNonEmptyURLAttr); -} - - (NSString *)reflectedStringAttr { WebCore::JSMainThreadNullState state; @@ -350,18 +338,6 @@ IMPL->setAttribute(WebCore::HTMLNames::customContentURLAttrAttr, newReflectedCustomURLAttr); } -- (NSString *)reflectedCustomNonEmptyURLAttr -{ - WebCore::JSMainThreadNullState state; - return IMPL->getNonEmptyURLAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr); -} - -- (void)setReflectedCustomNonEmptyURLAttr:(NSString *)newReflectedCustomNonEmptyURLAttr -{ - WebCore::JSMainThreadNullState state; - IMPL->setAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr, newReflectedCustomNonEmptyURLAttr); -} - - (int)attrWithGetterException { WebCore::JSMainThreadNullState state; @@ -436,6 +412,70 @@ IMPL->setCustomAttr(newCustomAttr); } +- (int)withScriptStateAttribute +{ + WebCore::JSMainThreadNullState state; + return IMPL->withScriptStateAttribute(); +} + +- (void)setWithScriptStateAttribute:(int)newWithScriptStateAttribute +{ + WebCore::JSMainThreadNullState state; + IMPL->setWithScriptStateAttribute(newWithScriptStateAttribute); +} + +- (DOMTestObj *)withScriptExecutionContextAttribute +{ + WebCore::JSMainThreadNullState state; + return kit(WTF::getPtr(IMPL->withScriptExecutionContextAttribute())); +} + +- (void)setWithScriptExecutionContextAttribute:(DOMTestObj *)newWithScriptExecutionContextAttribute +{ + WebCore::JSMainThreadNullState state; + ASSERT(newWithScriptExecutionContextAttribute); + + IMPL->setWithScriptExecutionContextAttribute(core(newWithScriptExecutionContextAttribute)); +} + +- (DOMTestObj *)withScriptStateAttributeRaises +{ + WebCore::JSMainThreadNullState state; + WebCore::ExceptionCode ec = 0; + DOMTestObj *result = kit(WTF::getPtr(IMPL->withScriptStateAttributeRaises(ec))); + WebCore::raiseOnDOMError(ec); + return result; +} + +- (void)setWithScriptStateAttributeRaises:(DOMTestObj *)newWithScriptStateAttributeRaises +{ + WebCore::JSMainThreadNullState state; + ASSERT(newWithScriptStateAttributeRaises); + + WebCore::ExceptionCode ec = 0; + IMPL->setWithScriptStateAttributeRaises(core(newWithScriptStateAttributeRaises), ec); + WebCore::raiseOnDOMError(ec); +} + +- (DOMTestObj *)withScriptExecutionContextAttributeRaises +{ + WebCore::JSMainThreadNullState state; + WebCore::ExceptionCode ec = 0; + DOMTestObj *result = kit(WTF::getPtr(IMPL->withScriptExecutionContextAttributeRaises(ec))); + WebCore::raiseOnDOMError(ec); + return result; +} + +- (void)setWithScriptExecutionContextAttributeRaises:(DOMTestObj *)newWithScriptExecutionContextAttributeRaises +{ + WebCore::JSMainThreadNullState state; + ASSERT(newWithScriptExecutionContextAttributeRaises); + + WebCore::ExceptionCode ec = 0; + IMPL->setWithScriptExecutionContextAttributeRaises(core(newWithScriptExecutionContextAttributeRaises), ec); + WebCore::raiseOnDOMError(ec); +} + - (NSString *)scriptStringAttr { WebCore::JSMainThreadNullState state; diff --git a/Source/WebCore/bindings/scripts/test/TestObj.idl b/Source/WebCore/bindings/scripts/test/TestObj.idl index ed338c6b2..0023b2b24 100644 --- a/Source/WebCore/bindings/scripts/test/TestObj.idl +++ b/Source/WebCore/bindings/scripts/test/TestObj.idl @@ -56,12 +56,10 @@ module test { attribute [Reflect] unsigned long reflectedUnsignedIntegralAttr; attribute [Reflect] boolean reflectedBooleanAttr; attribute [Reflect, URL] DOMString reflectedURLAttr; - attribute [Reflect, NonEmpty, URL] DOMString reflectedNonEmptyURLAttr; attribute [Reflect=customContentStringAttr] DOMString reflectedStringAttr; attribute [Reflect=customContentIntegralAttr] long reflectedCustomIntegralAttr; attribute [Reflect=customContentBooleanAttr] boolean reflectedCustomBooleanAttr; attribute [Reflect=customContentURLAttr, URL] DOMString reflectedCustomURLAttr; - attribute [Reflect=customContentNonEmptyURLAttr, NonEmpty, URL] DOMString reflectedCustomNonEmptyURLAttr; // Methods void voidMethod(); @@ -109,6 +107,13 @@ module test { raises(DOMException); [CallWith=ScriptExecutionContext] void withScriptExecutionContext(); + attribute [CallWith=ScriptState] long withScriptStateAttribute; + attribute [CallWith=ScriptExecutionContext] TestObj withScriptExecutionContextAttribute; + attribute [CallWith=ScriptState] TestObj withScriptStateAttributeRaises + getter raises(DOMException); + attribute [CallWith=ScriptExecutionContext] TestObj withScriptExecutionContextAttributeRaises + getter raises(DOMException); + // 'Optional' extended attribute void methodWithOptionalArg(in [Optional] long opt); void methodWithNonOptionalArgAndOptionalArg(in long nonOpt, in [Optional] long opt); @@ -179,14 +184,14 @@ module test { attribute double[] doubleArray; #endif - readonly attribute [CheckFrameSecurity] Document contentDocument; - [SVGCheckSecurityDocument] SVGDocument getSVGDocument() + readonly attribute [CheckAccessToNode] Document contentDocument; + [CheckAccessToNode] SVGDocument getSVGDocument() raises(DOMException); void convert1(in [ConvertNullStringTo=Null] a); void convert2(in [ConvertNullStringTo=Undefined] b); void convert3(in [ConvertNullStringTo=False] c); - void convert4(in [ConvertNullToNullString] d); + void convert4(in [TreatNullAs=EmptyString] d); void convert5(in [ConvertUndefinedOrNullToNullString] e); attribute SVGPoint mutablePoint; diff --git a/Source/WebCore/bindings/scripts/test/TestSupplemental.idl b/Source/WebCore/bindings/scripts/test/TestSupplemental.idl index 7ddca1748..2355d6d39 100644 --- a/Source/WebCore/bindings/scripts/test/TestSupplemental.idl +++ b/Source/WebCore/bindings/scripts/test/TestSupplemental.idl @@ -39,5 +39,9 @@ module test { void supplementalMethod1(); [CallWith=ScriptExecutionContext] TestObj supplementalMethod2(in DOMString strArg, in TestObj objArg) raises(DOMException); + [Custom] void supplementalMethod3(); + + const unsigned short SUPPLEMENTALCONSTANT1 = 1; + const [Reflect=CONST_IMPL] unsigned short SUPPLEMENTALCONSTANT2 = 2; }; } diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp index ec1f4e046..76ac34597 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp @@ -33,7 +33,6 @@ #include "V8IsolatedContext.h" #include "V8Proxy.h" #include "V8TestObj.h" -#include "V8TestSupplemental.h" #include <wtf/GetPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> @@ -134,7 +133,7 @@ static const BatchedAttribute TestInterfaceAttrs[] = { #endif // ENABLE(Condition11) || ENABLE(Condition12) #if ENABLE(Condition11) || ENABLE(Condition12) // Attribute 'supplementalStr3' (Type: 'attribute' ExtAttr: 'CustomSetter CustomGetter Conditional ImplementedBy') - {"supplementalStr3", V8TestSupplemental::supplementalStr3AccessorGetter, V8TestSupplemental::supplementalStr3AccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + {"supplementalStr3", V8TestInterface::supplementalStr3AccessorGetter, V8TestInterface::supplementalStr3AccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, #endif // ENABLE(Condition11) || ENABLE(Condition12) }; @@ -142,8 +141,28 @@ static const BatchedCallback TestInterfaceCallbacks[] = { #if ENABLE(Condition11) || ENABLE(Condition12) {"supplementalMethod1", TestInterfaceInternal::supplementalMethod1Callback}, #endif +#if ENABLE(Condition11) || ENABLE(Condition12) + {"supplementalMethod3", V8TestInterface::supplementalMethod3Callback}, +#endif +}; + +static const BatchedConstant TestInterfaceConsts[] = { +#if ENABLE(Condition11) || ENABLE(Condition12) + {"SUPPLEMENTALCONSTANT1", static_cast<signed int>(1)}, +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) + {"SUPPLEMENTALCONSTANT2", static_cast<signed int>(2)}, +#endif }; + +#if ENABLE(Condition11) || ENABLE(Condition12) +COMPILE_ASSERT(1 == TestInterface::SUPPLEMENTALCONSTANT1, TestInterfaceEnumSUPPLEMENTALCONSTANT1IsWrongUseDontCheckEnums); +#endif +#if ENABLE(Condition11) || ENABLE(Condition12) +COMPILE_ASSERT(2 == TestInterface::CONST_IMPL, TestInterfaceEnumCONST_IMPLIsWrongUseDontCheckEnums); +#endif + v8::Handle<v8::Value> V8TestInterface::constructorCallback(const v8::Arguments& args) { INC_STATS("DOM.TestInterface.Constructor"); @@ -200,6 +219,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8: #if ENABLE(Condition11) || ENABLE(Condition12) proto->Set(v8::String::New("supplementalMethod2"), v8::FunctionTemplate::New(TestInterfaceInternal::supplementalMethod2Callback, v8::Handle<v8::Value>(), supplementalMethod2Signature)); #endif // ENABLE(Condition11) || ENABLE(Condition12) + batchConfigureConstants(desc, proto, TestInterfaceConsts, WTF_ARRAY_LENGTH(TestInterfaceConsts)); // Custom toString template desc->Set(getToStringName(), getToStringTemplate()); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index 17c0a03ad..c19297295 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -330,22 +330,6 @@ static void reflectedURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8: return; } -static v8::Handle<v8::Value> reflectedNonEmptyURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) -{ - INC_STATS("DOM.TestObj.reflectedNonEmptyURLAttr._get"); - TestObj* imp = V8TestObj::toNative(info.Holder()); - return v8String(imp->getNonEmptyURLAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr)); -} - -static void reflectedNonEmptyURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) -{ - INC_STATS("DOM.TestObj.reflectedNonEmptyURLAttr._set"); - TestObj* imp = V8TestObj::toNative(info.Holder()); - STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value); - imp->setAttribute(WebCore::HTMLNames::reflectednonemptyurlattrAttr, v); - return; -} - static v8::Handle<v8::Value> reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.reflectedStringAttr._get"); @@ -410,22 +394,6 @@ static void reflectedCustomURLAttrAttrSetter(v8::Local<v8::String> name, v8::Loc return; } -static v8::Handle<v8::Value> reflectedCustomNonEmptyURLAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) -{ - INC_STATS("DOM.TestObj.reflectedCustomNonEmptyURLAttr._get"); - TestObj* imp = V8TestObj::toNative(info.Holder()); - return v8String(imp->getNonEmptyURLAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr)); -} - -static void reflectedCustomNonEmptyURLAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) -{ - INC_STATS("DOM.TestObj.reflectedCustomNonEmptyURLAttr._set"); - TestObj* imp = V8TestObj::toNative(info.Holder()); - STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<WithNullCheck>, v, value); - imp->setAttribute(WebCore::HTMLNames::customContentNonEmptyURLAttrAttr, v); - return; -} - static v8::Handle<v8::Value> attrWithGetterExceptionAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.attrWithGetterException._get"); @@ -514,6 +482,118 @@ static void stringAttrWithSetterExceptionAttrSetter(v8::Local<v8::String> name, return; } +static v8::Handle<v8::Value> withScriptStateAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.withScriptStateAttribute._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + ScriptState* state = ScriptState::current(); + if (!state) + return v8::Undefined(); + return v8::Integer::New(imp->withScriptStateAttribute(state)); +} + +static void withScriptStateAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.withScriptStateAttribute._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + int v = toInt32(value); + ScriptState* state = ScriptState::current(); + if (!state) + return; + imp->setWithScriptStateAttribute(state, v); + if (state.hadException()) + throwError(state.exception()); + return; +} + +static v8::Handle<v8::Value> withScriptExecutionContextAttributeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.withScriptExecutionContextAttribute._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + ScriptExecutionContext* scriptContext = getScriptExecutionContext(); + if (!scriptContext) + return v8::Undefined(); + return toV8(imp->withScriptExecutionContextAttribute(scriptContext)); +} + +static void withScriptExecutionContextAttributeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.withScriptExecutionContextAttribute._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0; + ScriptExecutionContext* scriptContext = getScriptExecutionContext(); + if (!scriptContext) + return; + imp->setWithScriptExecutionContextAttribute(scriptContext, WTF::getPtr(v)); + return; +} + +static v8::Handle<v8::Value> withScriptStateAttributeRaisesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.withScriptStateAttributeRaises._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + ExceptionCode ec = 0; + ScriptState* state = ScriptState::current(); + if (!state) + return v8::Undefined(); + RefPtr<TestObj> v = imp->withScriptStateAttributeRaises(state, ec); + if (UNLIKELY(ec)) { + V8Proxy::setDOMException(ec); + return v8::Handle<v8::Value>(); + } + if (state.hadException()) + return throwError(state.exception()); + return toV8(v.release()); +} + +static void withScriptStateAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.withScriptStateAttributeRaises._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0; + ExceptionCode ec = 0; + ScriptState* state = ScriptState::current(); + if (!state) + return; + imp->setWithScriptStateAttributeRaises(state, WTF::getPtr(v), ec); + if (UNLIKELY(ec)) + V8Proxy::setDOMException(ec); + if (state.hadException()) + throwError(state.exception()); + return; +} + +static v8::Handle<v8::Value> withScriptExecutionContextAttributeRaisesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.withScriptExecutionContextAttributeRaises._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + ExceptionCode ec = 0; + ScriptExecutionContext* scriptContext = getScriptExecutionContext(); + if (!scriptContext) + return v8::Undefined(); + RefPtr<TestObj> v = imp->withScriptExecutionContextAttributeRaises(scriptContext, ec); + if (UNLIKELY(ec)) { + V8Proxy::setDOMException(ec); + return v8::Handle<v8::Value>(); + } + return toV8(v.release()); +} + +static void withScriptExecutionContextAttributeRaisesAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.withScriptExecutionContextAttributeRaises._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0; + ExceptionCode ec = 0; + ScriptExecutionContext* scriptContext = getScriptExecutionContext(); + if (!scriptContext) + return; + imp->setWithScriptExecutionContextAttributeRaises(scriptContext, WTF::getPtr(v), ec); + if (UNLIKELY(ec)) + V8Proxy::setDOMException(ec); + return; +} + static v8::Handle<v8::Value> scriptStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.scriptStringAttr._get"); @@ -1500,8 +1580,6 @@ static const BatchedAttribute TestObjAttrs[] = { {"reflectedBooleanAttr", TestObjInternal::reflectedBooleanAttrAttrGetter, TestObjInternal::reflectedBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'reflectedURLAttr' (Type: 'attribute' ExtAttr: 'URL Reflect') {"reflectedURLAttr", TestObjInternal::reflectedURLAttrAttrGetter, TestObjInternal::reflectedURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, - // Attribute 'reflectedNonEmptyURLAttr' (Type: 'attribute' ExtAttr: 'URL NonEmpty Reflect') - {"reflectedNonEmptyURLAttr", TestObjInternal::reflectedNonEmptyURLAttrAttrGetter, TestObjInternal::reflectedNonEmptyURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect') {"reflectedStringAttr", TestObjInternal::reflectedStringAttrAttrGetter, TestObjInternal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'reflectedCustomIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect') @@ -1510,8 +1588,6 @@ static const BatchedAttribute TestObjAttrs[] = { {"reflectedCustomBooleanAttr", TestObjInternal::reflectedCustomBooleanAttrAttrGetter, TestObjInternal::reflectedCustomBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'reflectedCustomURLAttr' (Type: 'attribute' ExtAttr: 'URL Reflect') {"reflectedCustomURLAttr", TestObjInternal::reflectedCustomURLAttrAttrGetter, TestObjInternal::reflectedCustomURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, - // Attribute 'reflectedCustomNonEmptyURLAttr' (Type: 'attribute' ExtAttr: 'URL NonEmpty Reflect') - {"reflectedCustomNonEmptyURLAttr", TestObjInternal::reflectedCustomNonEmptyURLAttrAttrGetter, TestObjInternal::reflectedCustomNonEmptyURLAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'attrWithGetterException' (Type: 'attribute' ExtAttr: '') {"attrWithGetterException", TestObjInternal::attrWithGetterExceptionAttrGetter, TestObjInternal::attrWithGetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'attrWithSetterException' (Type: 'attribute' ExtAttr: '') @@ -1522,6 +1598,14 @@ static const BatchedAttribute TestObjAttrs[] = { {"stringAttrWithSetterException", TestObjInternal::stringAttrWithSetterExceptionAttrGetter, TestObjInternal::stringAttrWithSetterExceptionAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'customAttr' (Type: 'attribute' ExtAttr: 'Custom') {"customAttr", V8TestObj::customAttrAccessorGetter, V8TestObj::customAttrAccessorSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'withScriptStateAttribute' (Type: 'attribute' ExtAttr: 'CallWith') + {"withScriptStateAttribute", TestObjInternal::withScriptStateAttributeAttrGetter, TestObjInternal::withScriptStateAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'withScriptExecutionContextAttribute' (Type: 'attribute' ExtAttr: 'CallWith') + {"withScriptExecutionContextAttribute", TestObjInternal::withScriptExecutionContextAttributeAttrGetter, TestObjInternal::withScriptExecutionContextAttributeAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'withScriptStateAttributeRaises' (Type: 'attribute' ExtAttr: 'CallWith') + {"withScriptStateAttributeRaises", TestObjInternal::withScriptStateAttributeRaisesAttrGetter, TestObjInternal::withScriptStateAttributeRaisesAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'withScriptExecutionContextAttributeRaises' (Type: 'attribute' ExtAttr: 'CallWith') + {"withScriptExecutionContextAttributeRaises", TestObjInternal::withScriptExecutionContextAttributeRaisesAttrGetter, TestObjInternal::withScriptExecutionContextAttributeRaisesAttrSetter, 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 */}, #if ENABLE(Condition1) @@ -1556,7 +1640,7 @@ static const BatchedAttribute TestObjAttrs[] = { {"floatArray", TestObjInternal::floatArrayAttrGetter, TestObjInternal::floatArrayAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'doubleArray' (Type: 'attribute' ExtAttr: '') {"doubleArray", TestObjInternal::doubleArrayAttrGetter, TestObjInternal::doubleArrayAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, - // Attribute 'contentDocument' (Type: 'readonly attribute' ExtAttr: 'CheckFrameSecurity') + // Attribute 'contentDocument' (Type: 'readonly attribute' ExtAttr: 'CheckAccessToNode') {"contentDocument", TestObjInternal::contentDocumentAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'mutablePoint' (Type: 'attribute' ExtAttr: '') {"mutablePoint", TestObjInternal::mutablePointAttrGetter, TestObjInternal::mutablePointAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |