diff options
Diffstat (limited to 'WebCore/bindings/scripts')
22 files changed, 612 insertions, 370 deletions
diff --git a/WebCore/bindings/scripts/CodeGenerator.pm b/WebCore/bindings/scripts/CodeGenerator.pm index 1e56b0c..9a9e9d7 100644 --- a/WebCore/bindings/scripts/CodeGenerator.pm +++ b/WebCore/bindings/scripts/CodeGenerator.pm @@ -75,6 +75,7 @@ my %svgTypeNeedingTearOff = ( "SVGMatrix" => "SVGPropertyTearOff<SVGMatrix>", "SVGNumber" => "SVGPropertyTearOff<float>", "SVGNumberList" => "SVGListPropertyTearOff<SVGNumberList>", + "SVGPathSegList" => "SVGPathSegListPropertyTearOff", "SVGPoint" => "SVGPropertyTearOff<FloatPoint>", "SVGPointList" => "SVGListPropertyTearOff<SVGPointList>", "SVGPreserveAspectRatio" => "SVGPropertyTearOff<SVGPreserveAspectRatio>", @@ -307,8 +308,8 @@ sub AvoidInclusionOfType my $object = shift; my $type = shift; - # Special case: SVGRect.h / SVGPoint.h / SVGNumber.h do not exist. - return 1 if $type eq "SVGRect" or $type eq "SVGPoint" or $type eq "SVGNumber"; + # Special case: SVGPoint.h / SVGNumber.h do not exist. + return 1 if $type eq "SVGPoint" or $type eq "SVGNumber"; return 0; } diff --git a/WebCore/bindings/scripts/CodeGeneratorCPP.pm b/WebCore/bindings/scripts/CodeGeneratorCPP.pm index f9dd5f2..9b3f21e 100644 --- a/WebCore/bindings/scripts/CodeGeneratorCPP.pm +++ b/WebCore/bindings/scripts/CodeGeneratorCPP.pm @@ -25,8 +25,6 @@ package CodeGeneratorCPP; -use File::stat; - # Global Variables my $module = ""; my $outputDir = ""; diff --git a/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/WebCore/bindings/scripts/CodeGeneratorGObject.pm index 6c450ad..e2773b8 100644 --- a/WebCore/bindings/scripts/CodeGeneratorGObject.pm +++ b/WebCore/bindings/scripts/CodeGeneratorGObject.pm @@ -110,6 +110,7 @@ sub FixUpDecamelizedName { # FIXME: try to merge this somehow with the fixes in ClassNameToGobjectType $classname =~ s/x_path/xpath/; $classname =~ s/web_kit/webkit/; + $classname =~ s/htmli_frame/html_iframe/; return $classname; } @@ -118,8 +119,8 @@ sub ClassNameToGObjectType { my $className = shift; my $CLASS_NAME = uc(decamelize($className)); # Fixup: with our prefix being 'WebKitDOM' decamelize can't get - # WebKitDOMCSS right, so we have to fix it manually (and there - # might be more like this in the future) + # WebKitDOMCSS and similar names right, so we have to fix it + # manually. $CLASS_NAME =~ s/DOMCSS/DOM_CSS/; $CLASS_NAME =~ s/DOMHTML/DOM_HTML/; $CLASS_NAME =~ s/DOMDOM/DOM_DOM/; @@ -127,6 +128,7 @@ sub ClassNameToGObjectType { $CLASS_NAME =~ s/DOMX_PATH/DOM_XPATH/; $CLASS_NAME =~ s/DOM_WEB_KIT/DOM_WEBKIT/; $CLASS_NAME =~ s/DOMUI/DOM_UI/; + $CLASS_NAME =~ s/HTMLI_FRAME/HTML_IFRAME/; return $CLASS_NAME; } @@ -210,8 +212,11 @@ sub SkipFunction { # Skip functions that have ["Callback"] parameters, because this # code generator doesn't know how to auto-generate callbacks. + # Skip functions that have "MediaQueryListListener" parameters, because this + # code generator doesn't know how to auto-generate MediaQueryListListener. foreach my $param (@{$function->parameters}) { - if ($param->extendedAttributes->{"Callback"}) { + if ($param->extendedAttributes->{"Callback"} || + $param->type eq "MediaQueryListListener") { return 1; } } @@ -599,7 +604,8 @@ EOF push(@txtSetProps, $txtSetProps); foreach my $attribute (@readableProperties) { - if ($attribute->signature->type ne "EventListener") { + if ($attribute->signature->type ne "EventListener" && + $attribute->signature->type ne "MediaQueryListListener") { GenerateProperty($attribute, $interfaceName, \@writeableProperties); } } @@ -766,6 +772,7 @@ sub getIncludeHeader { return "" if $type eq "unsigned short"; return "" if $type eq "DOMTimeStamp"; return "" if $type eq "EventListener"; + return "" if $type eq "MediaQueryListListener"; return "" if $type eq "unsigned char"; return "" if $type eq "DOMString"; return "" if $type eq "float"; @@ -800,6 +807,10 @@ sub GenerateFunction { my $decamelize = FixUpDecamelizedName(decamelize($interfaceName)); + if ($object eq "MediaQueryListListener") { + return; + } + if (SkipFunction($function, $decamelize, $prefix)) { return; } @@ -821,7 +832,7 @@ sub GenerateFunction { foreach my $param (@{$function->parameters}) { my $paramIDLType = $param->type; - if ($paramIDLType eq "EventListener") { + if ($paramIDLType eq "EventListener" || $paramIDLType eq "MediaQueryListListener") { push(@hBody, "\n/* TODO: event function ${functionName} */\n\n"); push(@cBody, "\n/* TODO: event function ${functionName} */\n\n"); return; @@ -974,7 +985,7 @@ sub GenerateFunction { bool ok = item->${functionSigName}(${callImplParams}${exceptions}); if (ok) { - ${returnType} res = static_cast<${returnType}>(WebKit::kit($returnParamName)); + ${returnType} res = WebKit::kit($returnParamName); return res; } EOF @@ -1029,7 +1040,7 @@ EOF if ($returnType ne "void" && !$functionHasCustomReturn) { if ($functionSigType ne "DOMObject") { if ($returnValueIsGDOMType) { - push(@cBody, " ${returnType} res = static_cast<${returnType}>(WebKit::kit(g_res.get()));\n"); + push(@cBody, " ${returnType} res = WebKit::kit(g_res.get());\n"); } } if ($functionSigType eq "DOMObject") { @@ -1075,7 +1086,9 @@ sub GenerateFunctions { TOP: foreach my $attribute (@{$dataNode->attributes}) { - if (SkipAttribute($attribute) || $attribute->signature->type eq "EventListener") { + if (SkipAttribute($attribute) || + $attribute->signature->type eq "EventListener" || + $attribute->signature->type eq "MediaQueryListListener") { next TOP; } @@ -1239,7 +1252,7 @@ EOF if ($className ne "WebKitDOMNode") { $text = << "EOF"; - gpointer + ${className}* kit(WebCore::${interfaceName}* node); EOF @@ -1322,6 +1335,7 @@ sub Generate { $implIncludes{"webkitmarshal.h"} = 1; $implIncludes{"webkitprivate.h"} = 1; + $implIncludes{"DOMObjectCache.h"} = 1; $implIncludes{"WebKitDOMBinding.h"} = 1; $implIncludes{"gobject/ConvertToUTF8String.h"} = 1; $implIncludes{"webkit/$className.h"} = 1; @@ -1336,14 +1350,14 @@ sub Generate { my $converter = << "EOF"; namespace WebKit { -gpointer kit(WebCore::$interfaceName* obj) +${className}* kit(WebCore::$interfaceName* obj) { g_return_val_if_fail(obj, 0); if (gpointer ret = DOMObjectCache::get(obj)) - return ret; + return static_cast<${className}*>(ret); - return DOMObjectCache::put(obj, WebKit::wrap${interfaceName}(obj)); + return static_cast<${className}*>(DOMObjectCache::put(obj, WebKit::wrap${interfaceName}(obj))); } } // namespace WebKit // diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm index ea32615..1ad55e4 100644 --- a/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -6,6 +6,7 @@ # Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> # Copyright (C) Research In Motion Limited 2010. All rights reserved. +# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public @@ -24,8 +25,6 @@ package CodeGeneratorJS; -use File::stat; - my $module = ""; my $outputDir = ""; my $writeDependencies = 0; @@ -273,6 +272,10 @@ sub AddIncludesForType if ($type eq "Document") { $implIncludes{"NodeFilter.h"} = 1; } + + if ($type eq "MediaQueryListListener") { + $implIncludes{"MediaQueryListListener.h"} = 1; + } } # FIXME: This method will go away once all SVG animated properties are converted to the new scheme. @@ -316,25 +319,6 @@ sub AddClassForwardIfNeeded } } -# FIXME: This method will go away once all SVG animated properties are converted to the new scheme. -sub IsSVGTypeNeedingContextParameter -{ - # FIXME: This function will be removed, as soon the PODType concept is gone, and all SVG datatypes use the new style JS bindings. - - my $implClassName = shift; - - return 0 unless $implClassName =~ /SVG/; - return 0 if $implClassName =~ /Element/; - return 0 if $codeGenerator->IsSVGAnimatedType($implClassName); - return 0 if $codeGenerator->IsSVGTypeNeedingTearOff($implClassName); - - my @noContextNeeded = ("SVGColor", "SVGDocument", "SVGPaint", "SVGZoomEvent"); - foreach (@noContextNeeded) { - return 0 if $implClassName eq $_; - } - return 1; -} - sub HashValueForClassAndName { my $class = shift; @@ -937,8 +921,6 @@ sub GenerateHeader if (!$hasParent || $dataNode->extendedAttributes->{"GenerateToJS"} || $dataNode->extendedAttributes->{"CustomToJS"}) { if ($svgPropertyType) { push(@headerContent, "JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, $implType*);\n"); - } elsif (IsSVGTypeNeedingContextParameter($implClassName)) { - push(@headerContent, "JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, $implType*, SVGElement* context);\n"); } else { push(@headerContent, "JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, $implType*);\n"); } @@ -1461,8 +1443,6 @@ sub GenerateImplementation } else { push(@implContent, " forgetDOMObject(this, impl());\n"); } - - push(@implContent, " JSSVGContextCache::forgetWrapper(this);\n") if IsSVGTypeNeedingContextParameter($implClassName); } push(@implContent, "}\n\n"); @@ -1770,6 +1750,12 @@ sub GenerateImplementation my $nativeValue = JSValueToNative($attribute->signature, "value"); if ($svgPropertyOrListPropertyType) { + if ($svgPropertyType) { + push(@implContent, " if (imp->role() == AnimValRole) {\n"); + push(@implContent, " setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);\n"); + push(@implContent, " return;\n"); + push(@implContent, " }\n"); + } push(@implContent, " $svgPropertyOrListPropertyType& podImp = imp->propertyReference();\n"); if ($svgPropertyOrListPropertyType eq "float") { # Special case for JSSVGNumber push(@implContent, " podImp = $nativeValue;\n"); @@ -1793,9 +1779,6 @@ sub GenerateImplementation push(@implContent, ", ec") if @{$attribute->setterExceptions}; push(@implContent, ");\n"); push(@implContent, " setDOMException(exec, ec);\n") if @{$attribute->setterExceptions}; - if (IsSVGTypeNeedingContextParameter($implClassName)) { - push(@implContent, " JSSVGContextCache::propagateSVGDOMChange(castedThis, imp->associatedAttributeName());\n"); - } } } @@ -1874,7 +1857,13 @@ sub GenerateImplementation push(@implContent, " return JSValue::encode(castedThis->" . $functionImplementationName . "(exec));\n"); } else { push(@implContent, " $implType* imp = static_cast<$implType*>(castedThis->impl());\n"); - push(@implContent, " $svgPropertyOrListPropertyType& podImp = imp->propertyReference();\n") if $svgPropertyType; + if ($svgPropertyType) { + push(@implContent, " if (imp->role() == AnimValRole) {\n"); + push(@implContent, " setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);\n"); + push(@implContent, " return JSValue::encode(jsUndefined());\n"); + push(@implContent, " }\n"); + push(@implContent, " $svgPropertyType& podImp = imp->propertyReference();\n"); + } my $numParameters = @{$function->parameters}; @@ -1917,9 +1906,9 @@ sub GenerateImplementation my $hasOptionalArguments = 0; if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { - push(@implContent, " OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, $numParameters));\n"); + push(@implContent, " RefPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, $numParameters));\n"); push(@implContent, " size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1;\n"); - push(@implContent, " OwnPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize));\n"); + push(@implContent, " RefPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize));\n"); $implIncludes{"ScriptArguments.h"} = 1; $implIncludes{"ScriptCallStack.h"} = 1; $implIncludes{"ScriptCallStackFactory.h"} = 1; @@ -2077,7 +2066,7 @@ sub GenerateImplementation if ($constant->type eq "DOMString") { push(@implContent, " return jsStringOrNull(exec, String(" . $constant->value . "));\n"); } else { - push(@implContent, " UNUSED_PARAM(exec);"); + push(@implContent, " UNUSED_PARAM(exec);\n"); push(@implContent, " return jsNumber(static_cast<int>(" . $constant->value . "));\n"); } push(@implContent, "}\n\n"); @@ -2115,16 +2104,12 @@ sub GenerateImplementation if ((!$hasParent or $dataNode->extendedAttributes->{"GenerateToJS"}) and !$dataNode->extendedAttributes->{"CustomToJS"}) { if ($svgPropertyType) { push(@implContent, "JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, $implType* object)\n"); - } elsif ($podType or IsSVGTypeNeedingContextParameter($implClassName)) { - push(@implContent, "JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, $implType* object, SVGElement* context)\n"); } else { push(@implContent, "JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, $implType* object)\n"); } push(@implContent, "{\n"); if ($svgPropertyType) { push(@implContent, " return getDOMObjectWrapper<$className, $implType>(exec, globalObject, object);\n"); - } elsif (IsSVGTypeNeedingContextParameter($implClassName)) { - push(@implContent, " return getDOMObjectWrapper<$className>(exec, globalObject, object, context);\n"); } else { push(@implContent, " return getDOMObjectWrapper<$className>(exec, globalObject, object);\n"); } @@ -2315,7 +2300,7 @@ sub GenerateImplementationFunctionCall() if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { $functionString .= ", " if $paramIndex; $paramIndex += 2; - $functionString .= "scriptArguments.release(), callStack.release()"; + $functionString .= "scriptArguments, callStack"; } if (@{$function->raisesExceptions}) { @@ -2376,11 +2361,13 @@ my %nativeType = ( "boolean" => "bool", "double" => "double", "float" => "float", + "short" => "short", "long" => "int", "unsigned long" => "unsigned", "unsigned short" => "unsigned short", "long long" => "long long", "unsigned long long" => "unsigned long long", + "MediaQueryListListener" => "RefPtr<MediaQueryListListener>" ); sub GetNativeType @@ -2425,6 +2412,11 @@ sub GetSVGPropertyTypes $headerIncludes{"$svgWrappedNativeType.h"} = 1; $headerIncludes{"SVGAnimatedListPropertyTearOff.h"} = 1; $headerIncludes{"SVGTransformListPropertyTearOff.h"} = 1; + } elsif ($svgNativeType =~ /SVGPathSegListPropertyTearOff/) { + $svgListPropertyType = $svgWrappedNativeType; + $headerIncludes{"$svgWrappedNativeType.h"} = 1; + $headerIncludes{"SVGAnimatedListPropertyTearOff.h"} = 1; + $headerIncludes{"SVGPathSegListPropertyTearOff.h"} = 1; } return ($svgPropertyType, $svgListPropertyType, $svgNativeType); @@ -2446,7 +2438,7 @@ sub JSValueToNative return "$value.toBoolean(exec)" if $type eq "boolean"; return "$value.toNumber(exec)" if $type eq "double"; return "$value.toFloat(exec)" if $type eq "float"; - return "$value.toInt32(exec)" if $type eq "long"; + return "$value.toInt32(exec)" if $type eq "long" or $type eq "short"; return "$value.toUInt32(exec)" if $type eq "unsigned long" or $type eq "unsigned short"; return "static_cast<$type>($value.toInteger(exec))" if $type eq "long long" or $type eq "unsigned long long"; @@ -2464,6 +2456,11 @@ sub JSValueToNative return "$value"; } + if ($type eq "MediaQueryListListener") { + $implIncludes{"MediaQueryListListener.h"} = 1; + return "MediaQueryListListener::create(" . $value .")"; + } + if ($type eq "SerializedScriptValue" or $type eq "any") { $implIncludes{"SerializedScriptValue.h"} = 1; return "SerializedScriptValue::create(exec, $value)"; @@ -2553,11 +2550,6 @@ sub NativeToJSValue return $value if $codeGenerator->IsSVGAnimatedType($type); - if (IsSVGTypeNeedingContextParameter($type)) { - my $contextPtr = IsSVGTypeNeedingContextParameter($implClassName) ? "JSSVGContextCache::svgContextForDOMObject(castedThis)" : "imp"; - return "toJS(exec, $globalObject, WTF::getPtr($value), $contextPtr)"; - } - if ($signature->extendedAttributes->{"ReturnsNew"}) { return "toJSNewlyCreated(exec, $globalObject, WTF::getPtr($value))"; } @@ -2594,7 +2586,7 @@ sub NativeToJSValue } elsif ($tearOffType =~ /SVGStaticListPropertyTearOff/) { my $extraImp = "GetOwnerElementForType<$implClassName, IsDerivedFromSVGElement<$implClassName>::value>::ownerElement(imp), "; $value = "${tearOffType}::create($extraImp$value)"; - } elsif (not $tearOffType =~ /SVGPointList/) { + } elsif (not $tearOffType =~ /SVG(Point|PathSeg)List/) { $value = "${tearOffType}::create($value)"; } } diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm index 50334a2..6ccebf9 100644 --- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm +++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm @@ -26,8 +26,6 @@ package CodeGeneratorObjC; -use File::stat; - # Global Variables my $module = ""; my $outputDir = ""; @@ -673,6 +671,9 @@ sub GetSVGPropertyTypes } elsif ($svgNativeType =~ /SVGTransformListPropertyTearOff/) { $svgListPropertyType = "WebCore::$svgWrappedNativeType"; $svgListPropertyType =~ s/</\<WebCore::/; + } elsif ($svgNativeType =~ /SVGPathSegListPropertyTearOff/) { + $svgListPropertyType = "WebCore::$svgWrappedNativeType"; + $svgListPropertyType =~ s/</\<WebCore::/; } return ($svgPropertyType, $svgListPropertyType, $svgNativeType); @@ -1004,6 +1005,7 @@ sub GenerateHeader if ($svgListPropertyType) { push(@internalHeaderContent, "#import <WebCore/SVGAnimatedListPropertyTearOff.h>\n\n"); push(@internalHeaderContent, "#import <WebCore/SVGTransformListPropertyTearOff.h>\n\n") if $svgListPropertyType =~ /SVGTransformList/; + push(@internalHeaderContent, "#import <WebCore/SVGPathSegListPropertyTearOff.h>\n\n") if $svgListPropertyType =~ /SVGPathSegList/; } push(@internalHeaderContent, $interfaceAvailabilityVersionCheck) if length $interfaceAvailabilityVersion; @@ -1300,6 +1302,7 @@ sub GenerateImplementation my $type = $attribute->signature->type; if ($codeGenerator->IsSVGTypeNeedingTearOff($type) and not $implClassName =~ /List$/) { my $idlTypeWithNamespace = GetSVGTypeWithNamespace($type); + $implIncludes{"$type.h"} = 1 if not $codeGenerator->AvoidInclusionOfType($type); if ($codeGenerator->IsSVGTypeWithWritablePropertiesNeedingTearOff($type) and not defined $attribute->signature->extendedAttributes->{"Immutable"}) { $idlTypeWithNamespace =~ s/SVGPropertyTearOff</SVGStaticPropertyTearOff<$implClassNameWithNamespace, /; $implIncludes{"SVGStaticPropertyTearOff.h"} = 1; @@ -1310,13 +1313,13 @@ sub GenerateImplementation my $updateMethod = "&${implClassNameWithNamespace}::update" . $codeGenerator->WK_ucfirst($getter); $getterContentHead = "kit(WTF::getPtr(${idlTypeWithNamespace}::create(IMPL, $getterContentHead$getterContentTail, $updateMethod"; $getterContentTail .= "))"; + } elsif ($idlTypeWithNamespace =~ /SVG(Point|PathSeg)List/) { + $getterContentHead = "kit(WTF::getPtr($getterContentHead"; + $getterContentTail .= "))"; } elsif ($idlTypeWithNamespace =~ /SVGStaticListPropertyTearOff/) { my $extraImp = "WebCore::GetOwnerElementForType<$implClassNameWithNamespace, WebCore::IsDerivedFromSVGElement<$implClassNameWithNamespace>::value>::ownerElement(IMPL), "; $getterContentHead = "kit(WTF::getPtr(${idlTypeWithNamespace}::create($extraImp$getterContentHead"; $getterContentTail .= ")))"; - } elsif ($idlTypeWithNamespace =~ /SVGPointList/) { - $getterContentHead = "kit(WTF::getPtr($getterContentHead"; - $getterContentTail .= "))"; } else { $getterContentHead = "kit(WTF::getPtr(${idlTypeWithNamespace}::create($getterContentHead"; $getterContentTail .= ")))"; @@ -1390,6 +1393,10 @@ sub GenerateImplementation if ($svgPropertyType) { $getterContentHead = "$getterExpressionPrefix"; + push(@implContent, " if (IMPL->role() == WebCore::AnimValRole) {\n"); + push(@implContent, " WebCore::raiseOnDOMError(WebCore::NO_MODIFICATION_ALLOWED_ERR);\n"); + push(@implContent, " return;\n"); + push(@implContent, " }\n"); push(@implContent, " $svgPropertyType& podImpl = IMPL->propertyReference();\n"); my $ec = $hasSetterException ? ", ec" : ""; push(@implContent, " $exceptionInit\n") if $hasSetterException; @@ -1572,6 +1579,14 @@ sub GenerateImplementation my $content = $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")"; if ($svgPropertyType) { + push(@functionContent, " if (IMPL->role() == WebCore::AnimValRole) {\n"); + push(@functionContent, " WebCore::raiseOnDOMError(WebCore::NO_MODIFICATION_ALLOWED_ERR);\n"); + if ($returnType eq "void") { + push(@functionContent, " return;\n"); + } else { + push(@functionContent, " return nil;\n"); + } + push(@functionContent, " }\n"); push(@functionContent, " $svgPropertyType& podImpl = IMPL->propertyReference();\n"); $content = "podImpl.$content"; } else { diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm index 6f39582..7488d50 100644 --- a/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -6,6 +6,7 @@ # Copyright (C) 2007, 2008, 2009 Google Inc. # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> # Copyright (C) Research In Motion Limited 2010. All rights reserved. +# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public @@ -25,7 +26,6 @@ package CodeGeneratorV8; -use File::stat; use Digest::MD5; my $module = ""; @@ -681,18 +681,9 @@ sub GenerateNormalAttrGetter my $interfaceName = shift; my $attrExt = $attribute->signature->extendedAttributes; - my $attrName = $attribute->signature->name; - my $attrType = GetTypeFromSignature($attribute->signature); - my $nativeType = GetNativeTypeFromSignature($attribute->signature, -1); - my $skipContext = 0; - - # Special case: SVGZoomEvent's attributes are all read-only - if ($implClassName eq "SVGZoomEvent") { - $skipContext = 1; - } my $getterStringUsesImp = $implClassName ne "SVGNumber"; my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($implClassName); @@ -836,14 +827,6 @@ END return; } - if (IsSVGTypeNeedingContextParameter($attrType) && !$skipContext) { - push(@implContentDecls, GenerateSVGContextRetrieval($implClassName, " ")); - # The templating associated with passing withSVGContext()'s return value directly into toV8 can get compilers confused, - # so just manually set the return value to a PassRefPtr of the expected type. - push(@implContentDecls, " PassRefPtr<$attrType> resultAsPassRefPtr = V8Proxy::withSVGContext($result, context);\n"); - $result = "resultAsPassRefPtr"; - } - if ($codeGenerator->IsSVGAnimatedType($implClassName) and $codeGenerator->IsSVGTypeNeedingTearOff($attrType)) { $implIncludes{"V8$attrType.h"} = 1; my $svgNativeType = $codeGenerator->GetSVGTypeNeedingTearOff($attrType); @@ -881,7 +864,7 @@ END } elsif ($tearOffType =~ /SVGStaticListPropertyTearOff/) { my $extraImp = "GetOwnerElementForType<$implClassName, IsDerivedFromSVGElement<$implClassName>::value>::ownerElement(imp), "; push(@implContentDecls, " return toV8(WTF::getPtr(${tearOffType}::create($extraImp$result)));\n"); - } elsif ($tearOffType =~ /SVGPointList/) { + } elsif ($tearOffType =~ /SVG(Point|PathSeg)List/) { push(@implContentDecls, " return toV8(WTF::getPtr($result));\n"); } else { push(@implContentDecls, " return toV8(WTF::getPtr(${tearOffType}::create($result)));\n"); @@ -934,11 +917,13 @@ sub GenerateNormalAttrSetter $svgNativeType* imp = V8${implClassName}::toNative(info.Holder()); END } else { - push(@implContentDecls, <<END); - $svgNativeType* wrapper = V8${implClassName}::toNative(info.Holder()); - $svgWrappedNativeType& impInstance = wrapper->propertyReference(); - $svgWrappedNativeType* imp = &impInstance; -END + push(@implContentDecls, " $svgNativeType* wrapper = V8${implClassName}::toNative(info.Holder());\n"); + push(@implContentDecls, " if (wrapper->role() == AnimValRole) {\n"); + push(@implContentDecls, " V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR);\n"); + push(@implContentDecls, " return;\n"); + push(@implContentDecls, " }\n"); + push(@implContentDecls, " $svgWrappedNativeType& impInstance = wrapper->propertyReference();\n"); + push(@implContentDecls, " $svgWrappedNativeType* imp = &impInstance;\n"); } } elsif ($attrExt->{"v8OnProto"}) { if ($interfaceName eq "DOMWindow") { @@ -1038,10 +1023,6 @@ END } else { push(@implContentDecls, " wrapper->commitChange();\n"); } - } elsif (IsSVGTypeNeedingContextParameter($implClassName)) { - $implIncludes{"SVGElement.h"} = 1; - push(@implContentDecls, " if (SVGElement* context = V8Proxy::svgContext(imp))\n"); - push(@implContentDecls, " context->svgAttributeChanged(imp->associatedAttributeName());\n"); } push(@implContentDecls, " return;\n"); @@ -1239,8 +1220,12 @@ END if ($implClassName =~ /List$/) { push(@implContentDecls, " $nativeClassName imp = V8${implClassName}::toNative(args.Holder());\n"); } else { - my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implClassName); push(@implContentDecls, " $nativeClassName wrapper = V8${implClassName}::toNative(args.Holder());\n"); + push(@implContentDecls, " if (wrapper->role() == AnimValRole) {\n"); + push(@implContentDecls, " V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR);\n"); + push(@implContentDecls, " return v8::Handle<v8::Value>();\n"); + push(@implContentDecls, " }\n"); + my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implClassName); push(@implContentDecls, " $svgWrappedNativeType& impInstance = wrapper->propertyReference();\n"); push(@implContentDecls, " $svgWrappedNativeType* imp = &impInstance;\n"); } @@ -1281,9 +1266,9 @@ END if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { push(@implContentDecls, <<END); - OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, $numParameters)); + RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, $numParameters)); size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1; - OwnPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize)); + RefPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize)); if (!callStack) return v8::Undefined(); END @@ -1538,11 +1523,6 @@ sub GenerateImplementationIndexer if ($interfaceName eq "HTMLOptionsCollection") { $hasGetter = 1; } - # FIXME: If the parent interface of $dataNode already has - # HasIndexGetter, we don't need to handle the getter here. - if ($interfaceName eq "WebKitCSSTransformValue") { - $hasGetter = 0; - } # FIXME: Investigate and remove this nastinesss. In V8, named property handling and indexer handling are apparently decoupled, # which means that object[X] where X is a number doesn't reach named property indexer. So we need to provide @@ -1568,6 +1548,13 @@ sub GenerateImplementationIndexer $indexerType = "WebKitCSSKeyframeRule"; } + # FIXME: The item() getter is not inherited from CSSValueList, seemingly due to the way + # the CodeGenerator->AddMethodsConstantsAndAttributesFromParentClasses() method works, + # so we need to set the indexerType manually in this case. + if ($interfaceName eq "WebKitCSSTransformValue") { + $indexerType = "CSSValue"; + } + if ($indexerType && !$hasCustomSetter) { if ($indexerType eq "DOMString") { my $conversion = $indexer->extendedAttributes->{"ConvertNullStringTo"}; @@ -1937,7 +1924,7 @@ END push(@implContent, <<END); static v8::Persistent<v8::ObjectTemplate> ConfigureShadowObjectTemplate(v8::Persistent<v8::ObjectTemplate> templ) { - batchConfigureAttributes(templ, v8::Handle<v8::ObjectTemplate>(), shadowAttrs, sizeof(shadowAttrs) / sizeof(*shadowAttrs)); + batchConfigureAttributes(templ, v8::Handle<v8::ObjectTemplate>(), shadowAttrs, WTF_ARRAY_LENGTH(shadowAttrs)); // Install a security handler with V8. templ->SetAccessCheckCallbacks(V8DOMWindow::namedSecurityCheck, V8DOMWindow::indexedSecurityCheck, v8::External::Wrap(&V8DOMWindow::info)); @@ -1969,7 +1956,7 @@ END # Set up our attributes if we have them if ($has_attributes) { push(@implContent, <<END); - ${interfaceName}Attrs, sizeof(${interfaceName}Attrs) / sizeof(*${interfaceName}Attrs), + ${interfaceName}Attrs, WTF_ARRAY_LENGTH(${interfaceName}Attrs), END } else { push(@implContent, <<END); @@ -1979,7 +1966,7 @@ END if ($has_callbacks) { push(@implContent, <<END); - ${interfaceName}Callbacks, sizeof(${interfaceName}Callbacks) / sizeof(*${interfaceName}Callbacks)); + ${interfaceName}Callbacks, WTF_ARRAY_LENGTH(${interfaceName}Callbacks)); END } else { push(@implContent, <<END); @@ -2117,7 +2104,7 @@ END if ($has_constants) { push(@implContent, <<END); - batchConfigureConstants(desc, proto, ${interfaceName}Consts, sizeof(${interfaceName}Consts) / sizeof(*${interfaceName}Consts)); + batchConfigureConstants(desc, proto, ${interfaceName}Consts, WTF_ARRAY_LENGTH(${interfaceName}Consts)); END } @@ -2554,8 +2541,6 @@ sub GetDomMapFunction my $type = shift; return "getDOMSVGElementInstanceMap()" if $type eq "SVGElementInstance"; return "getDOMNodeMap()" if ($dataNode && IsNodeSubType($dataNode)); - # Only use getDOMSVGObjectWithContextMap() for non-node svg objects - return "getDOMSVGObjectWithContextMap()" if $type =~ /SVG/ and not $codeGenerator->IsSVGTypeNeedingTearOff($type) and not $codeGenerator->IsSVGAnimatedType($type); return "" if $type eq "DOMImplementation"; return "getActiveDOMObjectMap()" if IsActiveDomType($type); return "getDOMObjectMap()"; @@ -2574,7 +2559,6 @@ sub IsActiveDomType return 1 if $type eq "IDBRequest"; return 1 if $type eq "FileReader"; return 1 if $type eq "FileWriter"; - return 1 if $type eq "FileWriterSync"; return 0; } @@ -2668,7 +2652,7 @@ sub GenerateFunctionCallString() if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) { $functionString .= ", " if $index; - $functionString .= "scriptArguments.release(), callStack.release()"; + $functionString .= "scriptArguments, callStack"; $index += 2; } @@ -2722,23 +2706,6 @@ sub GenerateFunctionCallString() return $result; } - my $generatedSVGContextRetrieval = 0; - # If the return type needs an SVG context, output it - if (IsSVGTypeNeedingContextParameter($returnType)) { - $result .= GenerateSVGContextAssignment($implClassName, $return . ".get()", $indent); - $generatedSVGContextRetrieval = 1; - } - - if (IsSVGTypeNeedingContextParameter($implClassName) && $implClassName =~ /List$/ && IsSVGListMutator($name)) { - if (!$generatedSVGContextRetrieval) { - $result .= GenerateSVGContextRetrieval($implClassName, $indent); - $generatedSVGContextRetrieval = 1; - } - - $result .= $indent . "context->svgAttributeChanged(imp->associatedAttributeName());\n"; - $implIncludes{"SVGElement.h"} = 1; - } - # If the implementing class is a POD type, commit changes if ($codeGenerator->IsSVGTypeNeedingTearOff($implClassName) and not $implClassName =~ /List$/) { $result .= $indent . "wrapper->commitChange();\n"; @@ -2839,6 +2806,7 @@ sub GetNativeType return "Node*" if $type eq "EventTarget" and $isParameter; return "double" if $type eq "Date"; return "ScriptValue" if $type eq "DOMObject"; + return "OptionsObject" if $type eq "OptionsObject"; return "String" if $type eq "DOMUserData"; # FIXME: Temporary hack? @@ -2854,6 +2822,8 @@ sub GetNativeType return "RefPtr<${type}>" if IsRefPtrType($type) and not $isParameter; + return "RefPtr<MediaQueryListListener>" if $type eq "MediaQueryListListener"; + # Default, assume native type is a pointer with same type name as idl type return "${type}*"; } @@ -2901,7 +2871,7 @@ sub JSValueToNative return "$value->BooleanValue()" if $type eq "boolean"; return "static_cast<$type>($value->NumberValue())" if $type eq "float" or $type eq "double"; - return "toInt32($value)" if $type eq "long"; + return "toInt32($value)" if $type eq "long" or $type eq "short"; return "toUInt32($value)" if $type eq "unsigned long" or $type eq "unsigned short"; return "toInt64($value)" if $type eq "unsigned long long" or $type eq "long long"; return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "CompareHow"; @@ -2920,6 +2890,11 @@ sub JSValueToNative return "createIDBKeyFromValue($value)"; } + if ($type eq "OptionsObject") { + $implIncludes{"OptionsObject.h"} = 1; + return $value; + } + if ($type eq "DOMObject") { $implIncludes{"ScriptValue.h"} = 1; return "ScriptValue($value)"; @@ -2929,8 +2904,9 @@ sub JSValueToNative return "V8DOMWrapper::wrapNativeNodeFilter($value)"; } - if ($type eq "SVGRect") { - $implIncludes{"FloatRect.h"} = 1; + if ($type eq "MediaQueryListListener") { + $implIncludes{"MediaQueryListListener.h"} = 1; + return "MediaQueryListListener::create(" . $value . ")"; } # Default, assume autogenerated type conversion routines @@ -3060,7 +3036,9 @@ my %non_wrapper_types = ( 'NodeFilter' => 1, 'EventListener' => 1, 'IDBKey' => 1, - 'Date' => 1 + 'OptionsObject' => 1, + 'Date' => 1, + 'MediaQueryListListener' => 1 ); @@ -3107,7 +3085,6 @@ sub ReturnNativeToJSValue my $indent = shift; my $type = GetTypeFromSignature($signature); - return "return v8::Date::New(static_cast<double>($value))" if $type eq "DOMTimeStamp"; return "return v8Boolean($value)" if $type eq "boolean"; return "return v8::Handle<v8::Value>()" if $type eq "void"; # equivalent to v8::Undefined() @@ -3119,7 +3096,7 @@ sub ReturnNativeToJSValue return "return v8DateOrNull($value)" if $type eq "Date"; # long long and unsigned long long are not representable in ECMAScript. - return "return v8::Number::New(static_cast<double>($value))" if $type eq "long long" or $type eq "unsigned long long"; + return "return v8::Number::New(static_cast<double>($value))" if $type eq "long long" or $type eq "unsigned long long" or $type eq "DOMTimeStamp"; return "return v8::Number::New($value)" if $codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType"; return "return $value.v8Value()" if $nativeType eq "ScriptValue"; @@ -3208,64 +3185,6 @@ sub WriteData } } -# FIXME: This method will go away once all SVG animated properties are converted to the new scheme. -sub IsSVGTypeNeedingContextParameter -{ - my $implClassName = shift; - - return 0 unless $implClassName =~ /SVG/; - return 0 if $implClassName =~ /Element/; - return 0 if $codeGenerator->IsSVGAnimatedType($implClassName); - return 0 if $codeGenerator->IsSVGTypeNeedingTearOff($implClassName); - - my @noContextNeeded = ("SVGColor", "SVGDocument", "SVGPaintType", "SVGPaint", "SVGZoomEvent"); - foreach (@noContextNeeded) { - return 0 if $implClassName eq $_; - } - return 1; -} - -# FIXME: This method will go away once all SVG animated properties are converted to the new scheme. -sub GenerateSVGContextAssignment -{ - my $srcType = shift; - my $value = shift; - my $indent = shift; - - $result = GenerateSVGContextRetrieval($srcType, $indent); - $result .= $indent . "V8Proxy::setSVGContext($value, context);\n"; - - return $result; -} - -# FIXME: This method will go away once all SVG animated properties are converted to the new scheme. -sub GenerateSVGContextRetrieval -{ - my $srcType = shift; - my $indent = shift; - - my $contextDecl = "imp"; - if (IsSVGTypeNeedingContextParameter($srcType)) { - $contextDecl = "V8Proxy::svgContext($contextDecl)"; - } - - return $indent . "SVGElement* context = $contextDecl;\n"; -} - -sub IsSVGListMutator -{ - my $functionName = shift; - - return 1 if $functionName eq "clear"; - return 1 if $functionName eq "initialize"; - return 1 if $functionName eq "insertItemBefore"; - return 1 if $functionName eq "replaceItem"; - return 1 if $functionName eq "removeItem"; - return 1 if $functionName eq "appendItem"; - - return 0; -} - sub GetVisibleInterfaceName { my $interfaceName = shift; diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp index 579295f..819c7cf 100644 --- a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp @@ -24,9 +24,11 @@ #include "HTMLNames.h" #include "IDBKey.h" #include "KURL.h" +#include "OptionsObject.h" #include "SerializedScriptValue.h" #include "TestObj.h" #include "WebDOMIDBKey.h" +#include "WebDOMOptionsObject.h" #include "WebDOMString.h" #include "WebExceptionHandler.h" #include "WebNativeEventListener.h" @@ -103,6 +105,38 @@ WebDOMTestObj WebDOMTestObj::readOnlyTestObjAttr() const return toWebKit(WTF::getPtr(impl()->readOnlyTestObjAttr())); } +short WebDOMTestObj::shortAttr() const +{ + if (!impl()) + return 0; + + return impl()->shortAttr(); +} + +void WebDOMTestObj::setShortAttr(short newShortAttr) +{ + if (!impl()) + return; + + impl()->setShortAttr(newShortAttr); +} + +unsigned short WebDOMTestObj::unsignedShortAttr() const +{ + if (!impl()) + return 0; + + return impl()->unsignedShortAttr(); +} + +void WebDOMTestObj::setUnsignedShortAttr(unsigned short newUnsignedShortAttr) +{ + if (!impl()) + return; + + impl()->setUnsignedShortAttr(newUnsignedShortAttr); +} + int WebDOMTestObj::intAttr() const { if (!impl()) @@ -630,6 +664,14 @@ void WebDOMTestObj::idbKey(const WebDOMIDBKey& key) impl()->idbKey(toWebCore(key)); } +void WebDOMTestObj::optionsObject(const WebDOMOptionsObject& oo, const WebDOMOptionsObject& ooo) +{ + if (!impl()) + return; + + impl()->optionsObject(toWebCore(oo), toWebCore(ooo)); +} + void WebDOMTestObj::methodWithException() { if (!impl()) diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h index cd6caaa..0b3593d 100644 --- a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h @@ -32,6 +32,7 @@ class TestObj; class WebDOMEventListener; class WebDOMIDBKey; +class WebDOMOptionsObject; class WebDOMString; class WebDOMTestObj; @@ -60,6 +61,10 @@ public: int readOnlyIntAttr() const; WebDOMString readOnlyStringAttr() const; WebDOMTestObj readOnlyTestObjAttr() const; + short shortAttr() const; + void setShortAttr(short); + unsigned short unsignedShortAttr() const; + void setUnsignedShortAttr(unsigned short); int intAttr() const; void setIntAttr(int); long long longLongAttr() const; @@ -132,6 +137,7 @@ public: WebDOMTestObj methodThatRequiresAllArgsAndThrows(const WebDOMString& strArg, const WebDOMTestObj& objArg); void serializedValue(const WebDOMString& serializedArg); 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); diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp index fbe538d..554cc15 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp @@ -25,6 +25,7 @@ #include <wtf/GetPtr.h> #include <wtf/RefPtr.h> +#include "DOMObjectCache.h" #include "ExceptionCode.h" #include "JSMainThreadExecState.h" #include "TestCallback.h" @@ -58,8 +59,8 @@ gpointer kit(WebCore::TestCallback* obj) gboolean webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestCallback * item = WebKit::core(self); g_return_val_if_fail(class1param, 0); WebCore::Class1 * converted_class1param = NULL; @@ -74,8 +75,8 @@ webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, gboolean webkit_dom_test_callback_callback_with_class2param(WebKitDOMTestCallback* self, WebKitDOMClass2* class2param, const gchar* str_arg) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestCallback * item = WebKit::core(self); g_return_val_if_fail(class2param, 0); g_return_val_if_fail(str_arg, 0); @@ -92,8 +93,8 @@ webkit_dom_test_callback_callback_with_class2param(WebKitDOMTestCallback* self, glong webkit_dom_test_callback_callback_with_non_bool_return_type(WebKitDOMTestCallback* self, WebKitDOMClass3* class3param) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestCallback * item = WebKit::core(self); g_return_val_if_fail(class3param, 0); WebCore::Class3 * converted_class3param = NULL; diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp index a13da45..6c906e4 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp @@ -25,6 +25,7 @@ #include <wtf/GetPtr.h> #include <wtf/RefPtr.h> +#include "DOMObjectCache.h" #include "ExceptionCode.h" #include "JSMainThreadExecState.h" #include "TestInterface.h" diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp index af9300d..a7d364c 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp @@ -23,13 +23,12 @@ #include <wtf/GetPtr.h> #include <wtf/RefPtr.h> +#include "DOMObjectCache.h" #include "ExceptionCode.h" #include "JSMainThreadExecState.h" #include "TestMediaQueryListListener.h" #include "WebKitDOMBinding.h" #include "gobject/ConvertToUTF8String.h" -#include "webkit/WebKitDOMMediaQueryListListener.h" -#include "webkit/WebKitDOMMediaQueryListListenerPrivate.h" #include "webkit/WebKitDOMTestMediaQueryListListener.h" #include "webkit/WebKitDOMTestMediaQueryListListenerPrivate.h" #include "webkitmarshal.h" @@ -49,21 +48,6 @@ gpointer kit(WebCore::TestMediaQueryListListener* obj) } // namespace WebKit // -void -webkit_dom_test_media_query_list_listener_method(WebKitDOMTestMediaQueryListListener* self, WebKitDOMMediaQueryListListener* listener) -{ - WebCore::JSMainThreadNullState state; - g_return_if_fail(self); - WebCore::TestMediaQueryListListener * item = WebKit::core(self); - g_return_if_fail(listener); - WebCore::MediaQueryListListener * converted_listener = NULL; - if (listener != NULL) { - converted_listener = WebKit::core(listener); - g_return_if_fail(converted_listener); - } - item->method(converted_listener); -} - G_DEFINE_TYPE(WebKitDOMTestMediaQueryListListener, webkit_dom_test_media_query_list_listener, WEBKIT_TYPE_DOM_OBJECT) diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.h index 94e825e..612439b 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.h +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.h @@ -46,9 +46,6 @@ struct _WebKitDOMTestMediaQueryListListenerClass { WEBKIT_API GType webkit_dom_test_media_query_list_listener_get_type (void); -WEBKIT_API void -webkit_dom_test_media_query_list_listener_method(WebKitDOMTestMediaQueryListListener* self, WebKitDOMMediaQueryListListener* listener); - G_END_DECLS #endif /* WebKitDOMTestMediaQueryListListener_h */ diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp index c9c10d7..ec2c6dc 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -23,6 +23,7 @@ #include <wtf/GetPtr.h> #include <wtf/RefPtr.h> +#include "DOMObjectCache.h" #include "ExceptionCode.h" #include "HTMLNames.h" #include "JSMainThreadExecState.h" @@ -31,6 +32,8 @@ #include "gobject/ConvertToUTF8String.h" #include "webkit/WebKitDOMIDBKey.h" #include "webkit/WebKitDOMIDBKeyPrivate.h" +#include "webkit/WebKitDOMOptionsObject.h" +#include "webkit/WebKitDOMOptionsObjectPrivate.h" #include "webkit/WebKitDOMSerializedScriptValue.h" #include "webkit/WebKitDOMSerializedScriptValuePrivate.h" #include "webkit/WebKitDOMTestObj.h" @@ -55,8 +58,8 @@ gpointer kit(WebCore::TestObj* obj) void webkit_dom_test_obj_void_method(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->voidMethod(); } @@ -64,8 +67,8 @@ webkit_dom_test_obj_void_method(WebKitDOMTestObj* self) void webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong int_arg, const gchar* str_arg, WebKitDOMTestObj* obj_arg) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); g_return_if_fail(str_arg); g_return_if_fail(obj_arg); @@ -81,8 +84,8 @@ webkit_dom_test_obj_void_method_with_args(WebKitDOMTestObj* self, glong int_arg, glong webkit_dom_test_obj_int_method(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); glong res = item->intMethod(); return res; @@ -91,8 +94,8 @@ webkit_dom_test_obj_int_method(WebKitDOMTestObj* self) glong webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong int_arg, const gchar* str_arg, WebKitDOMTestObj* obj_arg) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); g_return_val_if_fail(str_arg, 0); g_return_val_if_fail(obj_arg, 0); @@ -109,8 +112,8 @@ webkit_dom_test_obj_int_method_with_args(WebKitDOMTestObj* self, glong int_arg, WebKitDOMTestObj* webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->objMethod()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj*>(WebKit::kit(g_res.get())); @@ -120,8 +123,8 @@ webkit_dom_test_obj_obj_method(WebKitDOMTestObj* self) WebKitDOMTestObj* webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg, const gchar* str_arg, WebKitDOMTestObj* obj_arg) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); g_return_val_if_fail(str_arg, 0); g_return_val_if_fail(obj_arg, 0); @@ -139,8 +142,8 @@ webkit_dom_test_obj_obj_method_with_args(WebKitDOMTestObj* self, glong int_arg, WebKitDOMTestObj* webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, const gchar* str_arg, WebKitDOMTestObj* obj_arg) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); g_return_val_if_fail(str_arg, 0); g_return_val_if_fail(obj_arg, 0); @@ -158,8 +161,8 @@ webkit_dom_test_obj_method_that_requires_all_args(WebKitDOMTestObj* self, const WebKitDOMTestObj* webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* self, const gchar* str_arg, WebKitDOMTestObj* obj_arg, GError **error) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); g_return_val_if_fail(str_arg, 0); g_return_val_if_fail(obj_arg, 0); @@ -183,8 +186,8 @@ webkit_dom_test_obj_method_that_requires_all_args_and_throws(WebKitDOMTestObj* s void webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerializedScriptValue* serialized_arg) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); g_return_if_fail(serialized_arg); WebCore::SerializedScriptValue * converted_serialized_arg = NULL; @@ -198,8 +201,8 @@ webkit_dom_test_obj_serialized_value(WebKitDOMTestObj* self, WebKitDOMSerialized void webkit_dom_test_obj_idb_key(WebKitDOMTestObj* self, WebKitDOMIDBKey* key) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); g_return_if_fail(key); WebCore::IDBKey * converted_key = NULL; @@ -211,10 +214,31 @@ webkit_dom_test_obj_idb_key(WebKitDOMTestObj* self, WebKitDOMIDBKey* key) } void -webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error) +webkit_dom_test_obj_options_object(WebKitDOMTestObj* self, WebKitDOMOptionsObject* oo, WebKitDOMOptionsObject* ooo) { + g_return_if_fail(self); WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(oo); + g_return_if_fail(ooo); + WebCore::OptionsObject * converted_oo = NULL; + if (oo != NULL) { + converted_oo = WebKit::core(oo); + g_return_if_fail(converted_oo); + } + WebCore::OptionsObject * converted_ooo = NULL; + if (ooo != NULL) { + converted_ooo = WebKit::core(ooo); + g_return_if_fail(converted_ooo); + } + item->optionsObject(converted_oo, converted_ooo); +} + +void +webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error) +{ g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); WebCore::ExceptionCode ec = 0; item->methodWithException(ec); @@ -234,8 +258,8 @@ webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error void webkit_dom_test_obj_with_dynamic_frame(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrame(); } @@ -243,8 +267,8 @@ webkit_dom_test_obj_with_dynamic_frame(WebKitDOMTestObj* self) void webkit_dom_test_obj_with_dynamic_frame_and_arg(WebKitDOMTestObj* self, glong int_arg) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrameAndArg(int_arg); } @@ -252,8 +276,8 @@ webkit_dom_test_obj_with_dynamic_frame_and_arg(WebKitDOMTestObj* self, glong int void webkit_dom_test_obj_with_dynamic_frame_and_optional_arg(WebKitDOMTestObj* self, glong int_arg, glong optional_arg) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrameAndOptionalArg(int_arg, optional_arg); } @@ -261,8 +285,8 @@ webkit_dom_test_obj_with_dynamic_frame_and_optional_arg(WebKitDOMTestObj* self, void webkit_dom_test_obj_with_dynamic_frame_and_user_gesture(WebKitDOMTestObj* self, glong int_arg, gboolean isUserGesture) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrameAndUserGesture(int_arg, false); } @@ -270,8 +294,8 @@ webkit_dom_test_obj_with_dynamic_frame_and_user_gesture(WebKitDOMTestObj* self, void webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* self, glong int_arg, glong optional_arg, gboolean isUserGesture) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->withDynamicFrameAndUserGestureASAD(int_arg, optional_arg, false); } @@ -279,8 +303,8 @@ webkit_dom_test_obj_with_dynamic_frame_and_user_gesture_asad(WebKitDOMTestObj* s void webkit_dom_test_obj_with_script_state_void(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->withScriptStateVoid(); } @@ -288,8 +312,8 @@ webkit_dom_test_obj_with_script_state_void(WebKitDOMTestObj* self) WebKitDOMTestObj* webkit_dom_test_obj_with_script_state_obj(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->withScriptStateObj()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj*>(WebKit::kit(g_res.get())); @@ -299,8 +323,8 @@ webkit_dom_test_obj_with_script_state_obj(WebKitDOMTestObj* self) void webkit_dom_test_obj_with_script_state_void_exception(WebKitDOMTestObj* self, GError **error) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); WebCore::ExceptionCode ec = 0; item->withScriptStateVoidException(ec); @@ -314,8 +338,8 @@ webkit_dom_test_obj_with_script_state_void_exception(WebKitDOMTestObj* self, GEr WebKitDOMTestObj* webkit_dom_test_obj_with_script_state_obj_exception(WebKitDOMTestObj* self, GError **error) { - WebCore::JSMainThreadNullState state; 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->withScriptStateObjException(ec)); @@ -331,8 +355,8 @@ webkit_dom_test_obj_with_script_state_obj_exception(WebKitDOMTestObj* self, GErr void webkit_dom_test_obj_with_script_execution_context(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->withScriptExecutionContext(); } @@ -340,8 +364,8 @@ webkit_dom_test_obj_with_script_execution_context(WebKitDOMTestObj* self) void webkit_dom_test_obj_method_with_optional_arg(WebKitDOMTestObj* self, glong opt) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->methodWithOptionalArg(opt); } @@ -349,8 +373,8 @@ webkit_dom_test_obj_method_with_optional_arg(WebKitDOMTestObj* self, glong opt) void webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg(WebKitDOMTestObj* self, glong non_opt, glong opt) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->methodWithNonOptionalArgAndOptionalArg(non_opt, opt); } @@ -358,8 +382,8 @@ webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg(WebKitDOMTestO void webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOMTestObj* self, glong non_opt, glong opt1, glong opt2) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->methodWithNonOptionalArgAndTwoOptionalArgs(non_opt, opt1, opt2); } @@ -367,8 +391,8 @@ webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOM void webkit_dom_test_obj_class_method(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->classMethod(); } @@ -376,8 +400,8 @@ webkit_dom_test_obj_class_method(WebKitDOMTestObj* self) glong webkit_dom_test_obj_class_method_with_optional(WebKitDOMTestObj* self, glong arg) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); glong res = item->classMethodWithOptional(arg); return res; @@ -386,8 +410,8 @@ webkit_dom_test_obj_class_method_with_optional(WebKitDOMTestObj* self, glong arg glong webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); glong res = item->readOnlyIntAttr(); return res; @@ -396,8 +420,8 @@ webkit_dom_test_obj_get_read_only_int_attr(WebKitDOMTestObj* self) gchar* webkit_dom_test_obj_get_read_only_string_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->readOnlyStringAttr()); return res; @@ -406,19 +430,57 @@ webkit_dom_test_obj_get_read_only_string_attr(WebKitDOMTestObj* self) WebKitDOMTestObj* webkit_dom_test_obj_get_read_only_test_obj_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->readOnlyTestObjAttr()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj*>(WebKit::kit(g_res.get())); return res; } +gshort +webkit_dom_test_obj_get_short_attr(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + gshort res = item->shortAttr(); + return res; +} + +void +webkit_dom_test_obj_set_short_attr(WebKitDOMTestObj* self, gshort value) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + item->setShortAttr(value); +} + +gushort +webkit_dom_test_obj_get_unsigned_short_attr(WebKitDOMTestObj* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + gushort res = item->unsignedShortAttr(); + return res; +} + +void +webkit_dom_test_obj_set_unsigned_short_attr(WebKitDOMTestObj* self, gushort value) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestObj * item = WebKit::core(self); + item->setUnsignedShortAttr(value); +} + glong webkit_dom_test_obj_get_int_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); glong res = item->intAttr(); return res; @@ -427,8 +489,8 @@ webkit_dom_test_obj_get_int_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_int_attr(WebKitDOMTestObj* self, glong value) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->setIntAttr(value); } @@ -436,8 +498,8 @@ webkit_dom_test_obj_set_int_attr(WebKitDOMTestObj* self, glong value) gint64 webkit_dom_test_obj_get_long_long_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); gint64 res = item->longLongAttr(); return res; @@ -446,8 +508,8 @@ webkit_dom_test_obj_get_long_long_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_long_long_attr(WebKitDOMTestObj* self, gint64 value) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->setLongLongAttr(value); } @@ -455,8 +517,8 @@ webkit_dom_test_obj_set_long_long_attr(WebKitDOMTestObj* self, gint64 value) guint64 webkit_dom_test_obj_get_unsigned_long_long_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); guint64 res = item->unsignedLongLongAttr(); return res; @@ -465,8 +527,8 @@ webkit_dom_test_obj_get_unsigned_long_long_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_unsigned_long_long_attr(WebKitDOMTestObj* self, guint64 value) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->setUnsignedLongLongAttr(value); } @@ -474,8 +536,8 @@ webkit_dom_test_obj_set_unsigned_long_long_attr(WebKitDOMTestObj* self, guint64 gchar* webkit_dom_test_obj_get_string_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->stringAttr()); return res; @@ -484,8 +546,8 @@ webkit_dom_test_obj_get_string_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_string_attr(WebKitDOMTestObj* self, const gchar* value) { - WebCore::JSMainThreadNullState state; 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); @@ -495,8 +557,8 @@ webkit_dom_test_obj_set_string_attr(WebKitDOMTestObj* self, const gchar* value) WebKitDOMTestObj* webkit_dom_test_obj_get_test_obj_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->testObjAttr()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj*>(WebKit::kit(g_res.get())); @@ -506,8 +568,8 @@ webkit_dom_test_obj_get_test_obj_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); g_return_if_fail(value); WebCore::TestObj * converted_value = NULL; @@ -521,8 +583,8 @@ webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* WebKitDOMTestObj* webkit_dom_test_obj_get_xml_obj_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->xmlObjAttr()); WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj*>(WebKit::kit(g_res.get())); @@ -532,8 +594,8 @@ webkit_dom_test_obj_get_xml_obj_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_xml_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); g_return_if_fail(value); WebCore::TestObj * converted_value = NULL; @@ -547,8 +609,8 @@ webkit_dom_test_obj_set_xml_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* v gboolean webkit_dom_test_obj_get_create(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); gboolean res = item->isCreate(); return res; @@ -557,8 +619,8 @@ webkit_dom_test_obj_get_create(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_create(WebKitDOMTestObj* self, gboolean value) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->setCreate(value); } @@ -566,8 +628,8 @@ webkit_dom_test_obj_set_create(WebKitDOMTestObj* self, gboolean value) gchar* webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr)); return res; @@ -576,8 +638,8 @@ webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, const gchar* value) { - WebCore::JSMainThreadNullState state; 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); @@ -587,8 +649,8 @@ webkit_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, const gcha glong webkit_dom_test_obj_get_reflected_integral_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); glong res = item->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr); return res; @@ -597,8 +659,8 @@ webkit_dom_test_obj_get_reflected_integral_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_reflected_integral_attr(WebKitDOMTestObj* self, glong value) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, value); } @@ -606,8 +668,8 @@ webkit_dom_test_obj_set_reflected_integral_attr(WebKitDOMTestObj* self, glong va gboolean webkit_dom_test_obj_get_reflected_boolean_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); gboolean res = item->hasAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr); return res; @@ -616,8 +678,8 @@ webkit_dom_test_obj_get_reflected_boolean_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_reflected_boolean_attr(WebKitDOMTestObj* self, gboolean value) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, value); } @@ -625,8 +687,8 @@ webkit_dom_test_obj_set_reflected_boolean_attr(WebKitDOMTestObj* self, gboolean gchar* webkit_dom_test_obj_get_reflected_url_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->getURLAttribute(WebCore::HTMLNames::reflectedurlattrAttr)); return res; @@ -635,8 +697,8 @@ webkit_dom_test_obj_get_reflected_url_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_reflected_url_attr(WebKitDOMTestObj* self, const gchar* value) { - WebCore::JSMainThreadNullState state; 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); @@ -646,8 +708,8 @@ 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) { - WebCore::JSMainThreadNullState state; 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; @@ -656,8 +718,8 @@ webkit_dom_test_obj_get_reflected_non_empty_url_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_reflected_non_empty_url_attr(WebKitDOMTestObj* self, const gchar* value) { - WebCore::JSMainThreadNullState state; 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); @@ -667,8 +729,8 @@ webkit_dom_test_obj_set_reflected_non_empty_url_attr(WebKitDOMTestObj* self, con gchar* webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->getAttribute(WebCore::HTMLNames::customContentStringAttrAttr)); return res; @@ -677,8 +739,8 @@ webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, const gchar* value) { - WebCore::JSMainThreadNullState state; 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); @@ -688,8 +750,8 @@ webkit_dom_test_obj_set_reflected_string_attr(WebKitDOMTestObj* self, const gcha glong webkit_dom_test_obj_get_reflected_custom_integral_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); glong res = item->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr); return res; @@ -698,8 +760,8 @@ webkit_dom_test_obj_get_reflected_custom_integral_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_reflected_custom_integral_attr(WebKitDOMTestObj* self, glong value) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->setIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr, value); } @@ -707,8 +769,8 @@ webkit_dom_test_obj_set_reflected_custom_integral_attr(WebKitDOMTestObj* self, g gboolean webkit_dom_test_obj_get_reflected_custom_boolean_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); gboolean res = item->hasAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr); return res; @@ -717,8 +779,8 @@ webkit_dom_test_obj_get_reflected_custom_boolean_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_reflected_custom_boolean_attr(WebKitDOMTestObj* self, gboolean value) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, value); } @@ -726,8 +788,8 @@ webkit_dom_test_obj_set_reflected_custom_boolean_attr(WebKitDOMTestObj* self, gb gchar* webkit_dom_test_obj_get_reflected_custom_url_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->getURLAttribute(WebCore::HTMLNames::customContentURLAttrAttr)); return res; @@ -736,8 +798,8 @@ webkit_dom_test_obj_get_reflected_custom_url_attr(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_reflected_custom_url_attr(WebKitDOMTestObj* self, const gchar* value) { - WebCore::JSMainThreadNullState state; 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); @@ -747,8 +809,8 @@ webkit_dom_test_obj_set_reflected_custom_url_attr(WebKitDOMTestObj* self, const gchar* webkit_dom_test_obj_get_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; 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; @@ -757,8 +819,8 @@ webkit_dom_test_obj_get_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* se void webkit_dom_test_obj_set_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* self, const gchar* value) { - WebCore::JSMainThreadNullState state; 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); @@ -768,8 +830,8 @@ webkit_dom_test_obj_set_reflected_custom_non_empty_url_attr(WebKitDOMTestObj* se glong webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self, GError **error) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); WebCore::ExceptionCode ec = 0; glong res = item->attrWithGetterException(ec); @@ -784,8 +846,8 @@ webkit_dom_test_obj_get_attr_with_getter_exception(WebKitDOMTestObj* self, GErro void webkit_dom_test_obj_set_attr_with_getter_exception(WebKitDOMTestObj* self, glong value, GError **error) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); WebCore::ExceptionCode ec = 0; item->setAttrWithGetterException(value, ec); @@ -799,8 +861,8 @@ webkit_dom_test_obj_set_attr_with_getter_exception(WebKitDOMTestObj* self, glong glong webkit_dom_test_obj_get_attr_with_setter_exception(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); glong res = item->attrWithSetterException(); return res; @@ -809,8 +871,8 @@ webkit_dom_test_obj_get_attr_with_setter_exception(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_attr_with_setter_exception(WebKitDOMTestObj* self, glong value, GError **error) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); WebCore::ExceptionCode ec = 0; item->setAttrWithSetterException(value, ec); @@ -824,8 +886,8 @@ webkit_dom_test_obj_set_attr_with_setter_exception(WebKitDOMTestObj* self, glong gchar* webkit_dom_test_obj_get_string_attr_with_getter_exception(WebKitDOMTestObj* self, GError **error) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); WebCore::ExceptionCode ec = 0; gchar* res = convertToUTF8String(item->stringAttrWithGetterException(ec)); @@ -835,8 +897,8 @@ webkit_dom_test_obj_get_string_attr_with_getter_exception(WebKitDOMTestObj* self void webkit_dom_test_obj_set_string_attr_with_getter_exception(WebKitDOMTestObj* self, const gchar* value, GError **error) { - WebCore::JSMainThreadNullState state; 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); @@ -852,8 +914,8 @@ webkit_dom_test_obj_set_string_attr_with_getter_exception(WebKitDOMTestObj* self gchar* webkit_dom_test_obj_get_string_attr_with_setter_exception(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->stringAttrWithSetterException()); return res; @@ -862,8 +924,8 @@ webkit_dom_test_obj_get_string_attr_with_setter_exception(WebKitDOMTestObj* self void webkit_dom_test_obj_set_string_attr_with_setter_exception(WebKitDOMTestObj* self, const gchar* value, GError **error) { - WebCore::JSMainThreadNullState state; 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); @@ -879,87 +941,93 @@ webkit_dom_test_obj_set_string_attr_with_setter_exception(WebKitDOMTestObj* self gchar* webkit_dom_test_obj_get_script_string_attr(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->scriptStringAttr()); return res; } -#if ENABLE(Condition1) glong webkit_dom_test_obj_get_conditional_attr1(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; +#if ENABLE(Condition1) g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); glong res = item->conditionalAttr1(); return res; -} +#else + return static_cast<glong>(0); #endif /* ENABLE(Condition1) */ +} -#if ENABLE(Condition1) void webkit_dom_test_obj_set_conditional_attr1(WebKitDOMTestObj* self, glong value) { - WebCore::JSMainThreadNullState state; +#if ENABLE(Condition1) g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->setConditionalAttr1(value); -} #endif /* ENABLE(Condition1) */ +} -#if ENABLE(Condition1) && ENABLE(Condition2) glong webkit_dom_test_obj_get_conditional_attr2(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; +#if ENABLE(Condition1) && ENABLE(Condition2) g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); glong res = item->conditionalAttr2(); return res; -} +#else + return static_cast<glong>(0); #endif /* ENABLE(Condition1) && ENABLE(Condition2) */ +} -#if ENABLE(Condition1) && ENABLE(Condition2) void webkit_dom_test_obj_set_conditional_attr2(WebKitDOMTestObj* self, glong value) { - WebCore::JSMainThreadNullState state; +#if ENABLE(Condition1) && ENABLE(Condition2) g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->setConditionalAttr2(value); -} #endif /* ENABLE(Condition1) && ENABLE(Condition2) */ +} -#if ENABLE(Condition1) || ENABLE(Condition2) glong webkit_dom_test_obj_get_conditional_attr3(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; +#if ENABLE(Condition1) || ENABLE(Condition2) g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); glong res = item->conditionalAttr3(); return res; -} +#else + return static_cast<glong>(0); #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ +} -#if ENABLE(Condition1) || ENABLE(Condition2) void webkit_dom_test_obj_set_conditional_attr3(WebKitDOMTestObj* self, glong value) { - WebCore::JSMainThreadNullState state; +#if ENABLE(Condition1) || ENABLE(Condition2) g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->setConditionalAttr3(value); -} #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ +} glong webkit_dom_test_obj_get_description(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); glong res = item->description(); return res; @@ -968,8 +1036,8 @@ webkit_dom_test_obj_get_description(WebKitDOMTestObj* self) glong webkit_dom_test_obj_get_id(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); glong res = item->id(); return res; @@ -978,8 +1046,8 @@ webkit_dom_test_obj_get_id(WebKitDOMTestObj* self) void webkit_dom_test_obj_set_id(WebKitDOMTestObj* self, glong value) { - WebCore::JSMainThreadNullState state; g_return_if_fail(self); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); item->setId(value); } @@ -987,8 +1055,8 @@ webkit_dom_test_obj_set_id(WebKitDOMTestObj* self, glong value) gchar* webkit_dom_test_obj_get_hash(WebKitDOMTestObj* self) { - WebCore::JSMainThreadNullState state; g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; WebCore::TestObj * item = WebKit::core(self); gchar* res = convertToUTF8String(item->hash()); return res; @@ -1015,6 +1083,8 @@ enum { PROP_READ_ONLY_INT_ATTR, PROP_READ_ONLY_STRING_ATTR, PROP_READ_ONLY_TEST_OBJ_ATTR, + PROP_SHORT_ATTR, + PROP_UNSIGNED_SHORT_ATTR, PROP_INT_ATTR, PROP_LONG_LONG_ATTR, PROP_UNSIGNED_LONG_LONG_ATTR, @@ -1075,6 +1145,11 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con WebKitDOMTestObj* self = WEBKIT_DOM_TEST_OBJ(object); WebCore::TestObj* coreSelf = WebKit::core(self); switch (prop_id) { + case PROP_UNSIGNED_SHORT_ATTR: + { + coreSelf->setUnsignedShortAttr((g_value_get_ushort(value))); + break; + } case PROP_INT_ATTR: { coreSelf->setIntAttr((g_value_get_long(value))); @@ -1224,6 +1299,16 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GVa g_value_set_object(value, WebKit::kit(ptr.get())); break; } + case PROP_SHORT_ATTR: + { + g_value_set_int(value, coreSelf->shortAttr()); + break; + } + case PROP_UNSIGNED_SHORT_ATTR: + { + g_value_set_uint(value, coreSelf->unsignedShortAttr()); + break; + } case PROP_INT_ATTR: { g_value_set_long(value, coreSelf->intAttr()); @@ -1420,6 +1505,24 @@ G_MAXLONG, /* max */ WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */ WEBKIT_PARAM_READABLE)); g_object_class_install_property(gobjectClass, + PROP_SHORT_ATTR, + g_param_spec_int("short-attr", /* name */ + "test_obj_short-attr", /* short description */ + "read-write gshort TestObj.short-attr", /* longer - could do with some extra doc stuff here */ + G_MININT, /* min */ +G_MAXINT, /* max */ +0, /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_UNSIGNED_SHORT_ATTR, + g_param_spec_uint("unsigned-short-attr", /* name */ + "test_obj_unsigned-short-attr", /* short description */ + "read-write gushort TestObj.unsigned-short-attr", /* longer - could do with some extra doc stuff here */ + 0, /* min */ +G_MAXUINT16, /* max */ +0, /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, PROP_INT_ATTR, g_param_spec_long("int-attr", /* name */ "test_obj_int-attr", /* short description */ diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h index 8ee8f04..42d1fcd 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h @@ -77,6 +77,9 @@ WEBKIT_API void webkit_dom_test_obj_idb_key(WebKitDOMTestObj* self, WebKitDOMIDBKey* key); WEBKIT_API void +webkit_dom_test_obj_options_object(WebKitDOMTestObj* self, WebKitDOMOptionsObject* oo, WebKitDOMOptionsObject* ooo); + +WEBKIT_API void webkit_dom_test_obj_method_with_exception(WebKitDOMTestObj* self, GError **error); @@ -139,6 +142,18 @@ webkit_dom_test_obj_get_read_only_string_attr(WebKitDOMTestObj* self); WEBKIT_API WebKitDOMTestObj* webkit_dom_test_obj_get_read_only_test_obj_attr(WebKitDOMTestObj* self); +WEBKIT_API gshort +webkit_dom_test_obj_get_short_attr(WebKitDOMTestObj* self); + +WEBKIT_API void +webkit_dom_test_obj_set_short_attr(WebKitDOMTestObj* self, gshort value); + +WEBKIT_API gushort +webkit_dom_test_obj_get_unsigned_short_attr(WebKitDOMTestObj* self); + +WEBKIT_API void +webkit_dom_test_obj_set_unsigned_short_attr(WebKitDOMTestObj* self, gushort value); + WEBKIT_API glong webkit_dom_test_obj_get_int_attr(WebKitDOMTestObj* self); @@ -268,35 +283,23 @@ webkit_dom_test_obj_set_string_attr_with_setter_exception(WebKitDOMTestObj* self WEBKIT_API gchar* webkit_dom_test_obj_get_script_string_attr(WebKitDOMTestObj* self); -#if ENABLE(Condition1) WEBKIT_API glong webkit_dom_test_obj_get_conditional_attr1(WebKitDOMTestObj* self); -#endif /* ENABLE(Condition1) */ -#if ENABLE(Condition1) WEBKIT_API void webkit_dom_test_obj_set_conditional_attr1(WebKitDOMTestObj* self, glong value); -#endif /* ENABLE(Condition1) */ -#if ENABLE(Condition1) && ENABLE(Condition2) WEBKIT_API glong webkit_dom_test_obj_get_conditional_attr2(WebKitDOMTestObj* self); -#endif /* ENABLE(Condition1) && ENABLE(Condition2) */ -#if ENABLE(Condition1) && ENABLE(Condition2) WEBKIT_API void webkit_dom_test_obj_set_conditional_attr2(WebKitDOMTestObj* self, glong value); -#endif /* ENABLE(Condition1) && ENABLE(Condition2) */ -#if ENABLE(Condition1) || ENABLE(Condition2) WEBKIT_API glong webkit_dom_test_obj_get_conditional_attr3(WebKitDOMTestObj* self); -#endif /* ENABLE(Condition1) || ENABLE(Condition2) */ -#if ENABLE(Condition1) || ENABLE(Condition2) WEBKIT_API void webkit_dom_test_obj_set_conditional_attr3(WebKitDOMTestObj* self, glong value); -#endif /* ENABLE(Condition1) || ENABLE(Condition2) */ WEBKIT_API glong webkit_dom_test_obj_get_description(WebKitDOMTestObj* self); diff --git a/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp b/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp index cde9672..e505ed2 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp @@ -23,7 +23,7 @@ #include "ExceptionCode.h" #include "JSDOMBinding.h" -#include "JSMediaQueryListListener.h" +#include "MediaQueryListListener.h" #include "TestMediaQueryListListener.h" #include <runtime/Error.h> #include <wtf/GetPtr.h> @@ -174,7 +174,7 @@ EncodedJSValue JSC_HOST_CALL jsTestMediaQueryListListenerPrototypeFunctionMethod return throwVMTypeError(exec); JSTestMediaQueryListListener* castedThis = static_cast<JSTestMediaQueryListListener*>(asObject(thisValue)); TestMediaQueryListListener* imp = static_cast<TestMediaQueryListListener*>(castedThis->impl()); - MediaQueryListListener* listener = toMediaQueryListListener(exec->argument(0)); + RefPtr<MediaQueryListListener> listener = MediaQueryListListener::create(exec->argument(0)); if (exec->hadException()) return JSValue::encode(jsUndefined()); diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 7e06068..44efde1 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -27,6 +27,7 @@ #include "IDBKey.h" #include "JSDOMBinding.h" #include "JSEventListener.h" +#include "JSOptionsObject.h" #include "JSTestCallback.h" #include "JSTestObj.h" #include "JSlog.h" @@ -54,11 +55,13 @@ ASSERT_CLASS_FITS_IN_CELL(JSTestObj); #define THUNK_GENERATOR(generator) #endif -static const HashTableValue JSTestObjTableValues[34] = +static const HashTableValue JSTestObjTableValues[36] = { { "readOnlyIntAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyIntAttr), (intptr_t)0 THUNK_GENERATOR(0) }, { "readOnlyStringAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyStringAttr), (intptr_t)0 THUNK_GENERATOR(0) }, { "readOnlyTestObjAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyTestObjAttr), (intptr_t)0 THUNK_GENERATOR(0) }, + { "shortAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjShortAttr), (intptr_t)setJSTestObjShortAttr THUNK_GENERATOR(0) }, + { "unsignedShortAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUnsignedShortAttr), (intptr_t)setJSTestObjUnsignedShortAttr THUNK_GENERATOR(0) }, { "intAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjIntAttr), (intptr_t)setJSTestObjIntAttr THUNK_GENERATOR(0) }, { "longLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjLongLongAttr), (intptr_t)setJSTestObjLongLongAttr THUNK_GENERATOR(0) }, { "unsignedLongLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUnsignedLongLongAttr), (intptr_t)setJSTestObjUnsignedLongLongAttr THUNK_GENERATOR(0) }, @@ -99,7 +102,7 @@ static const HashTableValue JSTestObjTableValues[34] = }; #undef THUNK_GENERATOR -static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 132, 127, JSTestObjTableValues, 0 }; +static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 133, 127, JSTestObjTableValues, 0 }; /* Hash table for constructor */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator @@ -179,7 +182,7 @@ bool JSTestObjConstructor::getOwnPropertyDescriptor(ExecState* exec, const Ident #define THUNK_GENERATOR(generator) #endif -static const HashTableValue JSTestObjPrototypeTableValues[47] = +static const HashTableValue JSTestObjPrototypeTableValues[48] = { { "CONST_VALUE_0", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_0), (intptr_t)0 THUNK_GENERATOR(0) }, { "CONST_VALUE_1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_1), (intptr_t)0 THUNK_GENERATOR(0) }, @@ -202,6 +205,7 @@ static const HashTableValue JSTestObjPrototypeTableValues[47] = { "methodThatRequiresAllArgsAndThrows", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows), (intptr_t)2 THUNK_GENERATOR(0) }, { "serializedValue", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionSerializedValue), (intptr_t)1 THUNK_GENERATOR(0) }, { "idbKey", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionIdbKey), (intptr_t)1 THUNK_GENERATOR(0) }, + { "optionsObject", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOptionsObject), (intptr_t)2 THUNK_GENERATOR(0) }, { "methodWithException", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithException), (intptr_t)0 THUNK_GENERATOR(0) }, { "customMethod", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethod), (intptr_t)0 THUNK_GENERATOR(0) }, { "customMethodWithArgs", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) }, @@ -231,7 +235,7 @@ static const HashTableValue JSTestObjPrototypeTableValues[47] = }; #undef THUNK_GENERATOR -static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable = { 135, 127, JSTestObjPrototypeTableValues, 0 }; +static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable = { 136, 127, JSTestObjPrototypeTableValues, 0 }; const ClassInfo JSTestObjPrototype::s_info = { "TestObjPrototype", 0, &JSTestObjPrototypeTable, 0 }; JSObject* JSTestObjPrototype::self(ExecState* exec, JSGlobalObject* globalObject) @@ -282,7 +286,7 @@ JSValue jsTestObjReadOnlyIntAttr(ExecState* exec, JSValue slotBase, const Identi JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsNumber(exec, imp->readOnlyIntAttr()); + JSValue result = jsNumber(imp->readOnlyIntAttr()); return result; } @@ -304,12 +308,30 @@ JSValue jsTestObjReadOnlyTestObjAttr(ExecState* exec, JSValue slotBase, const Id return result; } +JSValue jsTestObjShortAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(imp->shortAttr()); + return result; +} + +JSValue jsTestObjUnsignedShortAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsNumber(imp->unsignedShortAttr()); + return result; +} + JSValue jsTestObjIntAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsNumber(exec, imp->intAttr()); + JSValue result = jsNumber(imp->intAttr()); return result; } @@ -318,7 +340,7 @@ JSValue jsTestObjLongLongAttr(ExecState* exec, JSValue slotBase, const Identifie JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsNumber(exec, imp->longLongAttr()); + JSValue result = jsNumber(imp->longLongAttr()); return result; } @@ -327,7 +349,7 @@ JSValue jsTestObjUnsignedLongLongAttr(ExecState* exec, JSValue slotBase, const I JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsNumber(exec, imp->unsignedLongLongAttr()); + JSValue result = jsNumber(imp->unsignedLongLongAttr()); return result; } @@ -381,7 +403,7 @@ JSValue jsTestObjReflectedIntegralAttr(ExecState* exec, JSValue slotBase, const JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsNumber(exec, imp->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr)); + JSValue result = jsNumber(imp->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr)); return result; } @@ -426,7 +448,7 @@ JSValue jsTestObjReflectedCustomIntegralAttr(ExecState* exec, JSValue slotBase, JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsNumber(exec, imp->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr)); + JSValue result = jsNumber(imp->getIntegralAttribute(WebCore::HTMLNames::customContentIntegralAttrAttr)); return result; } @@ -462,7 +484,7 @@ JSValue jsTestObjAttrWithGetterException(ExecState* exec, JSValue slotBase, cons JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); ExceptionCode ec = 0; TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSC::JSValue result = jsNumber(exec, imp->attrWithGetterException(ec)); + JSC::JSValue result = jsNumber(imp->attrWithGetterException(ec)); setDOMException(exec, ec); return result; } @@ -472,7 +494,7 @@ JSValue jsTestObjAttrWithSetterException(ExecState* exec, JSValue slotBase, cons JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsNumber(exec, imp->attrWithSetterException()); + JSValue result = jsNumber(imp->attrWithSetterException()); return result; } @@ -516,7 +538,7 @@ JSValue jsTestObjConditionalAttr1(ExecState* exec, JSValue slotBase, const Ident JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsNumber(exec, imp->conditionalAttr1()); + JSValue result = jsNumber(imp->conditionalAttr1()); return result; } #endif @@ -527,7 +549,7 @@ JSValue jsTestObjConditionalAttr2(ExecState* exec, JSValue slotBase, const Ident JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsNumber(exec, imp->conditionalAttr2()); + JSValue result = jsNumber(imp->conditionalAttr2()); return result; } #endif @@ -538,7 +560,7 @@ JSValue jsTestObjConditionalAttr3(ExecState* exec, JSValue slotBase, const Ident JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsNumber(exec, imp->conditionalAttr3()); + JSValue result = jsNumber(imp->conditionalAttr3()); return result; } #endif @@ -548,7 +570,7 @@ JSValue jsTestObjDescription(ExecState* exec, JSValue slotBase, const Identifier JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsNumber(exec, imp->description()); + JSValue result = jsNumber(imp->description()); return result; } @@ -557,7 +579,7 @@ JSValue jsTestObjId(ExecState* exec, JSValue slotBase, const Identifier&) JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSValue result = jsNumber(exec, imp->id()); + JSValue result = jsNumber(imp->id()); return result; } @@ -580,6 +602,20 @@ void JSTestObj::put(ExecState* exec, const Identifier& propertyName, JSValue val lookupPut<JSTestObj, Base>(exec, propertyName, value, &JSTestObjTable, this, slot); } +void setJSTestObjShortAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setShortAttr(value.toInt32(exec)); +} + +void setJSTestObjUnsignedShortAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setUnsignedShortAttr(value.toUInt32(exec)); +} + void setJSTestObjIntAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); @@ -821,7 +857,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec TestObj* imp = static_cast<TestObj*>(castedThis->impl()); - JSC::JSValue result = jsNumber(exec, imp->intMethod()); + JSC::JSValue result = jsNumber(imp->intMethod()); return JSValue::encode(result); } @@ -843,7 +879,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecSta return JSValue::encode(jsUndefined()); - JSC::JSValue result = jsNumber(exec, imp->intMethodWithArgs(intArg, strArg, objArg)); + JSC::JSValue result = jsNumber(imp->intMethodWithArgs(intArg, strArg, objArg)); return JSValue::encode(result); } @@ -956,6 +992,31 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIdbKey(ExecState* exec) return JSValue::encode(jsUndefined()); } +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOptionsObject(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + OptionsObject* oo = toOptionsObject(exec->argument(0)); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + + int argsCount = exec->argumentCount(); + if (argsCount <= 1) { + imp->optionsObject(oo); + return JSValue::encode(jsUndefined()); + } + + OptionsObject* ooo = toOptionsObject(exec->argument(1)); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + + imp->optionsObject(oo, ooo); + return JSValue::encode(jsUndefined()); +} + EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); @@ -996,14 +1057,14 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(Ex JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; - OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, 1)); + RefPtr<ScriptArguments> scriptArguments(createScriptArguments(exec, 1)); size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1; - OwnPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize)); + RefPtr<ScriptCallStack> callStack(createScriptCallStack(exec, maxStackSize)); log* intArg = tolog(exec->argument(0)); if (exec->hadException()) return JSValue::encode(jsUndefined()); - imp->customArgsAndException(intArg, scriptArguments.release(), callStack.release(), ec); + imp->customArgsAndException(intArg, scriptArguments, callStack, ec); setDOMException(exec, ec); return JSValue::encode(jsUndefined()); } @@ -1476,7 +1537,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithOptional(E int argsCount = exec->argumentCount(); if (argsCount <= 0) { - JSC::JSValue result = jsNumber(exec, imp->classMethodWithOptional()); + JSC::JSValue result = jsNumber(imp->classMethodWithOptional()); return JSValue::encode(result); } @@ -1485,7 +1546,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithOptional(E return JSValue::encode(jsUndefined()); - JSC::JSValue result = jsNumber(exec, imp->classMethodWithOptional(arg)); + JSC::JSValue result = jsNumber(imp->classMethodWithOptional(arg)); return JSValue::encode(result); } @@ -1493,32 +1554,38 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithOptional(E JSValue jsTestObjCONST_VALUE_0(ExecState* exec, JSValue, const Identifier&) { - return jsNumber(exec, static_cast<int>(0)); + UNUSED_PARAM(exec); + return jsNumber(static_cast<int>(0)); } JSValue jsTestObjCONST_VALUE_1(ExecState* exec, JSValue, const Identifier&) { - return jsNumber(exec, static_cast<int>(1)); + UNUSED_PARAM(exec); + return jsNumber(static_cast<int>(1)); } JSValue jsTestObjCONST_VALUE_2(ExecState* exec, JSValue, const Identifier&) { - return jsNumber(exec, static_cast<int>(2)); + UNUSED_PARAM(exec); + return jsNumber(static_cast<int>(2)); } JSValue jsTestObjCONST_VALUE_4(ExecState* exec, JSValue, const Identifier&) { - return jsNumber(exec, static_cast<int>(4)); + UNUSED_PARAM(exec); + return jsNumber(static_cast<int>(4)); } JSValue jsTestObjCONST_VALUE_8(ExecState* exec, JSValue, const Identifier&) { - return jsNumber(exec, static_cast<int>(8)); + UNUSED_PARAM(exec); + return jsNumber(static_cast<int>(8)); } JSValue jsTestObjCONST_VALUE_9(ExecState* exec, JSValue, const Identifier&) { - return jsNumber(exec, static_cast<int>(-1)); + UNUSED_PARAM(exec); + return jsNumber(static_cast<int>(-1)); } JSValue jsTestObjCONST_VALUE_10(ExecState* exec, JSValue, const Identifier&) @@ -1528,22 +1595,26 @@ JSValue jsTestObjCONST_VALUE_10(ExecState* exec, JSValue, const Identifier&) JSValue jsTestObjCONST_VALUE_11(ExecState* exec, JSValue, const Identifier&) { - return jsNumber(exec, static_cast<int>(0xffffffff)); + UNUSED_PARAM(exec); + return jsNumber(static_cast<int>(0xffffffff)); } JSValue jsTestObjCONST_VALUE_12(ExecState* exec, JSValue, const Identifier&) { - return jsNumber(exec, static_cast<int>(0x01)); + UNUSED_PARAM(exec); + return jsNumber(static_cast<int>(0x01)); } JSValue jsTestObjCONST_VALUE_13(ExecState* exec, JSValue, const Identifier&) { - return jsNumber(exec, static_cast<int>(0X20)); + UNUSED_PARAM(exec); + return jsNumber(static_cast<int>(0X20)); } JSValue jsTestObjCONST_VALUE_14(ExecState* exec, JSValue, const Identifier&) { - return jsNumber(exec, static_cast<int>(0x1abc)); + UNUSED_PARAM(exec); + return jsNumber(static_cast<int>(0x1abc)); } JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestObj* object) diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.h b/WebCore/bindings/scripts/test/JS/JSTestObj.h index 2168b3f..c27444a 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.h +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.h @@ -96,6 +96,7 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAl JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIdbKey(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOptionsObject(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(JSC::ExecState*); @@ -126,6 +127,10 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithOptio JSC::JSValue jsTestObjReadOnlyIntAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); JSC::JSValue jsTestObjReadOnlyStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); JSC::JSValue jsTestObjReadOnlyTestObjAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestObjShortAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjShortAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjUnsignedShortAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjUnsignedShortAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjIntAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjIntAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjLongLongAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h index 1ad29cb..766d31f 100644 --- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h @@ -29,6 +29,7 @@ #if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST @class DOMIDBKey; +@class DOMOptionsObject; @class DOMTestObj; @class DOMlog; @class NSString; @@ -52,6 +53,10 @@ enum { - (int)readOnlyIntAttr; - (NSString *)readOnlyStringAttr; - (DOMTestObj *)readOnlyTestObjAttr; +- (short)shortAttr; +- (void)setShortAttr:(short)newShortAttr; +- (unsigned short)unsignedShortAttr; +- (void)setUnsignedShortAttr:(unsigned short)newUnsignedShortAttr; - (int)intAttr; - (void)setIntAttr:(int)newIntAttr; - (long long)longLongAttr; @@ -123,6 +128,7 @@ enum { - (DOMTestObj *)methodThatRequiresAllArgsAndThrows:(NSString *)strArg objArg:(DOMTestObj *)objArg; - (void)serializedValue:(NSString *)serializedArg; - (void)idbKey:(DOMIDBKey *)key; +- (void)optionsObject:(DOMOptionsObject *)oo ooo:(DOMOptionsObject *)ooo; - (void)methodWithException; - (void)customMethod; - (void)customMethodWithArgs:(int)intArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg; diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm index 6788075..ac04235 100644 --- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm @@ -35,6 +35,7 @@ #import "DOMEventInternal.h" #import "DOMIDBKeyInternal.h" #import "DOMNodeInternal.h" +#import "DOMOptionsObjectInternal.h" #import "DOMStyleSheetInternal.h" #import "DOMTestObjInternal.h" #import "DOMlogInternal.h" @@ -45,6 +46,7 @@ #import "JSMainThreadExecState.h" #import "KURL.h" #import "ObjCEventListener.h" +#import "OptionsObject.h" #import "SerializedScriptValue.h" #import "TestObj.h" #import "ThreadCheck.h" @@ -92,6 +94,30 @@ return kit(WTF::getPtr(IMPL->readOnlyTestObjAttr())); } +- (short)shortAttr +{ + WebCore::JSMainThreadNullState state; + return IMPL->shortAttr(); +} + +- (void)setShortAttr:(short)newShortAttr +{ + WebCore::JSMainThreadNullState state; + IMPL->setShortAttr(newShortAttr); +} + +- (unsigned short)unsignedShortAttr +{ + WebCore::JSMainThreadNullState state; + return IMPL->unsignedShortAttr(); +} + +- (void)setUnsignedShortAttr:(unsigned short)newUnsignedShortAttr +{ + WebCore::JSMainThreadNullState state; + IMPL->setUnsignedShortAttr(newUnsignedShortAttr); +} + - (int)intAttr { WebCore::JSMainThreadNullState state; @@ -509,6 +535,12 @@ IMPL->idbKey(core(key)); } +- (void)optionsObject:(DOMOptionsObject *)oo ooo:(DOMOptionsObject *)ooo +{ + WebCore::JSMainThreadNullState state; + IMPL->optionsObject(core(oo), core(ooo)); +} + - (void)methodWithException { WebCore::JSMainThreadNullState state; diff --git a/WebCore/bindings/scripts/test/TestObj.idl b/WebCore/bindings/scripts/test/TestObj.idl index 22ed680..c0d0e88 100644 --- a/WebCore/bindings/scripts/test/TestObj.idl +++ b/WebCore/bindings/scripts/test/TestObj.idl @@ -35,6 +35,8 @@ module test { readonly attribute long readOnlyIntAttr; readonly attribute DOMString readOnlyStringAttr; readonly attribute TestObj readOnlyTestObjAttr; + attribute short shortAttr; + attribute unsigned short unsignedShortAttr; attribute long intAttr; attribute long long longLongAttr; attribute unsigned long long unsignedLongLongAttr; @@ -72,6 +74,7 @@ module test { void serializedValue(in SerializedScriptValue serializedArg); void idbKey(in IDBKey key); + void optionsObject(in OptionsObject oo, in [Optional] OptionsObject ooo); // Exceptions void methodWithException() raises(DOMException); diff --git a/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp b/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp index 1f78f39..ab9e6db 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp +++ b/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp @@ -22,13 +22,13 @@ #include "V8TestMediaQueryListListener.h" #include "ExceptionCode.h" +#include "MediaQueryListListener.h" #include "RuntimeEnabledFeatures.h" #include "V8Binding.h" #include "V8BindingMacros.h" #include "V8BindingState.h" #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" -#include "V8MediaQueryListListener.h" #include "V8Proxy.h" namespace WebCore { @@ -43,28 +43,25 @@ static v8::Handle<v8::Value> methodCallback(const v8::Arguments& args) { INC_STATS("DOM.TestMediaQueryListListener.method"); TestMediaQueryListListener* imp = V8TestMediaQueryListListener::toNative(args.Holder()); - EXCEPTION_BLOCK(MediaQueryListListener*, listener, V8MediaQueryListListener::HasInstance(args[0]) ? V8MediaQueryListListener::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); + EXCEPTION_BLOCK(RefPtr<MediaQueryListListener>, listener, MediaQueryListListener::create(args[0])); imp->method(listener); return v8::Handle<v8::Value>(); } } // namespace TestMediaQueryListListenerInternal +static const BatchedCallback TestMediaQueryListListenerCallbacks[] = { + {"method", TestMediaQueryListListenerInternal::methodCallback}, +}; static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestMediaQueryListListenerTemplate(v8::Persistent<v8::FunctionTemplate> desc) { v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "TestMediaQueryListListener", v8::Persistent<v8::FunctionTemplate>(), V8TestMediaQueryListListener::internalFieldCount, 0, 0, - 0, 0); + TestMediaQueryListListenerCallbacks, WTF_ARRAY_LENGTH(TestMediaQueryListListenerCallbacks)); v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); - // Custom Signature 'method' - const int methodArgc = 1; - v8::Handle<v8::FunctionTemplate> methodArgv[methodArgc] = { V8MediaQueryListListener::GetRawTemplate() }; - v8::Handle<v8::Signature> methodSignature = v8::Signature::New(desc, methodArgc, methodArgv); - proto->Set(v8::String::New("method"), v8::FunctionTemplate::New(TestMediaQueryListListenerInternal::methodCallback, v8::Handle<v8::Value>(), methodSignature)); - // Custom toString template desc->Set(getToStringName(), getToStringTemplate()); return desc; diff --git a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index 4c921bb..d4fdff5 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -25,6 +25,7 @@ #include "HTMLNames.h" #include "IDBBindingUtilities.h" #include "IDBKey.h" +#include "OptionsObject.h" #include "RuntimeEnabledFeatures.h" #include "ScriptArguments.h" #include "ScriptCallStack.h" @@ -79,6 +80,38 @@ static v8::Handle<v8::Value> readOnlyTestObjAttrAttrGetter(v8::Local<v8::String> return wrapper; } +static v8::Handle<v8::Value> shortAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.shortAttr._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8::Integer::New(imp->shortAttr()); +} + +static void shortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.shortAttr._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + int v = toInt32(value); + imp->setShortAttr(v); + return; +} + +static v8::Handle<v8::Value> unsignedShortAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.unsignedShortAttr._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8::Integer::New(imp->unsignedShortAttr()); +} + +static void unsignedShortAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.unsignedShortAttr._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + int v = toUInt32(value); + imp->setUnsignedShortAttr(v); + return; +} + static v8::Handle<v8::Value> intAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.intAttr._get"); @@ -695,6 +728,20 @@ static v8::Handle<v8::Value> idbKeyCallback(const v8::Arguments& args) return v8::Handle<v8::Value>(); } +static v8::Handle<v8::Value> optionsObjectCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.optionsObject"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + EXCEPTION_BLOCK(OptionsObject, oo, args[0]); + if (args.Length() <= 1) { + imp->optionsObject(oo); + return v8::Handle<v8::Value>(); + } + EXCEPTION_BLOCK(OptionsObject, ooo, args[1]); + imp->optionsObject(oo, ooo); + return v8::Handle<v8::Value>(); +} + static v8::Handle<v8::Value> methodWithExceptionCallback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.methodWithException"); @@ -717,13 +764,13 @@ static v8::Handle<v8::Value> customArgsAndExceptionCallback(const v8::Arguments& TestObj* imp = V8TestObj::toNative(args.Holder()); ExceptionCode ec = 0; { - OwnPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1)); + RefPtr<ScriptArguments> scriptArguments(createScriptArguments(args, 1)); size_t maxStackSize = imp->shouldCaptureFullStackTrace() ? ScriptCallStack::maxCallStackSizeToCapture : 1; - OwnPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize)); + RefPtr<ScriptCallStack> callStack(createScriptCallStack(maxStackSize)); if (!callStack) return v8::Undefined(); EXCEPTION_BLOCK(log*, intArg, V8log::HasInstance(args[0]) ? V8log::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); - imp->customArgsAndException(intArg, scriptArguments.release(), callStack.release(), ec); + imp->customArgsAndException(intArg, scriptArguments, callStack, ec); if (UNLIKELY(ec)) goto fail; return v8::Handle<v8::Value>(); @@ -1094,6 +1141,10 @@ static const BatchedAttribute TestObjAttrs[] = { {"readOnlyStringAttr", TestObjInternal::readOnlyStringAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'readOnlyTestObjAttr' (Type: 'readonly attribute' ExtAttr: '') {"readOnlyTestObjAttr", TestObjInternal::readOnlyTestObjAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'shortAttr' (Type: 'attribute' ExtAttr: '') + {"shortAttr", TestObjInternal::shortAttrAttrGetter, TestObjInternal::shortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'unsignedShortAttr' (Type: 'attribute' ExtAttr: '') + {"unsignedShortAttr", TestObjInternal::unsignedShortAttrAttrGetter, TestObjInternal::unsignedShortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'intAttr' (Type: 'attribute' ExtAttr: '') {"intAttr", TestObjInternal::intAttrAttrGetter, TestObjInternal::intAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'longLongAttr' (Type: 'attribute' ExtAttr: '') @@ -1165,6 +1216,7 @@ static const BatchedCallback TestObjCallbacks[] = { {"objMethod", TestObjInternal::objMethodCallback}, {"serializedValue", TestObjInternal::serializedValueCallback}, {"idbKey", TestObjInternal::idbKeyCallback}, + {"optionsObject", TestObjInternal::optionsObjectCallback}, {"methodWithException", TestObjInternal::methodWithExceptionCallback}, {"customMethod", V8TestObj::customMethodCallback}, {"customMethodWithArgs", V8TestObj::customMethodWithArgsCallback}, @@ -1217,8 +1269,8 @@ COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWro static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persistent<v8::FunctionTemplate> desc) { v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "TestObj", v8::Persistent<v8::FunctionTemplate>(), V8TestObj::internalFieldCount, - TestObjAttrs, sizeof(TestObjAttrs) / sizeof(*TestObjAttrs), - TestObjCallbacks, sizeof(TestObjCallbacks) / sizeof(*TestObjCallbacks)); + TestObjAttrs, WTF_ARRAY_LENGTH(TestObjAttrs), + TestObjCallbacks, WTF_ARRAY_LENGTH(TestObjCallbacks)); v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); @@ -1276,7 +1328,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persi proto->Set(v8::String::New("enabledAtRuntimeMethod1"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod1Callback, v8::Handle<v8::Value>(), defaultSignature)); if (RuntimeEnabledFeatures::featureNameEnabled()) proto->Set(v8::String::New("enabledAtRuntimeMethod2"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod2Callback, v8::Handle<v8::Value>(), defaultSignature)); - batchConfigureConstants(desc, proto, TestObjConsts, sizeof(TestObjConsts) / sizeof(*TestObjConsts)); + batchConfigureConstants(desc, proto, TestObjConsts, WTF_ARRAY_LENGTH(TestObjConsts)); // Custom toString template desc->Set(getToStringName(), getToStringTemplate()); |