summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/scripts/CodeGeneratorV8.pm
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bindings/scripts/CodeGeneratorV8.pm')
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorV8.pm341
1 files changed, 192 insertions, 149 deletions
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index b65da53..2e0f9ee 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -215,7 +215,6 @@ sub AddClassForwardIfNeeded
sub GetImplementationFileName
{
my $iface = shift;
- return "HTMLCollection.h" if $iface eq "HTMLAllCollection";
return "Event.h" if $iface eq "DOMTimeStamp";
return "NamedAttrMap.h" if $iface eq "NamedNodeMap";
return "NameNodeList.h" if $iface eq "NodeList";
@@ -307,7 +306,7 @@ sub GenerateSetDOMException
my $indent = shift;
my $result = "";
- $result .= $indent . "if (ec) {\n";
+ $result .= $indent . "if (UNLIKELY(ec)) {\n";
$result .= $indent . " V8Proxy::setDOMException(ec);\n";
$result .= $indent . " return v8::Handle<v8::Value>();\n";
$result .= $indent . "}\n";
@@ -460,6 +459,7 @@ sub GenerateNormalAttrGetter
my $dataNode = shift;
my $classIndex = shift;
my $implClassName = shift;
+ my $interfaceName = shift;
my $attrExt = $attribute->signature->extendedAttributes;
@@ -562,10 +562,11 @@ END
my $reflect = $attribute->signature->extendedAttributes->{"Reflect"};
my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"};
if ($reflect || $reflectURL) {
- $implIncludes{"HTMLNames.h"} = 1;
my $contentAttributeName = ($reflect || $reflectURL) eq "1" ? $attrName : ($reflect || $reflectURL);
+ my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName);
+ $implIncludes{"${namespace}.h"} = 1;
my $getAttributeFunctionName = $reflectURL ? "getURLAttribute" : "getAttribute";
- $getterString = "imp->$getAttributeFunctionName(HTMLNames::${contentAttributeName}Attr";
+ $getterString = "imp->$getAttributeFunctionName(${namespace}::${contentAttributeName}Attr";
} else {
$getterString = "imp->$getterFunc(";
}
@@ -620,15 +621,17 @@ END
push(@implContentDecls, " if (!imp->document())\n");
push(@implContentDecls, " return v8::Undefined();\n");
}
- push(@implContentDecls, " $nativeType v = ");
-
- push(@implContentDecls, "$getterString;\n");
if ($useExceptions) {
+ push(@implContentDecls, " $nativeType v = ");
+ push(@implContentDecls, "$getterString;\n");
push(@implContentDecls, GenerateSetDOMException(" "));
+ $result = "v";
+ $result .= ".release()" if (IsRefPtrType($returnType));
+ } else {
+ # Can inline the function call into the return statement to avoid overhead of using a Ref<> temporary
+ $result = $getterString;
}
-
- $result = "v";
}
if (IsSVGTypeNeedingContextParameter($attrType) && !$skipContext) {
@@ -644,7 +647,6 @@ END
my $classIndex = uc($attrType);
push(@implContentDecls, " return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, wrapper.release());\n");
} else {
- $result .= ".release()" if (IsRefPtrType($attrType));
push(@implContentDecls, " " . ReturnNativeToJSValue($attribute->signature, $result, " ").";\n");
}
@@ -677,6 +679,7 @@ sub GenerateNormalAttrSetter
my $dataNode = shift;
my $classIndex = shift;
my $implClassName = shift;
+ my $interfaceName = shift;
my $attrExt = $attribute->signature->extendedAttributes;
@@ -755,9 +758,10 @@ END
my $reflect = $attribute->signature->extendedAttributes->{"Reflect"};
my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"};
if ($reflect || $reflectURL) {
- $implIncludes{"HTMLNames.h"} = 1;
my $contentAttributeName = ($reflect || $reflectURL) eq "1" ? $attrName : ($reflect || $reflectURL);
- push(@implContentDecls, " imp->setAttribute(HTMLNames::${contentAttributeName}Attr, $result");
+ my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName);
+ $implIncludes{"${namespace}.h"} = 1;
+ push(@implContentDecls, " imp->setAttribute(${namespace}::${contentAttributeName}Attr, $result");
} elsif ($attribute->signature->type eq "EventListener") {
$implIncludes{"V8AbstractEventListener.h"} = 1;
$implIncludes{"V8CustomBinding.h"} = 1;
@@ -780,7 +784,8 @@ END
}
if ($useExceptions) {
- push(@implContentDecls, " V8Proxy::setDOMException(ec);\n");
+ push(@implContentDecls, " if (UNLIKELY(ec))\n");
+ push(@implContentDecls, " V8Proxy::setDOMException(ec);\n");
}
if ($isPodType) {
@@ -913,7 +918,7 @@ END
if (TypeCanFailConversion($parameter)) {
$implIncludes{"ExceptionCode.h"} = 1;
push(@implContentDecls,
-" if (!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ") {\n" .
+" if (UNLIKELY(!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ")) {\n" .
" V8Proxy::setDOMException(TYPE_MISMATCH_ERR);\n" .
" return v8::Handle<v8::Value>();\n" .
" }\n");
@@ -922,7 +927,7 @@ END
if ($parameter->extendedAttributes->{"IsIndex"}) {
$implIncludes{"ExceptionCode.h"} = 1;
push(@implContentDecls,
-" if ($parameterName < 0) {\n" .
+" if (UNLIKELY($parameterName < 0)) {\n" .
" V8Proxy::setDOMException(INDEX_SIZE_ERR);\n" .
" return v8::Handle<v8::Value>();\n" .
" }\n");
@@ -944,126 +949,134 @@ sub GenerateBatchedAttributeData
my $attributes = shift;
foreach my $attribute (@$attributes) {
- my $attrName = $attribute->signature->name;
- my $attrExt = $attribute->signature->extendedAttributes;
-
- my $accessControl = "v8::DEFAULT";
- if ($attrExt->{"DoNotCheckDomainSecurityOnGet"}) {
- $accessControl = "v8::ALL_CAN_READ";
- } elsif ($attrExt->{"DoNotCheckDomainSecurityOnSet"}) {
- $accessControl = "v8::ALL_CAN_WRITE";
- } elsif ($attrExt->{"DoNotCheckDomainSecurity"}) {
- $accessControl = "v8::ALL_CAN_READ";
- if (!($attribute->type =~ /^readonly/) && !($attrExt->{"V8ReadOnly"})) {
- $accessControl .= "|v8::ALL_CAN_WRITE";
- }
- }
- if ($attrExt->{"V8DisallowShadowing"}) {
- $accessControl .= "|v8::PROHIBITS_OVERWRITING";
- }
- $accessControl = "static_cast<v8::AccessControl>(" . $accessControl . ")";
-
- my $customAccessor =
- $attrExt->{"Custom"} ||
- $attrExt->{"CustomSetter"} ||
- $attrExt->{"CustomGetter"} ||
- $attrExt->{"V8Custom"} ||
- $attrExt->{"V8CustomSetter"} ||
- $attrExt->{"V8CustomGetter"} ||
- "";
- if ($customAccessor eq 1) {
- # use the naming convension, interface + (capitalize) attr name
- $customAccessor = $interfaceName . $codeGenerator->WK_ucfirst($attrName);
- }
+ my $conditionalString = GenerateConditionalString($attribute->signature);
+ push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString;
+ GenerateSingleBatchedAttribute($interfaceName, $attribute, ",", "");
+ push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString;
+ }
+}
- my $getter;
- my $setter;
- my $propAttr = "v8::None";
- my $hasCustomSetter = 0;
+sub GenerateSingleBatchedAttribute
+{
+ my $interfaceName = shift;
+ my $attribute = shift;
+ my $delimiter = shift;
+ my $indent = shift;
+ my $attrName = $attribute->signature->name;
+ my $attrExt = $attribute->signature->extendedAttributes;
- # Check attributes.
- if ($attrExt->{"DontEnum"}) {
- $propAttr .= "|v8::DontEnum";
- }
- if ($attrExt->{"V8DisallowShadowing"}) {
- $propAttr .= "|v8::DontDelete";
+ my $accessControl = "v8::DEFAULT";
+ if ($attrExt->{"DoNotCheckDomainSecurityOnGet"}) {
+ $accessControl = "v8::ALL_CAN_READ";
+ } elsif ($attrExt->{"DoNotCheckDomainSecurityOnSet"}) {
+ $accessControl = "v8::ALL_CAN_WRITE";
+ } elsif ($attrExt->{"DoNotCheckDomainSecurity"}) {
+ $accessControl = "v8::ALL_CAN_READ";
+ if (!($attribute->type =~ /^readonly/) && !($attrExt->{"V8ReadOnly"})) {
+ $accessControl .= "|v8::ALL_CAN_WRITE";
}
+ }
+ if ($attrExt->{"V8DisallowShadowing"}) {
+ $accessControl .= "|v8::PROHIBITS_OVERWRITING";
+ }
+ $accessControl = "static_cast<v8::AccessControl>(" . $accessControl . ")";
- my $on_proto = "0 /* on instance */";
- my $data = "V8ClassIndex::INVALID_CLASS_INDEX /* no data */";
+ my $customAccessor =
+ $attrExt->{"Custom"} ||
+ $attrExt->{"CustomSetter"} ||
+ $attrExt->{"CustomGetter"} ||
+ $attrExt->{"V8Custom"} ||
+ $attrExt->{"V8CustomSetter"} ||
+ $attrExt->{"V8CustomGetter"} ||
+ "";
+ if ($customAccessor eq 1) {
+ # use the naming convension, interface + (capitalize) attr name
+ $customAccessor = $interfaceName . $codeGenerator->WK_ucfirst($attrName);
+ }
- # Constructor
- if ($attribute->signature->type =~ /Constructor$/) {
- my $constructorType = $codeGenerator->StripModule($attribute->signature->type);
- $constructorType =~ s/Constructor$//;
- my $constructorIndex = uc($constructorType);
- if ($customAccessor) {
- $getter = "V8Custom::v8${customAccessor}AccessorGetter";
- } else {
- $data = "V8ClassIndex::${constructorIndex}";
- $getter = "${interfaceName}Internal::${interfaceName}ConstructorGetter";
- }
- $setter = "0";
- $propAttr = "v8::ReadOnly";
+ my $getter;
+ my $setter;
+ my $propAttr = "v8::None";
+ my $hasCustomSetter = 0;
- } else {
- # Default Getter and Setter
- $getter = "${interfaceName}Internal::${attrName}AttrGetter";
- $setter = "${interfaceName}Internal::${attrName}AttrSetter";
-
- # Custom Setter
- if ($attrExt->{"CustomSetter"} || $attrExt->{"V8CustomSetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) {
- $hasCustomSetter = 1;
- $setter = "V8Custom::v8${customAccessor}AccessorSetter";
- }
+ # Check attributes.
+ if ($attrExt->{"DontEnum"}) {
+ $propAttr .= "|v8::DontEnum";
+ }
+ if ($attrExt->{"V8DisallowShadowing"}) {
+ $propAttr .= "|v8::DontDelete";
+ }
- # Custom Getter
- if ($attrExt->{"CustomGetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) {
- $getter = "V8Custom::v8${customAccessor}AccessorGetter";
- }
+ my $on_proto = "0 /* on instance */";
+ my $data = "V8ClassIndex::INVALID_CLASS_INDEX /* no data */";
+
+ # Constructor
+ if ($attribute->signature->type =~ /Constructor$/) {
+ my $constructorType = $codeGenerator->StripModule($attribute->signature->type);
+ $constructorType =~ s/Constructor$//;
+ my $constructorIndex = uc($constructorType);
+ if ($customAccessor) {
+ $getter = "V8Custom::v8${customAccessor}AccessorGetter";
+ } else {
+ $data = "V8ClassIndex::${constructorIndex}";
+ $getter = "${interfaceName}Internal::${interfaceName}ConstructorGetter";
}
+ $setter = "0";
+ $propAttr = "v8::ReadOnly";
- # Replaceable
- if ($attrExt->{"Replaceable"} && !$hasCustomSetter) {
- $setter = "0";
- # Handle the special case of window.top being marked as Replaceable.
- # FIXME: Investigate whether we could treat window.top as replaceable
- # and allow shadowing without it being a security hole.
- if (!($interfaceName eq "DOMWindow" and $attrName eq "top")) {
- $propAttr .= "|v8::ReadOnly";
- }
+ } else {
+ # Default Getter and Setter
+ $getter = "${interfaceName}Internal::${attrName}AttrGetter";
+ $setter = "${interfaceName}Internal::${attrName}AttrSetter";
+
+ # Custom Setter
+ if ($attrExt->{"CustomSetter"} || $attrExt->{"V8CustomSetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) {
+ $hasCustomSetter = 1;
+ $setter = "V8Custom::v8${customAccessor}AccessorSetter";
}
- # Read only attributes
- if ($attribute->type =~ /^readonly/ || $attrExt->{"V8ReadOnly"}) {
- $setter = "0";
+ # Custom Getter
+ if ($attrExt->{"CustomGetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) {
+ $getter = "V8Custom::v8${customAccessor}AccessorGetter";
}
+ }
- # An accessor can be installed on the proto
- if ($attrExt->{"v8OnProto"}) {
- $on_proto = "1 /* on proto */";
+ # Replaceable
+ if ($attrExt->{"Replaceable"} && !$hasCustomSetter) {
+ $setter = "0";
+ # Handle the special case of window.top being marked as Replaceable.
+ # FIXME: Investigate whether we could treat window.top as replaceable
+ # and allow shadowing without it being a security hole.
+ if (!($interfaceName eq "DOMWindow" and $attrName eq "top")) {
+ $propAttr .= "|v8::ReadOnly";
}
+ }
- my $commentInfo = "Attribute '$attrName' (Type: '" . $attribute->type .
- "' ExtAttr: '" . join(' ', keys(%{$attrExt})) . "')";
-
- my $conditionalString = GenerateConditionalString($attribute->signature);
- push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString;
+ # Read only attributes
+ if ($attribute->type =~ /^readonly/ || $attrExt->{"V8ReadOnly"}) {
+ $setter = "0";
+ }
- push(@implContent, <<END);
- // $commentInfo
- { "$attrName",
- $getter,
- $setter,
- $data,
- $accessControl,
- static_cast<v8::PropertyAttribute>($propAttr),
- $on_proto },
-END
- push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString;
+ # An accessor can be installed on the proto
+ if ($attrExt->{"v8OnProto"}) {
+ $on_proto = "1 /* on proto */";
}
-}
+ my $commentInfo = "Attribute '$attrName' (Type: '" . $attribute->type .
+ "' ExtAttr: '" . join(' ', keys(%{$attrExt})) . "')";
+
+ push(@implContent, $indent . " {\n");
+ push(@implContent, $indent . " \/\/ $commentInfo\n");
+ push(@implContent, $indent . " \"$attrName\",\n");
+ push(@implContent, $indent . " $getter,\n");
+ push(@implContent, $indent . " $setter,\n");
+ push(@implContent, $indent . " $data,\n");
+ push(@implContent, $indent . " $accessControl,\n");
+ push(@implContent, $indent . " static_cast<v8::PropertyAttribute>($propAttr),\n");
+ push(@implContent, $indent . " $on_proto\n");
+ push(@implContent, $indent . " }" . $delimiter . "\n");
+END
+}
sub GenerateImplementation
{
@@ -1136,7 +1149,7 @@ sub GenerateImplementation
if ($attribute->signature->extendedAttributes->{"CustomGetter"}) {
$implIncludes{"V8CustomBinding.h"} = 1;
} else {
- GenerateNormalAttrGetter($attribute, $dataNode, $classIndex, $implClassName);
+ GenerateNormalAttrGetter($attribute, $dataNode, $classIndex, $implClassName, $interfaceName);
}
if ($attribute->signature->extendedAttributes->{"CustomSetter"} ||
$attribute->signature->extendedAttributes->{"V8CustomSetter"}) {
@@ -1145,7 +1158,7 @@ sub GenerateImplementation
$dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"} || die "Replaceable attribute can only be used in interface that defines ExtendsDOMGlobalObject attribute!";
# GenerateReplaceableAttrSetter($implClassName);
} elsif ($attribute->type !~ /^readonly/ && !$attribute->signature->extendedAttributes->{"V8ReadOnly"}) {
- GenerateNormalAttrSetter($attribute, $dataNode, $classIndex, $implClassName);
+ GenerateNormalAttrSetter($attribute, $dataNode, $classIndex, $implClassName, $interfaceName);
}
}
@@ -1176,20 +1189,24 @@ sub GenerateImplementation
# For the DOMWindow interface we partition the attributes into the
# ones that disallows shadowing and the rest.
- my @disallows_shadowing;
+ my @disallowsShadowing;
+ # Also separate out attributes that are enabled at runtime so we can process them specially.
+ my @enabledAtRuntime;
my @normal;
- if ($interfaceName eq "DOMWindow") {
- foreach my $attribute (@$attributes) {
- if ($attribute->signature->extendedAttributes->{"V8DisallowShadowing"}) {
- push(@disallows_shadowing, $attribute);
- } else {
- push(@normal, $attribute);
- }
+ foreach my $attribute (@$attributes) {
+ if ($interfaceName eq "DOMWindow" && $attribute->signature->extendedAttributes->{"V8DisallowShadowing"}) {
+ push(@disallowsShadowing, $attribute);
+ } elsif ($attribute->signature->extendedAttributes->{"EnabledAtRuntime"}) {
+ push(@enabledAtRuntime, $attribute);
+ } else {
+ push(@normal, $attribute);
}
- # Put the attributes that disallow shadowing on the shadow object.
- $attributes = \@normal;
+ }
+ $attributes = \@normal;
+ # Put the attributes that disallow shadowing on the shadow object.
+ if (@disallowsShadowing) {
push(@implContent, "static const BatchedAttribute shadow_attrs[] = {\n");
- GenerateBatchedAttributeData($dataNode, \@disallows_shadowing);
+ GenerateBatchedAttributeData($dataNode, \@disallowsShadowing);
push(@implContent, "};\n");
}
@@ -1271,6 +1288,21 @@ END
END
}
+ # Setup the enable-at-runtime attrs if we have them
+ foreach my $runtime_attr (@enabledAtRuntime) {
+ $enable_function = $interfaceName . $codeGenerator->WK_ucfirst($runtime_attr->signature->name);
+ my $conditionalString = GenerateConditionalString($runtime_attr->signature);
+ push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString;
+ push(@implContent, " if (V8Custom::v8${enable_function}Enabled()) {\n");
+ push(@implContent, " static const BatchedAttribute attrData =\\\n");
+ GenerateSingleBatchedAttribute($interfaceName, $runtime_attr, ";", " ");
+ push(@implContent, <<END);
+ configureAttribute(instance, proto, attrData);
+ }
+END
+ push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString;
+ }
+
# Define our functions with Set() or SetAccessor()
foreach my $function (@{$dataNode->functions}) {
my $attrExt = $function->signature->extendedAttributes;
@@ -1291,6 +1323,13 @@ END
$template = "instance";
}
+ my $conditional = "";
+ if ($attrExt->{"EnabledAtRuntime"}) {
+ # Only call Set()/SetAccessor() if this method should be enabled
+ $enable_function = $interfaceName . $codeGenerator->WK_ucfirst($function->signature->name);
+ $conditional = "if (V8Custom::v8${enable_function}Enabled())\n";
+ }
+
if ($attrExt->{"DoNotCheckDomainSecurity"} &&
($dataNode->extendedAttributes->{"CheckDomainSecurity"} || $interfaceName eq "DOMWindow")) {
# Mark the accessor as ReadOnly and set it on the proto object so
@@ -1311,7 +1350,7 @@ END
push(@implContent, <<END);
// $commentInfo
- $template->SetAccessor(
+ $conditional $template->SetAccessor(
v8::String::New("$name"),
${interfaceName}Internal::${name}AttrGetter,
0,
@@ -1339,7 +1378,7 @@ END
push(@implContent, <<END);
// $commentInfo
- ${template}->Set(
+ $conditional ${template}->Set(
v8::String::New("$name"),
$templateFunction,
static_cast<v8::PropertyAttribute>($property_attributes));
@@ -1357,7 +1396,7 @@ END
}
# Set the class name. This is used when printing objects.
- push(@implContent, " desc->SetClassName(v8::String::New(\"" . GetClassName(${interfaceName}) . "\"));\n");
+ push(@implContent, " desc->SetClassName(v8::String::New(\"${interfaceName}\"));\n");
if ($has_constants) {
push(@implContent, <<END);
@@ -1499,6 +1538,9 @@ sub GenerateFunctionCallString()
}
$functionString .= ")";
+ my $return = "result";
+ my $returnIsRef = IsRefPtrType($returnType);
+
if ($nodeToReturn) {
# Special case for insertBefore, replaceChild, removeChild and
# appendChild functions from Node.
@@ -1519,16 +1561,18 @@ sub GenerateFunctionCallString()
$indent . "$functionString;\n";
} elsif ($returnsListItemPodType) {
$result .= $indent . "RefPtr<SVGPODListItem<$nativeReturnType> > result = $functionString;\n";
- } else {
+ } elsif (@{$function->raisesExceptions} or $returnsPodType or $isPodType or IsSVGTypeNeedingContextParameter($returnType)) {
$result .= $indent . $nativeReturnType . " result = $functionString;\n";
+ } else {
+ # Can inline the function call into the return statement to avoid overhead of using a Ref<> temporary
+ $return = $functionString;
+ $returnIsRef = 0;
}
if (@{$function->raisesExceptions}) {
$result .= GenerateSetDOMException($indent);
}
- my $return = "result";
-
# If the return type is a POD type, separate out the wrapper generation
if ($returnsListItemPodType) {
$result .= $indent . "RefPtr<V8SVGPODTypeWrapper<" . $nativeReturnType . "> > wrapper = ";
@@ -1571,7 +1615,7 @@ sub GenerateFunctionCallString()
my $classIndex = uc($returnType);
$result .= $indent . "return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, wrapper.release());\n";
} else {
- $return .= ".release()" if (IsRefPtrType($returnType));
+ $return .= ".release()" if ($returnIsRef);
$result .= $indent . ReturnNativeToJSValue($function->signature, $return, $indent) . ";\n";
}
@@ -1579,15 +1623,6 @@ sub GenerateFunctionCallString()
}
-# Get the class name used for printing javascript DOM-object wrappers.
-sub GetClassName
-{
- my $type = shift;
- return "HTMLCollection" if $type eq "HTMLAllCollection";
- return $type;
-}
-
-
sub GetTypeFromSignature
{
my $signature = shift;
@@ -1620,6 +1655,7 @@ sub IsRefPtrType
{
my $type = shift;
return 1 if $type eq "Attr";
+ return 1 if $type eq "CanvasActiveInfo";
return 1 if $type eq "CanvasArray";
return 1 if $type eq "CanvasArrayBuffer";
return 1 if $type eq "CanvasBooleanArray";
@@ -1664,6 +1700,7 @@ sub IsRefPtrType
return 1 if $type eq "EventListener";
return 1 if $type eq "FileList";
return 1 if $type eq "HTMLCollection";
+ return 1 if $type eq "HTMLAllCollection";
return 1 if $type eq "HTMLDocument";
return 1 if $type eq "HTMLElement";
return 1 if $type eq "HTMLOptionsCollection";
@@ -2091,7 +2128,9 @@ sub ReturnNativeToJSValue
# For all the types where we use 'int' as the representation type,
# we use Integer::New which has a fast Smi conversion check.
- return "return v8::Integer::New($value)" if GetNativeType($type) eq "int";
+ my $nativeType = GetNativeType($type);
+ return "return v8::Integer::New($value)" if $nativeType eq "int";
+ return "return v8::Integer::NewFromUnsigned($value)" if $nativeType eq "unsigned";
return "return v8::Number::New($value)" if $codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType";
@@ -2114,7 +2153,11 @@ sub ReturnNativeToJSValue
# special case for non-DOM node interfaces
if (IsDOMNodeType($type)) {
- return "return V8DOMWrapper::convertNodeToV8Object($value)";
+ if ($signature->extendedAttributes->{"ReturnsNew"}) {
+ return "return V8DOMWrapper::convertNewNodeToV8Object($value)";
+ } else {
+ return "return V8DOMWrapper::convertNodeToV8Object($value)";
+ }
}
if ($type eq "EventTarget" or $type eq "SVGElementInstance") {
@@ -2126,7 +2169,7 @@ sub ReturnNativeToJSValue
}
if ($type eq "EventListener") {
- return "return V8DOMWrapper::convertEventListenerToV8Object($value)";
+ return "return V8DOMWrapper::convertEventListenerToV8Object(imp->scriptExecutionContext(), $value)";
}
if ($type eq "SerializedScriptValue") {