<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[212689] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/212689">212689</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2017-02-20 17:44:42 -0800 (Mon, 20 Feb 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>[WebIDL] Add support for constructors that have variadic parameters
https://bugs.webkit.org/show_bug.cgi?id=168614
Patch by Sam Weinig <sam@webkit.org> on 2017-02-20
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.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestInterfacecpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestNamedConstructorcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestOverloadedConstructorscpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAudioElementidl">trunk/Source/WebCore/html/HTMLAudioElement.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLImageElementidl">trunk/Source/WebCore/html/HTMLImageElement.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLOptionElementidl">trunk/Source/WebCore/html/HTMLOptionElement.idl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (212688 => 212689)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2017-02-20 Sam Weinig <sam@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.
+
</ins><span class="cx"> 2017-02-20 John Wilander <wilander@apple.com>
</span><span class="cx">
</span><span class="cx"> Resource Load Statistics: Add alternate classification method
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (212688 => 212689)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -4034,7 +4034,7 @@
</span><span class="cx">
</span><span class="cx"> GenerateArgumentsCountCheck(\@implContent, $function, $interface);
</span><span class="cx">
</span><del>- my ($functionString, $dummy) = GenerateParametersCheck(\@implContent, $function, $interface, $functionImplementationName);
</del><ins>+ my $functionString = GenerateParametersCheck(\@implContent, $function, $interface, $functionImplementationName);
</ins><span class="cx"> GenerateImplementationFunctionCall($function, $functionString, " ", $interface);
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="lines">@@ -4084,7 +4084,7 @@
</span><span class="cx">
</span><span class="cx"> GenerateArgumentsCountCheck(\@implContent, $function, $interface);
</span><span class="cx">
</span><del>- my ($functionString, $dummy) = GenerateParametersCheck(\@implContent, $function, $interface, $functionImplementationName);
</del><ins>+ my $functionString = GenerateParametersCheck(\@implContent, $function, $interface, $functionImplementationName);
</ins><span class="cx"> GenerateImplementationFunctionCall($function, $functionString, " ", $interface);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -4481,7 +4481,7 @@
</span><span class="cx"> my $stateReference = "state";
</span><span class="cx"> my $globalObject = "jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())";
</span><span class="cx">
</span><del>- return GenerateCallWith($callWith, $outputArray, $returnValue, $function, $statePointer, $stateReference, $globalObject);
</del><ins>+ return GenerateCallWith($callWith, $outputArray, $returnValue, $returnValue, $function, $statePointer, $stateReference, $globalObject, $globalObject);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # FIXME: We should remove GenerateCallWithUsingPointers and combine GenerateCallWithUsingReferences and GenerateCallWith
</span><span class="lines">@@ -4493,12 +4493,25 @@
</span><span class="cx"> my $stateReference = "*state";
</span><span class="cx"> my $globalObject = "jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())";
</span><span class="cx">
</span><del>- return GenerateCallWith($callWith, $outputArray, $returnValue, $function, $statePointer, $stateReference, $globalObject);
</del><ins>+ return GenerateCallWith($callWith, $outputArray, $returnValue, $returnValue, $function, $statePointer, $stateReference, $globalObject, $globalObject);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+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);
+}
+
</ins><span class="cx"> sub GenerateCallWith
</span><span class="cx"> {
</span><del>- my ($callWith, $outputArray, $returnValue, $function, $statePointer, $stateReference, $globalObject) = @_;
</del><ins>+ my ($callWith, $outputArray, $returnValue, $contextMissing, $function, $statePointer, $stateReference, $globalObject, $scriptExecutionContextAccessor) = @_;
</ins><span class="cx">
</span><span class="cx"> return () unless $callWith;
</span><span class="cx">
</span><span class="lines">@@ -4506,16 +4519,16 @@
</span><span class="cx"> push(@callWithArgs, $stateReference) if $codeGenerator->ExtendedAttributeContains($callWith, "ScriptState");
</span><span class="cx"> push(@callWithArgs, "*${globalObject}") if $codeGenerator->ExtendedAttributeContains($callWith, "GlobalObject");
</span><span class="cx"> if ($codeGenerator->ExtendedAttributeContains($callWith, "ScriptExecutionContext")) {
</span><del>- push(@$outputArray, " auto* context = $globalObject->scriptExecutionContext();\n");
- push(@$outputArray, " if (!context)\n");
- push(@$outputArray, " return" . ($returnValue ? " " . $returnValue : "") . ";\n");
</del><ins>+ push(@$outputArray, " auto* context = ${scriptExecutionContextAccessor}->scriptExecutionContext();\n");
+ push(@$outputArray, " if (UNLIKELY(!context))\n");
+ push(@$outputArray, " return" . ($contextMissing ? " " . $contextMissing : "") . ";\n");
</ins><span class="cx"> push(@callWithArgs, "*context");
</span><span class="cx"> }
</span><span class="cx"> if ($codeGenerator->ExtendedAttributeContains($callWith, "Document")) {
</span><span class="cx"> $implIncludes{"Document.h"} = 1;
</span><del>- push(@$outputArray, " auto* context = $globalObject->scriptExecutionContext();\n");
- push(@$outputArray, " if (!context)\n");
- push(@$outputArray, " return" . ($returnValue ? " " . $returnValue : "") . ";\n");
</del><ins>+ push(@$outputArray, " auto* context = ${scriptExecutionContextAccessor}->scriptExecutionContext();\n");
+ push(@$outputArray, " if (UNLIKELY(!context))\n");
+ push(@$outputArray, " return" . ($contextMissing ? " " . $contextMissing : "") . ";\n");
</ins><span class="cx"> push(@$outputArray, " ASSERT(context->isDocument());\n");
</span><span class="cx"> push(@$outputArray, " auto& document = downcast<Document>(*context);\n");
</span><span class="cx"> push(@callWithArgs, "document");
</span><span class="lines">@@ -4537,17 +4550,14 @@
</span><span class="cx"> if ($codeGenerator->ExtendedAttributeContains($callWith, "ActiveWindow")) {
</span><span class="cx"> $implIncludes{"JSDOMWindowBase.h"} = 1;
</span><span class="cx"> push(@callWithArgs, "activeDOMWindow($statePointer)");
</span><del>-
</del><span class="cx"> }
</span><span class="cx"> if ($codeGenerator->ExtendedAttributeContains($callWith, "FirstWindow")) {
</span><span class="cx"> $implIncludes{"JSDOMWindowBase.h"} = 1;
</span><span class="cx"> push(@callWithArgs, "firstDOMWindow($statePointer)");
</span><del>-
</del><span class="cx"> }
</span><span class="cx"> if ($codeGenerator->ExtendedAttributeContains($callWith, "CallerWindow")) {
</span><span class="cx"> $implIncludes{"JSDOMWindowBase.h"} = 1;
</span><span class="cx"> push(@callWithArgs, "callerDOMWindow($statePointer)");
</span><del>-
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return @callWithArgs;
</span><span class="lines">@@ -4632,17 +4642,19 @@
</span><span class="cx">
</span><span class="cx"> my $interfaceName = $interface->type->name;
</span><span class="cx"> my $visibleInterfaceName = $codeGenerator->GetVisibleInterfaceName($interface);
</span><del>- my @arguments;
- my $functionName;
</del><span class="cx"> my $implementedBy = $function->extendedAttributes->{ImplementedBy};
</span><span class="cx"> my $numArguments = @{$function->arguments};
</span><span class="cx"> my $conditional = $function->extendedAttributes->{Conditional};
</span><ins>+ my $isConstructor = $function->extendedAttributes->{Constructor} || $function->extendedAttributes->{NamedConstructor};
</ins><span class="cx">
</span><ins>+ my @arguments;
+ my $functionName;
+
</ins><span class="cx"> if ($implementedBy) {
</span><span class="cx"> AddToImplIncludes("${implementedBy}.h", $conditional);
</span><span class="cx"> unshift(@arguments, "impl") if !$function->isStatic;
</span><span class="cx"> $functionName = "WebCore::${implementedBy}::${functionImplementationName}";
</span><del>- } elsif ($function->isStatic) {
</del><ins>+ } elsif ($function->isStatic || $isConstructor) {
</ins><span class="cx"> $functionName = "${interfaceName}::${functionImplementationName}";
</span><span class="cx"> } else {
</span><span class="cx"> $functionName = "impl.${functionImplementationName}";
</span><span class="lines">@@ -4649,12 +4661,13 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> my $quotedFunctionName;
</span><del>- if (!$function->extendedAttributes->{Constructor}) {
</del><ins>+ if (!$isConstructor) {
</ins><span class="cx"> my $name = $function->name;
</span><span class="cx"> $quotedFunctionName = "\"$name\"";
</span><span class="cx"> push(@arguments, GenerateCallWithUsingPointers($function->extendedAttributes->{CallWith}, \@$outputArray, "JSValue::encode(jsUndefined())", $function));
</span><span class="cx"> } else {
</span><span class="cx"> $quotedFunctionName = "nullptr";
</span><ins>+ push(@arguments, GenerateConstructorCallWithUsingPointers($function->extendedAttributes->{ConstructorCallWith}, \@$outputArray, $visibleInterfaceName, $function));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> my $argumentIndex = 0;
</span><span class="lines">@@ -4783,7 +4796,7 @@
</span><span class="cx"> my $functionString = "$functionName(" . join(", ", @arguments) . ")";
</span><span class="cx"> $functionString = "propagateException(*state, throwScope, $functionString)" if NeedsExplicitPropagateExceptionCall($function);
</span><span class="cx">
</span><del>- return ($functionString, scalar @arguments);
</del><ins>+ return $functionString;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub GenerateDictionaryHeader
</span><span class="lines">@@ -6092,53 +6105,14 @@
</span><span class="cx"> push(@$outputArray, " auto* castedThis = jsCast<${constructorClassName}*>(state->jsCallee());\n");
</span><span class="cx"> push(@$outputArray, " ASSERT(castedThis);\n");
</span><span class="cx">
</span><del>- my @constructorArgList;
-
</del><span class="cx"> $implIncludes{"<runtime/Error.h>"} = 1;
</span><span class="cx">
</span><span class="cx"> GenerateArgumentsCountCheck($outputArray, $function, $interface);
</span><span class="cx">
</span><del>- # 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");
</del><ins>+ my $functionImplementationName = $generatingNamedConstructor ? "createForJSConstructor" : "create";
+ my $functionString = GenerateParametersCheck($outputArray, $function, $interface, $functionImplementationName);
</ins><span class="cx">
</span><del>- 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");
- }
-
</del><ins>+ push(@$outputArray, " auto object = ${functionString};\n");
</ins><span class="cx"> push(@$outputArray, " RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n") if $codeGenerator->ExtendedAttributeContains($interface->extendedAttributes->{ConstructorCallWith}, "ScriptState");
</span><span class="cx">
</span><span class="cx"> my $IDLType = GetIDLType($interface, $interface->type);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestInterfacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (212688 => 212689)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -229,13 +229,13 @@
</span><span class="cx"> ASSERT(castedThis);
</span><span class="cx"> if (UNLIKELY(state->argumentCount() < 1))
</span><span class="cx"> return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><ins>+ auto* context = castedThis->scriptExecutionContext();
+ if (UNLIKELY(!context))
+ return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "TestInterface");
</ins><span class="cx"> auto str1 = convert<IDLDOMString>(*state, state->uncheckedArgument(0), StringConversionConfiguration::Normal);
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx"> auto str2 = state->argument(1).isUndefined() ? ASCIILiteral("defaultString") : convert<IDLDOMString>(*state, state->uncheckedArgument(1), StringConversionConfiguration::Normal);
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>- ScriptExecutionContext* context = castedThis->scriptExecutionContext();
- if (UNLIKELY(!context))
- return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "TestInterface");
</del><span class="cx"> auto object = TestInterface::create(*context, WTFMove(str1), WTFMove(str2));
</span><span class="cx"> return JSValue::encode(toJSNewlyCreated<IDLInterface<TestInterface>>(*state, *castedThis->globalObject(), throwScope, WTFMove(object)));
</span><span class="cx"> }
</span><span class="lines">@@ -867,7 +867,7 @@
</span><span class="cx"> if (UNLIKELY(state->argumentCount() < 2))
</span><span class="cx"> return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0), StringConversionConfiguration::Normal);
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="lines">@@ -942,7 +942,7 @@
</span><span class="cx"> if (UNLIKELY(state->argumentCount() < 2))
</span><span class="cx"> return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> auto strArg = convert<IDLDOMString>(*state, state->uncheckedArgument(0), StringConversionConfiguration::Normal);
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestNamedConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp (212688 => 212689)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx"> auto str3 = state->argument(2).isUndefined() ? String() : convert<IDLDOMString>(*state, state->uncheckedArgument(2), StringConversionConfiguration::Normal);
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>- auto object = TestNamedConstructor::createForJSConstructor(*castedThis->document(), WTFMove(str1), WTFMove(str2), WTFMove(str3));
</del><ins>+ auto object = TestNamedConstructor::createForJSConstructor(WTFMove(str1), WTFMove(str2), WTFMove(str3));
</ins><span class="cx"> return JSValue::encode(toJSNewlyCreated<IDLInterface<TestNamedConstructor>>(*state, *castedThis->globalObject(), throwScope, WTFMove(object)));
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (212688 => 212689)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1550,15 +1550,15 @@
</span><span class="cx"> ASSERT(castedThis);
</span><span class="cx"> if (UNLIKELY(state->argumentCount() < 2))
</span><span class="cx"> return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
</span><ins>+ auto* context = castedThis->scriptExecutionContext();
+ if (UNLIKELY(!context))
+ return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "TestObject");
+ ASSERT(context->isDocument());
+ auto& document = downcast<Document>(*context);
</ins><span class="cx"> auto testCallback = convert<IDLCallbackInterface<JSTestCallbackInterface>>(*state, state->uncheckedArgument(0), *castedThis->globalObject(), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentMustBeFunctionError(state, scope, 0, "testCallback", "TestObject", nullptr); });
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><span class="cx"> auto testCallbackFunction = convert<IDLCallbackFunction<JSTestCallbackFunction>>(*state, state->uncheckedArgument(1), *castedThis->globalObject(), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentMustBeFunctionError(state, scope, 1, "testCallbackFunction", "TestObject", nullptr); });
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>- ScriptExecutionContext* context = castedThis->scriptExecutionContext();
- if (UNLIKELY(!context))
- return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "TestObject");
- ASSERT(context->isDocument());
- auto& document = downcast<Document>(*context);
</del><span class="cx"> auto object = TestObj::create(document, testCallback.releaseNonNull(), testCallbackFunction.releaseNonNull());
</span><span class="cx"> return JSValue::encode(toJSNewlyCreated<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), WTFMove(object)));
</span><span class="cx"> }
</span><span class="lines">@@ -2924,7 +2924,7 @@
</span><span class="cx"> UNUSED_PARAM(throwScope);
</span><span class="cx"> UNUSED_PARAM(state);
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return jsUndefined();
</span><span class="cx"> auto& impl = thisObject.wrapped();
</span><span class="cx"> JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.withScriptExecutionContextAttribute(*context));
</span><span class="lines">@@ -2959,7 +2959,7 @@
</span><span class="cx"> UNUSED_PARAM(throwScope);
</span><span class="cx"> UNUSED_PARAM(state);
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return jsUndefined();
</span><span class="cx"> auto& impl = thisObject.wrapped();
</span><span class="cx"> JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), throwScope, impl.withScriptExecutionContextAttributeRaises(*context));
</span><span class="lines">@@ -2978,7 +2978,7 @@
</span><span class="cx"> UNUSED_PARAM(throwScope);
</span><span class="cx"> UNUSED_PARAM(state);
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return jsUndefined();
</span><span class="cx"> auto& impl = thisObject.wrapped();
</span><span class="cx"> JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.withScriptExecutionContextAndScriptStateAttribute(state, *context));
</span><span class="lines">@@ -2997,7 +2997,7 @@
</span><span class="cx"> UNUSED_PARAM(throwScope);
</span><span class="cx"> UNUSED_PARAM(state);
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return jsUndefined();
</span><span class="cx"> auto& impl = thisObject.wrapped();
</span><span class="cx"> JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), throwScope, impl.withScriptExecutionContextAndScriptStateAttributeRaises(state, *context));
</span><span class="lines">@@ -3016,7 +3016,7 @@
</span><span class="cx"> UNUSED_PARAM(throwScope);
</span><span class="cx"> UNUSED_PARAM(state);
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return jsUndefined();
</span><span class="cx"> auto& impl = thisObject.wrapped();
</span><span class="cx"> JSValue result = toJS<IDLInterface<TestObj>>(state, *thisObject.globalObject(), impl.withScriptExecutionContextAndScriptStateWithSpacesAttribute(state, *context));
</span><span class="lines">@@ -4584,7 +4584,7 @@
</span><span class="cx"> auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptExecutionContextAttribute", "TestObj"); });
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return false;
</span><span class="cx"> impl.setWithScriptExecutionContextAttribute(*context, *nativeValue);
</span><span class="cx"> return true;
</span><span class="lines">@@ -4625,7 +4625,7 @@
</span><span class="cx"> auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptExecutionContextAttributeRaises", "TestObj"); });
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return false;
</span><span class="cx"> impl.setWithScriptExecutionContextAttributeRaises(*context, *nativeValue);
</span><span class="cx"> return true;
</span><span class="lines">@@ -4647,7 +4647,7 @@
</span><span class="cx"> auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptExecutionContextAndScriptStateAttribute", "TestObj"); });
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return false;
</span><span class="cx"> impl.setWithScriptExecutionContextAndScriptStateAttribute(state, *context, *nativeValue);
</span><span class="cx"> return true;
</span><span class="lines">@@ -4669,7 +4669,7 @@
</span><span class="cx"> auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptExecutionContextAndScriptStateAttributeRaises", "TestObj"); });
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return false;
</span><span class="cx"> impl.setWithScriptExecutionContextAndScriptStateAttributeRaises(state, *context, *nativeValue);
</span><span class="cx"> return true;
</span><span class="lines">@@ -4691,7 +4691,7 @@
</span><span class="cx"> auto nativeValue = convert<IDLInterface<TestObj>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestObject", "withScriptExecutionContextAndScriptStateWithSpacesAttribute", "TestObj"); });
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, false);
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return false;
</span><span class="cx"> impl.setWithScriptExecutionContextAndScriptStateWithSpacesAttribute(state, *context, *nativeValue);
</span><span class="cx"> return true;
</span><span class="lines">@@ -6039,7 +6039,7 @@
</span><span class="cx"> UNUSED_PARAM(throwScope);
</span><span class="cx"> auto& impl = castedThis->wrapped();
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> impl.withScriptExecutionContext(*context);
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="lines">@@ -6058,7 +6058,7 @@
</span><span class="cx"> UNUSED_PARAM(throwScope);
</span><span class="cx"> auto& impl = castedThis->wrapped();
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> impl.withScriptExecutionContextAndScriptState(*state, *context);
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="lines">@@ -6077,7 +6077,7 @@
</span><span class="cx"> UNUSED_PARAM(throwScope);
</span><span class="cx"> auto& impl = castedThis->wrapped();
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> return JSValue::encode(toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), throwScope, impl.withScriptExecutionContextAndScriptStateObjException(*state, *context)));
</span><span class="cx"> }
</span><span class="lines">@@ -6095,7 +6095,7 @@
</span><span class="cx"> UNUSED_PARAM(throwScope);
</span><span class="cx"> auto& impl = castedThis->wrapped();
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> return JSValue::encode(toJS<IDLInterface<TestObj>>(*state, *castedThis->globalObject(), impl.withScriptExecutionContextAndScriptStateWithSpaces(*state, *context)));
</span><span class="cx"> }
</span><span class="lines">@@ -6130,7 +6130,7 @@
</span><span class="cx"> UNUSED_PARAM(throwScope);
</span><span class="cx"> auto& impl = castedThis->wrapped();
</span><span class="cx"> auto* context = jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())->scriptExecutionContext();
</span><del>- if (!context)
</del><ins>+ if (UNLIKELY(!context))
</ins><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> ASSERT(context->isDocument());
</span><span class="cx"> auto& document = downcast<Document>(*context);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestOverloadedConstructorscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp (212688 => 212689)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -138,7 +138,7 @@
</span><span class="cx"> ASSERT(castedThis);
</span><span class="cx"> auto longArgs = convertVariadicArguments<IDLLong>(*state, 0);
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
</span><del>- auto object = TestOverloadedConstructors::create(WTFMove(longArgs));
</del><ins>+ auto object = TestOverloadedConstructors::create(WTFMove(longArgs.arguments.value()));
</ins><span class="cx"> return JSValue::encode(toJSNewlyCreated<IDLInterface<TestOverloadedConstructors>>(*state, *castedThis->globalObject(), WTFMove(object)));
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAudioElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAudioElement.idl (212688 => 212689)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> [
</span><span class="cx"> EnabledAtRuntime,
</span><span class="cx"> Conditional=VIDEO,
</span><ins>+ ConstructorCallWith=Document,
</ins><span class="cx"> NamedConstructor=Audio(optional DOMString src)
</span><span class="cx"> ] interface HTMLAudioElement : HTMLMediaElement {
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLImageElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLImageElement.idl (212688 => 212689)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx"> [
</span><span class="cx"> ExportMacro=WEBCORE_EXPORT,
</span><span class="cx"> JSGenerateToNativeObject,
</span><ins>+ ConstructorCallWith=Document,
</ins><span class="cx"> NamedConstructor=Image(optional unsigned long width, optional unsigned long height)
</span><span class="cx"> ] interface HTMLImageElement : HTMLElement {
</span><span class="cx"> [Reflect] attribute DOMString name;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLOptionElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLOptionElement.idl (212688 => 212689)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx"> [
</span><span class="cx"> ConstructorMayThrowException,
</span><span class="cx"> JSGenerateToNativeObject,
</span><ins>+ ConstructorCallWith=Document,
</ins><span class="cx"> NamedConstructor=Option(optional DOMString data, optional DOMString value, optional boolean defaultSelected = false, optional boolean selected = false),
</span><span class="cx"> ] interface HTMLOptionElement : HTMLElement {
</span><span class="cx"> [Reflect] attribute boolean disabled;
</span></span></pre>
</div>
</div>
</body>
</html>