Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (99792 => 99793)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2011-11-10 01:33:32 UTC (rev 99792)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2011-11-10 01:41:24 UTC (rev 99793)
@@ -3191,7 +3191,7 @@
my $dataNode = shift;
my $constructorClassName = "${className}Constructor";
- my $canConstruct = $dataNode->extendedAttributes->{"CanBeConstructed"} || $dataNode->extendedAttributes->{"Constructor"} || $dataNode->extendedAttributes->{"JSCustomConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"};
+ my $canConstruct = $dataNode->extendedAttributes->{"Constructor"} || $dataNode->extendedAttributes->{"JSCustomConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"};
my $callWith = $dataNode->extendedAttributes->{"CallWith"};
push(@$outputArray, "class ${constructorClassName} : public DOMConstructorObject {\n");
@@ -3269,67 +3269,56 @@
push(@$outputArray, " return getStaticValueDescriptor<${constructorClassName}, JSDOMWrapper>(exec, &${constructorClassName}Table, static_cast<${constructorClassName}*>(object), propertyName, descriptor);\n");
push(@$outputArray, "}\n\n");
- if ($dataNode->extendedAttributes->{"CanBeConstructed"} || $dataNode->extendedAttributes->{"Constructor"} || $dataNode->extendedAttributes->{"JSCustomConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"}) {
+ if ($dataNode->extendedAttributes->{"Constructor"} || $dataNode->extendedAttributes->{"JSCustomConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"}) {
if (!($dataNode->extendedAttributes->{"JSCustomConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) {
push(@$outputArray, "EncodedJSValue JSC_HOST_CALL ${constructorClassName}::construct${className}(ExecState* exec)\n");
push(@$outputArray, "{\n");
push(@$outputArray, " ${constructorClassName}* jsConstructor = static_cast<${constructorClassName}*>(exec->callee());\n");
- if ($dataNode->extendedAttributes->{"Constructor"}) {
- my $function = $dataNode->constructor;
- my @constructorArgList;
+ my $function = $dataNode->constructor;
+ my @constructorArgList;
- $implIncludes{"<runtime/Error.h>"} = 1;
+ $implIncludes{"<runtime/Error.h>"} = 1;
- GenerateArgumentsCountCheck($outputArray, $function, $dataNode);
+ GenerateArgumentsCountCheck($outputArray, $function, $dataNode);
- if (@{$function->raisesExceptions} || $dataNode->extendedAttributes->{"ConstructorRaisesException"}) {
- $implIncludes{"ExceptionCode.h"} = 1;
- push(@$outputArray, " ExceptionCode ec = 0;\n");
- }
+ if (@{$function->raisesExceptions} || $dataNode->extendedAttributes->{"ConstructorRaisesException"}) {
+ $implIncludes{"ExceptionCode.h"} = 1;
+ push(@$outputArray, " ExceptionCode ec = 0;\n");
+ }
- # For now, we do not support SVG constructors.
- # We do not also support a constructor [Optional] argument without CallWithDefaultValue
- # nor CallWithNullValue.
- my $numParameters = @{$function->parameters};
- my ($dummy, $paramIndex) = GenerateParametersCheck($outputArray, $function, $dataNode, $numParameters, $interfaceName, "constructorCallback", undef, undef, undef);
+ # For now, we do not support SVG constructors.
+ # We do not also support a constructor [Optional] argument without CallWithDefaultValue
+ # nor CallWithNullValue.
+ my $numParameters = @{$function->parameters};
+ my ($dummy, $paramIndex) = GenerateParametersCheck($outputArray, $function, $dataNode, $numParameters, $interfaceName, "constructorCallback", undef, undef, undef);
- if ($dataNode->extendedAttributes->{"CallWith"} && $dataNode->extendedAttributes->{"CallWith"} eq "ScriptExecutionContext") {
- push(@constructorArgList, "context");
- push(@$outputArray, " ScriptExecutionContext* context = jsConstructor->scriptExecutionContext();\n");
- push(@$outputArray, " if (!context)\n");
- push(@$outputArray, " return throwVMError(exec, createReferenceError(exec, \"${interfaceName} constructor associated document is unavailable\"));\n");
- }
+ if ($dataNode->extendedAttributes->{"CallWith"} && $dataNode->extendedAttributes->{"CallWith"} eq "ScriptExecutionContext") {
+ push(@constructorArgList, "context");
+ push(@$outputArray, " ScriptExecutionContext* context = jsConstructor->scriptExecutionContext();\n");
+ push(@$outputArray, " if (!context)\n");
+ push(@$outputArray, " return throwVMError(exec, createReferenceError(exec, \"${interfaceName} constructor associated document is unavailable\"));\n");
+ }
- my $index = 0;
- foreach my $parameter (@{$function->parameters}) {
- last if $index eq $paramIndex;
- push(@constructorArgList, $parameter->name);
- $index++;
- }
+ my $index = 0;
+ foreach my $parameter (@{$function->parameters}) {
+ last if $index eq $paramIndex;
+ push(@constructorArgList, $parameter->name);
+ $index++;
+ }
- if ($dataNode->extendedAttributes->{"ConstructorRaisesException"}) {
- push(@constructorArgList, "ec");
- }
- my $constructorArg = join(", ", @constructorArgList);
- push(@$outputArray, " RefPtr<${interfaceName}> object = ${interfaceName}::create(${constructorArg});\n");
- if ($dataNode->extendedAttributes->{"ConstructorRaisesException"}) {
- push(@$outputArray, " if (ec) {\n");
- push(@$outputArray, " setDOMException(exec, ec);\n");
- push(@$outputArray, " return JSValue::encode(JSValue());\n");
- push(@$outputArray, " }\n");
- }
- } else {
- my $constructorArg = "";
- if ($dataNode->extendedAttributes->{"CallWith"} and $dataNode->extendedAttributes->{"CallWith"} eq "ScriptExecutionContext") {
- $constructorArg = "context";
- push(@$outputArray, " ScriptExecutionContext* context = static_cast<${constructorClassName}*>(exec->callee())->scriptExecutionContext();\n");
- push(@$outputArray, " if (!context)\n");
- push(@$outputArray, " return throwVMError(exec, createReferenceError(exec, \"${interfaceName} constructor associated document is unavailable\"));\n");
- }
- push(@$outputArray, " RefPtr<${interfaceName}> object = ${interfaceName}::create(${constructorArg});\n");
+ if ($dataNode->extendedAttributes->{"ConstructorRaisesException"}) {
+ push(@constructorArgList, "ec");
}
+ my $constructorArg = join(", ", @constructorArgList);
+ push(@$outputArray, " RefPtr<${interfaceName}> object = ${interfaceName}::create(${constructorArg});\n");
+ if ($dataNode->extendedAttributes->{"ConstructorRaisesException"}) {
+ push(@$outputArray, " if (ec) {\n");
+ push(@$outputArray, " setDOMException(exec, ec);\n");
+ push(@$outputArray, " return JSValue::encode(JSValue());\n");
+ push(@$outputArray, " }\n");
+ }
push(@$outputArray, " return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), object.get())));\n");
push(@$outputArray, "}\n\n");
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (99792 => 99793)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2011-11-10 01:33:32 UTC (rev 99792)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2011-11-10 01:41:24 UTC (rev 99793)
@@ -393,7 +393,7 @@
}
}
- if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"} || $dataNode->extendedAttributes->{"Constructor"}) {
+ if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"Constructor"}) {
push(@headerContent, <<END);
static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&);
END
@@ -2286,26 +2286,9 @@
push(@implContentDecls, "} // namespace ${interfaceName}Internal\n\n");
- # In namespace WebCore, add generated implementation for 'CanBeConstructed'.
- if ($dataNode->extendedAttributes->{"CanBeConstructed"} && !$dataNode->extendedAttributes->{"CustomConstructor"} && !$dataNode->extendedAttributes->{"V8CustomConstructor"} && !$dataNode->extendedAttributes->{"Constructor"}) {
- my $v8ConstructFunction;
- my $callWith = $dataNode->extendedAttributes->{"CallWith"};
- if ($callWith and $callWith eq "ScriptExecutionContext") {
- $v8ConstructFunction = "constructDOMObjectWithScriptExecutionContext";
- } else {
- $v8ConstructFunction = "constructDOMObject";
- }
- push(@implContent, <<END);
-v8::Handle<v8::Value> ${className}::constructorCallback(const v8::Arguments& args)
-{
- INC_STATS("DOM.${interfaceName}.Contructor");
- return V8Proxy::${v8ConstructFunction}<$interfaceName>(args, &info);
-}
-
-END
- } elsif ($dataNode->extendedAttributes->{"NamedConstructor"} && !($dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) {
+ if ($dataNode->extendedAttributes->{"NamedConstructor"} && !($dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) {
GenerateNamedConstructorCallback($dataNode->constructor, $dataNode, $interfaceName);
- } elsif (($dataNode->extendedAttributes->{"CanBeConstructed"} || $dataNode->extendedAttributes->{"Constructor"}) && !($dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) {
+ } elsif ($dataNode->extendedAttributes->{"Constructor"} && !($dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) {
GenerateConstructorCallback($dataNode->constructor, $dataNode, $interfaceName);
}
@@ -2379,7 +2362,7 @@
UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
END
- if ($dataNode->extendedAttributes->{"CanBeConstructed"} || $dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"Constructor"}) {
+ if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"Constructor"}) {
push(@implContent, <<END);
desc->SetCallHandler(V8${interfaceName}::constructorCallback);
END
Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.h (99792 => 99793)
--- trunk/Source/WebCore/bindings/v8/V8Proxy.h 2011-11-10 01:33:32 UTC (rev 99792)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.h 2011-11-10 01:41:24 UTC (rev 99793)
@@ -251,12 +251,6 @@
static v8::Handle<v8::Value> throwTypeError();
static v8::Handle<v8::Value> throwSyntaxError();
- template <typename T>
- static v8::Handle<v8::Value> constructDOMObject(const v8::Arguments&, WrapperTypeInfo*);
-
- template <typename T>
- static v8::Handle<v8::Value> constructDOMObjectWithScriptExecutionContext(const v8::Arguments&, WrapperTypeInfo*);
-
v8::Local<v8::Context> context();
v8::Local<v8::Context> mainWorldContext();
@@ -337,41 +331,6 @@
IsolatedWorldSecurityOriginMap m_isolatedWorldSecurityOrigins;
};
- template <typename T>
- v8::Handle<v8::Value> V8Proxy::constructDOMObject(const v8::Arguments& args, WrapperTypeInfo* type)
- {
- if (!args.IsConstructCall())
- return throwError(V8Proxy::TypeError, "DOM object constructor cannot be called as a function.");
-
- // Note: it's OK to let this RefPtr go out of scope because we also call
- // SetDOMWrapper(), which effectively holds a reference to obj.
- RefPtr<T> obj = T::create();
- V8DOMWrapper::setDOMWrapper(args.Holder(), type, obj.get());
- obj->ref();
- V8DOMWrapper::setJSWrapperForDOMObject(obj.get(), v8::Persistent<v8::Object>::New(args.Holder()));
- return args.Holder();
- }
-
- template <typename T>
- v8::Handle<v8::Value> V8Proxy::constructDOMObjectWithScriptExecutionContext(const v8::Arguments& args, WrapperTypeInfo* type)
- {
- if (!args.IsConstructCall())
- return throwError(V8Proxy::TypeError, "");
-
- ScriptExecutionContext* context = getScriptExecutionContext();
- if (!context)
- return throwError(V8Proxy::ReferenceError, "");
-
- // Note: it's OK to let this RefPtr go out of scope because we also call
- // SetDOMWrapper(), which effectively holds a reference to obj.
- RefPtr<T> obj = T::create(context);
- V8DOMWrapper::setDOMWrapper(args.Holder(), type, obj.get());
- obj->ref();
- V8DOMWrapper::setJSWrapperForDOMObject(obj.get(), v8::Persistent<v8::Object>::New(args.Holder()));
- return args.Holder();
- }
-
-
v8::Local<v8::Context> toV8Context(ScriptExecutionContext*, const WorldContextHandle& worldContext);
// Used by an interceptor callback that it hasn't found anything to