Diff
Modified: trunk/Source/WebCore/ChangeLog (212688 => 212689)
--- trunk/Source/WebCore/ChangeLog 2017-02-21 01:22:31 UTC (rev 212688)
+++ trunk/Source/WebCore/ChangeLog 2017-02-21 01:44:42 UTC (rev 212689)
@@ -1,3 +1,40 @@
+2017-02-20 Sam Weinig <s...@webkit.org>
+
+ [WebIDL] Add support for constructors that have variadic parameters
+ https://bugs.webkit.org/show_bug.cgi?id=168614
+
+ Reviewed by Alex Christensen.
+
+ In preparation of removing some more custom bindings, move the constructor calling
+ code over to using GenerateParametersCheck completely. This required
+ - Removing special case of NamedConstructors automatically getting a Document passed
+ to them. The three named constructors that expected this have been updated to add
+ the required attributes.
+ - Add a version of the GenerateCallWith prologue for constructors.
+ - Remove now unnecessary argumentCount return value from GenerateParametersCheck.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateImplementation):
+ (GenerateCallWithUsingReferences):
+ (GenerateCallWithUsingPointers):
+ (GenerateConstructorCallWithUsingPointers):
+ (GenerateCallWith):
+ (GenerateParametersCheck):
+ (GenerateConstructorDefinition):
+
+ * bindings/scripts/test/JS/JSTestInterface.cpp:
+ * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
+ Update results for more consistent placement of ScriptExecutionContext and Document
+ accessors, add UNLIKELY to context checks, and remove automatic Document passing
+ for NamedConstructors.
+
+ * html/HTMLAudioElement.idl:
+ * html/HTMLImageElement.idl:
+ * html/HTMLOptionElement.idl:
+ Add ConstructorCallWith=Document.
+
2017-02-20 John Wilander <wilan...@apple.com>
Resource Load Statistics: Add alternate classification method
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (212688 => 212689)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2017-02-21 01:22:31 UTC (rev 212688)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2017-02-21 01:44:42 UTC (rev 212689)
@@ -4034,7 +4034,7 @@
GenerateArgumentsCountCheck(\@implContent, $function, $interface);
- my ($functionString, $dummy) = GenerateParametersCheck(\@implContent, $function, $interface, $functionImplementationName);
+ my $functionString = GenerateParametersCheck(\@implContent, $function, $interface, $functionImplementationName);
GenerateImplementationFunctionCall($function, $functionString, " ", $interface);
}
} else {
@@ -4084,7 +4084,7 @@
GenerateArgumentsCountCheck(\@implContent, $function, $interface);
- my ($functionString, $dummy) = GenerateParametersCheck(\@implContent, $function, $interface, $functionImplementationName);
+ my $functionString = GenerateParametersCheck(\@implContent, $function, $interface, $functionImplementationName);
GenerateImplementationFunctionCall($function, $functionString, " ", $interface);
}
}
@@ -4481,7 +4481,7 @@
my $stateReference = "state";
my $globalObject = "jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())";
- return GenerateCallWith($callWith, $outputArray, $returnValue, $function, $statePointer, $stateReference, $globalObject);
+ return GenerateCallWith($callWith, $outputArray, $returnValue, $returnValue, $function, $statePointer, $stateReference, $globalObject, $globalObject);
}
# FIXME: We should remove GenerateCallWithUsingPointers and combine GenerateCallWithUsingReferences and GenerateCallWith
@@ -4493,12 +4493,25 @@
my $stateReference = "*state";
my $globalObject = "jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())";
- return GenerateCallWith($callWith, $outputArray, $returnValue, $function, $statePointer, $stateReference, $globalObject);
+ return GenerateCallWith($callWith, $outputArray, $returnValue, $returnValue, $function, $statePointer, $stateReference, $globalObject, $globalObject);
}
+sub GenerateConstructorCallWithUsingPointers
+{
+ my ($callWith, $outputArray, $visibleInterfaceName, $function) = @_;
+
+ my $statePointer = "state";
+ my $stateReference = "*state";
+ my $globalObject = "castedThis->globalObject()";
+ my $contextMissing = "throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, \"${visibleInterfaceName}\")";
+ my $scriptExecutionContextAccessor = "castedThis";
+
+ return GenerateCallWith($callWith, $outputArray, "", $contextMissing, $function, $statePointer, $stateReference, $globalObject, $scriptExecutionContextAccessor);
+}
+
sub GenerateCallWith
{
- my ($callWith, $outputArray, $returnValue, $function, $statePointer, $stateReference, $globalObject) = @_;
+ my ($callWith, $outputArray, $returnValue, $contextMissing, $function, $statePointer, $stateReference, $globalObject, $scriptExecutionContextAccessor) = @_;
return () unless $callWith;
@@ -4506,16 +4519,16 @@
push(@callWithArgs, $stateReference) if $codeGenerator->ExtendedAttributeContains($callWith, "ScriptState");
push(@callWithArgs, "*${globalObject}") if $codeGenerator->ExtendedAttributeContains($callWith, "GlobalObject");
if ($codeGenerator->ExtendedAttributeContains($callWith, "ScriptExecutionContext")) {
- push(@$outputArray, " auto* context = $globalObject->scriptExecutionContext();\n");
- push(@$outputArray, " if (!context)\n");
- push(@$outputArray, " return" . ($returnValue ? " " . $returnValue : "") . ";\n");
+ push(@$outputArray, " auto* context = ${scriptExecutionContextAccessor}->scriptExecutionContext();\n");
+ push(@$outputArray, " if (UNLIKELY(!context))\n");
+ push(@$outputArray, " return" . ($contextMissing ? " " . $contextMissing : "") . ";\n");
push(@callWithArgs, "*context");
}
if ($codeGenerator->ExtendedAttributeContains($callWith, "Document")) {
$implIncludes{"Document.h"} = 1;
- push(@$outputArray, " auto* context = $globalObject->scriptExecutionContext();\n");
- push(@$outputArray, " if (!context)\n");
- push(@$outputArray, " return" . ($returnValue ? " " . $returnValue : "") . ";\n");
+ push(@$outputArray, " auto* context = ${scriptExecutionContextAccessor}->scriptExecutionContext();\n");
+ push(@$outputArray, " if (UNLIKELY(!context))\n");
+ push(@$outputArray, " return" . ($contextMissing ? " " . $contextMissing : "") . ";\n");
push(@$outputArray, " ASSERT(context->isDocument());\n");
push(@$outputArray, " auto& document = downcast<Document>(*context);\n");
push(@callWithArgs, "document");
@@ -4537,17 +4550,14 @@
if ($codeGenerator->ExtendedAttributeContains($callWith, "ActiveWindow")) {
$implIncludes{"JSDOMWindowBase.h"} = 1;
push(@callWithArgs, "activeDOMWindow($statePointer)");
-
}
if ($codeGenerator->ExtendedAttributeContains($callWith, "FirstWindow")) {
$implIncludes{"JSDOMWindowBase.h"} = 1;
push(@callWithArgs, "firstDOMWindow($statePointer)");
-
}
if ($codeGenerator->ExtendedAttributeContains($callWith, "CallerWindow")) {
$implIncludes{"JSDOMWindowBase.h"} = 1;
push(@callWithArgs, "callerDOMWindow($statePointer)");
-
}
return @callWithArgs;
@@ -4632,17 +4642,19 @@
my $interfaceName = $interface->type->name;
my $visibleInterfaceName = $codeGenerator->GetVisibleInterfaceName($interface);
- my @arguments;
- my $functionName;
my $implementedBy = $function->extendedAttributes->{ImplementedBy};
my $numArguments = @{$function->arguments};
my $conditional = $function->extendedAttributes->{Conditional};
+ my $isConstructor = $function->extendedAttributes->{Constructor} || $function->extendedAttributes->{NamedConstructor};
+ my @arguments;
+ my $functionName;
+
if ($implementedBy) {
AddToImplIncludes("${implementedBy}.h", $conditional);
unshift(@arguments, "impl") if !$function->isStatic;
$functionName = "WebCore::${implementedBy}::${functionImplementationName}";
- } elsif ($function->isStatic) {
+ } elsif ($function->isStatic || $isConstructor) {
$functionName = "${interfaceName}::${functionImplementationName}";
} else {
$functionName = "impl.${functionImplementationName}";
@@ -4649,12 +4661,13 @@
}
my $quotedFunctionName;
- if (!$function->extendedAttributes->{Constructor}) {
+ if (!$isConstructor) {
my $name = $function->name;
$quotedFunctionName = "\"$name\"";
push(@arguments, GenerateCallWithUsingPointers($function->extendedAttributes->{CallWith}, \@$outputArray, "JSValue::encode(jsUndefined())", $function));
} else {
$quotedFunctionName = "nullptr";
+ push(@arguments, GenerateConstructorCallWithUsingPointers($function->extendedAttributes->{ConstructorCallWith}, \@$outputArray, $visibleInterfaceName, $function));
}
my $argumentIndex = 0;
@@ -4783,7 +4796,7 @@
my $functionString = "$functionName(" . join(", ", @arguments) . ")";
$functionString = "propagateException(*state, throwScope, $functionString)" if NeedsExplicitPropagateExceptionCall($function);
- return ($functionString, scalar @arguments);
+ return $functionString;
}
sub GenerateDictionaryHeader
@@ -6092,53 +6105,14 @@
push(@$outputArray, " auto* castedThis = jsCast<${constructorClassName}*>(state->jsCallee());\n");
push(@$outputArray, " ASSERT(castedThis);\n");
- my @constructorArgList;
-
$implIncludes{"<runtime/Error.h>"} = 1;
GenerateArgumentsCountCheck($outputArray, $function, $interface);
- # FIXME: For now, we do not support SVG constructors.
- # FIXME: Currently [Constructor(...)] does not yet support optional arguments without [Default=...]
- my ($dummy, $paramIndex) = GenerateParametersCheck($outputArray, $function, $interface, "constructorCallback");
+ my $functionImplementationName = $generatingNamedConstructor ? "createForJSConstructor" : "create";
+ my $functionString = GenerateParametersCheck($outputArray, $function, $interface, $functionImplementationName);
- push(@constructorArgList, "*state") if $codeGenerator->ExtendedAttributeContains($interface->extendedAttributes->{ConstructorCallWith}, "ScriptState");;
-
- if ($codeGenerator->ExtendedAttributeContains($interface->extendedAttributes->{ConstructorCallWith}, "ScriptExecutionContext")) {
- push(@constructorArgList, "*context");
- push(@$outputArray, " ScriptExecutionContext* context = castedThis->scriptExecutionContext();\n");
- push(@$outputArray, " if (UNLIKELY(!context))\n");
- push(@$outputArray, " return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, \"${visibleInterfaceName}\");\n");
- }
-
- if ($codeGenerator->ExtendedAttributeContains($interface->extendedAttributes->{ConstructorCallWith}, "Document")) {
- $implIncludes{"Document.h"} = 1;
- push(@constructorArgList, "document");
- push(@$outputArray, " ScriptExecutionContext* context = castedThis->scriptExecutionContext();\n");
- push(@$outputArray, " if (UNLIKELY(!context))\n");
- push(@$outputArray, " return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, \"${visibleInterfaceName}\");\n");
- push(@$outputArray, " ASSERT(context->isDocument());\n");
- push(@$outputArray, " auto& document = downcast<Document>(*context);\n");
- }
-
- push(@constructorArgList, "*castedThis->document()") if $generatingNamedConstructor;
-
- my $index = 0;
- foreach my $argument (@{$function->arguments}) {
- last if $index eq $paramIndex;
-
- push(@constructorArgList, PassArgumentExpression($argument->name, $argument));
-
- $index++;
- }
-
- my $constructorArg = join(", ", @constructorArgList);
- if ($generatingNamedConstructor) {
- push(@$outputArray, " auto object = ${interfaceName}::createForJSConstructor(${constructorArg});\n");
- } else {
- push(@$outputArray, " auto object = ${interfaceName}::create(${constructorArg});\n");
- }
-
+ push(@$outputArray, " auto object = ${functionString};\n");
push(@$outputArray, " RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n") if $codeGenerator->ExtendedAttributeContains($interface->extendedAttributes->{ConstructorCallWith}, "ScriptState");
my $IDLType = GetIDLType($interface, $interface->type);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (212688 => 212689)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp 2017-02-21 01:22:31 UTC (rev 212688)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp 2017-02-21 01:44:42 UTC (rev 212689)
@@ -229,13 +229,13 @@
ASSERT(castedThis);
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
+ auto* context = castedThis->scriptExecutionContext();
+ if (UNLIKELY(!context))
+ return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "TestInterface");
auto str1 = convert<IDLDOMString>(*state, state->uncheckedArgument(0), StringConversionConfiguration::Normal);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto str2 = state->argument(1).isUndefined() ? ASCIILiteral("defaultString") : convert<IDLDOMString>(*state, state->uncheckedArgument(1), StringConversionConfiguration::Normal);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
- ScriptExecutionContext* context = castedThis->scriptExecutionContext();
- if (UNLIKELY(!context))
- return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "TestInterface");
auto object = TestInterface::create(*context, WTFMove(str1), WTFMove(str2));
return JSValue::encode(toJSNewlyCreated<IDLInterface<TestInterface>>(*state, *castedThis->globalObject(), throwScope, WTFMove(object)));
}
@@ -867,7 +867,7 @@
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return JSValue::encode(jsUndefined());
auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0), StringConversionConfiguration::Normal);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
@@ -942,7 +942,7 @@
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return JSValue::encode(jsUndefined());
auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0), StringConversionConfiguration::Normal);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp (212688 => 212689)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp 2017-02-21 01:22:31 UTC (rev 212688)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp 2017-02-21 01:44:42 UTC (rev 212689)
@@ -99,7 +99,7 @@
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto str3 = state->argument(2).isUndefined() ? String() : convert<IDLDOMString>(*state, state->uncheckedArgument(2), StringConversionConfiguration::Normal);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
- auto object = TestNamedConstructor::createForJSConstructor(*castedThis->document(), WTFMove(str1), WTFMove(str2), WTFMove(str3));
+ auto object = TestNamedConstructor::createForJSConstructor(WTFMove(str1), WTFMove(str2), WTFMove(str3));
return JSValue::encode(toJSNewlyCreated<IDLInterface<TestNamedConstructor>>(*state, *castedThis->globalObject(), throwScope, WTFMove(object)));
}
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (212688 => 212689)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2017-02-21 01:22:31 UTC (rev 212688)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2017-02-21 01:44:42 UTC (rev 212689)
@@ -1550,15 +1550,15 @@
ASSERT(castedThis);
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
+ auto* context = castedThis->scriptExecutionContext();
+ if (UNLIKELY(!context))
+ return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "TestObject");
+ ASSERT(context->isDocument());
+ auto& document = downcast<Document>(*context);
auto testCallback = convert<IDLCallbackInterface<JSTestCallbackInterface>>(*state, state->uncheckedArgument(0), *castedThis->globalObject(), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentMustBeFunctionError(state, scope, 0, "testCallback", "TestObject", nullptr); });
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto testCallbackFunction = convert<IDLCallbackFunction<JSTestCallbackFunction>>(*state, state->uncheckedArgument(1), *castedThis->globalObject(), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentMustBeFunctionError(state, scope, 1, "testCallbackFunction", "TestObject", nullptr); });
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
- ScriptExecutionContext* context = castedThis->scriptExecutionContext();
- if (UNLIKELY(!context))
- return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "TestObject");
- ASSERT(context->isDocument());
- auto& document = downcast<Document>(*context);
auto object = TestObj::create(document, testCallback.releaseNonNull(), testCallbackFunction.releaseNonNull());
return JSValue::encode(toJSNewlyCreated<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), WTFMove(object)));
}
@@ -2924,7 +2924,7 @@
UNUSED_PARAM(throwScope);
UNUSED_PARAM(state);
auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return jsUndefined();
auto& impl = thisObject.wrapped();
JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.withScriptExecutionContextAttribute(*context));
@@ -2959,7 +2959,7 @@
UNUSED_PARAM(throwScope);
UNUSED_PARAM(state);
auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return jsUndefined();
auto& impl = thisObject.wrapped();
JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), throwScope, impl.withScriptExecutionContextAttributeRaises(*context));
@@ -2978,7 +2978,7 @@
UNUSED_PARAM(throwScope);
UNUSED_PARAM(state);
auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return jsUndefined();
auto& impl = thisObject.wrapped();
JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.withScriptExecutionContextAndScriptStateAttribute(state, *context));
@@ -2997,7 +2997,7 @@
UNUSED_PARAM(throwScope);
UNUSED_PARAM(state);
auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return jsUndefined();
auto& impl = thisObject.wrapped();
JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), throwScope, impl.withScriptExecutionContextAndScriptStateAttributeRaises(state, *context));
@@ -3016,7 +3016,7 @@
UNUSED_PARAM(throwScope);
UNUSED_PARAM(state);
auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return jsUndefined();
auto& impl = thisObject.wrapped();
JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.withScriptExecutionContextAndScriptStateWithSpacesAttribute(state, *context));
@@ -4584,7 +4584,7 @@
auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptExecutionContextAttribute", "TestObj"); });
RETURN_IF_EXCEPTION(throwScope, false);
auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return false;
impl.setWithScriptExecutionContextAttribute(*context, *nativeValue);
return true;
@@ -4625,7 +4625,7 @@
auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptExecutionContextAttributeRaises", "TestObj"); });
RETURN_IF_EXCEPTION(throwScope, false);
auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return false;
impl.setWithScriptExecutionContextAttributeRaises(*context, *nativeValue);
return true;
@@ -4647,7 +4647,7 @@
auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptExecutionContextAndScriptStateAttribute", "TestObj"); });
RETURN_IF_EXCEPTION(throwScope, false);
auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return false;
impl.setWithScriptExecutionContextAndScriptStateAttribute(state, *context, *nativeValue);
return true;
@@ -4669,7 +4669,7 @@
auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptExecutionContextAndScriptStateAttributeRaises", "TestObj"); });
RETURN_IF_EXCEPTION(throwScope, false);
auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return false;
impl.setWithScriptExecutionContextAndScriptStateAttributeRaises(state, *context, *nativeValue);
return true;
@@ -4691,7 +4691,7 @@
auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptExecutionContextAndScriptStateWithSpacesAttribute", "TestObj"); });
RETURN_IF_EXCEPTION(throwScope, false);
auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return false;
impl.setWithScriptExecutionContextAndScriptStateWithSpacesAttribute(state, *context, *nativeValue);
return true;
@@ -6039,7 +6039,7 @@
UNUSED_PARAM(throwScope);
auto& impl = castedThis->wrapped();
auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return JSValue::encode(jsUndefined());
impl.withScriptExecutionContext(*context);
return JSValue::encode(jsUndefined());
@@ -6058,7 +6058,7 @@
UNUSED_PARAM(throwScope);
auto& impl = castedThis->wrapped();
auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return JSValue::encode(jsUndefined());
impl.withScriptExecutionContextAndScriptState(*state, *context);
return JSValue::encode(jsUndefined());
@@ -6077,7 +6077,7 @@
UNUSED_PARAM(throwScope);
auto& impl = castedThis->wrapped();
auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return JSValue::encode(jsUndefined());
return JSValue::encode(toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), throwScope, impl.withScriptExecutionContextAndScriptStateObjException(*state, *context)));
}
@@ -6095,7 +6095,7 @@
UNUSED_PARAM(throwScope);
auto& impl = castedThis->wrapped();
auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return JSValue::encode(jsUndefined());
return JSValue::encode(toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), impl.withScriptExecutionContextAndScriptStateWithSpaces(*state, *context)));
}
@@ -6130,7 +6130,7 @@
UNUSED_PARAM(throwScope);
auto& impl = castedThis->wrapped();
auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
- if (!context)
+ if (UNLIKELY(!context))
return JSValue::encode(jsUndefined());
ASSERT(context->isDocument());
auto& document = downcast<Document>(*context);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp (212688 => 212689)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp 2017-02-21 01:22:31 UTC (rev 212688)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp 2017-02-21 01:44:42 UTC (rev 212689)
@@ -138,7 +138,7 @@
ASSERT(castedThis);
auto longArgs = convertVariadicArguments<IDLLong>(*state, 0);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
- auto object = TestOverloadedConstructors::create(WTFMove(longArgs));
+ auto object = TestOverloadedConstructors::create(WTFMove(longArgs.arguments.value()));
return JSValue::encode(toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*state, *castedThis->globalObject(), WTFMove(object)));
}
Modified: trunk/Source/WebCore/html/HTMLAudioElement.idl (212688 => 212689)
--- trunk/Source/WebCore/html/HTMLAudioElement.idl 2017-02-21 01:22:31 UTC (rev 212688)
+++ trunk/Source/WebCore/html/HTMLAudioElement.idl 2017-02-21 01:44:42 UTC (rev 212689)
@@ -26,6 +26,7 @@
[
EnabledAtRuntime,
Conditional=VIDEO,
+ ConstructorCallWith=Document,
NamedConstructor=Audio(optional DOMString src)
] interface HTMLAudioElement : HTMLMediaElement {
};
Modified: trunk/Source/WebCore/html/HTMLImageElement.idl (212688 => 212689)
--- trunk/Source/WebCore/html/HTMLImageElement.idl 2017-02-21 01:22:31 UTC (rev 212688)
+++ trunk/Source/WebCore/html/HTMLImageElement.idl 2017-02-21 01:44:42 UTC (rev 212689)
@@ -21,6 +21,7 @@
[
ExportMacro=WEBCORE_EXPORT,
JSGenerateToNativeObject,
+ ConstructorCallWith=Document,
NamedConstructor=Image(optional unsigned long width, optional unsigned long height)
] interface HTMLImageElement : HTMLElement {
[Reflect] attribute DOMString name;
Modified: trunk/Source/WebCore/html/HTMLOptionElement.idl (212688 => 212689)
--- trunk/Source/WebCore/html/HTMLOptionElement.idl 2017-02-21 01:22:31 UTC (rev 212688)
+++ trunk/Source/WebCore/html/HTMLOptionElement.idl 2017-02-21 01:44:42 UTC (rev 212689)
@@ -21,6 +21,7 @@
[
ConstructorMayThrowException,
JSGenerateToNativeObject,
+ ConstructorCallWith=Document,
NamedConstructor=Option(optional DOMString data, optional DOMString value, optional boolean defaultSelected = false, optional boolean selected = false),
] interface HTMLOptionElement : HTMLElement {
[Reflect] attribute boolean disabled;