<!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>[205048] 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/205048">205048</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-08-26 14:34:21 -0700 (Fri, 26 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION(<a href="http://trac.webkit.org/projects/webkit/changeset/204028">r204028</a>): Fix unused-but-set-variable warning in generated JSNavigator.cpp
https://bugs.webkit.org/show_bug.cgi?id=161252

Reviewed by Ryosuke Niwa.

Improve support for [Conditional] with overloaded operations in the IDL.

No new tests, updated bindings tests.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(GeneratePropertiesHashTable):
(getConditionalForFunctionConsideringOverloads):
(GenerateOverloadedFunctionOrConstructor):
(GenerateImplementation):
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation): Deleted.
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionConditionalOverload1):
(WebCore::jsTestObjPrototypeFunctionConditionalOverload2):
(WebCore::jsTestObjPrototypeFunctionConditionalOverload):
(WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation): Deleted.
(WebCore::jsTestObjConstructorFunctionOverloadedMethod1): Deleted.
* bindings/scripts/test/TestObj.idl:</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="#trunkSourceWebCorebindingsscriptstestJSJSTestGlobalObjectcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestObjidl">trunk/Source/WebCore/bindings/scripts/test/TestObj.idl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (205047 => 205048)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-26 21:23:45 UTC (rev 205047)
+++ trunk/Source/WebCore/ChangeLog        2016-08-26 21:34:21 UTC (rev 205048)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2016-08-26  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        REGRESSION(r204028): Fix unused-but-set-variable warning in generated JSNavigator.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=161252
+
+        Reviewed by Ryosuke Niwa.
+
+        Improve support for [Conditional] with overloaded operations in the IDL.
+
+        No new tests, updated bindings tests.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateHeader):
+        (GeneratePropertiesHashTable):
+        (getConditionalForFunctionConsideringOverloads):
+        (GenerateOverloadedFunctionOrConstructor):
+        (GenerateImplementation):
+        * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
+        (WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation): Deleted.
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::jsTestObjPrototypeFunctionConditionalOverload1):
+        (WebCore::jsTestObjPrototypeFunctionConditionalOverload2):
+        (WebCore::jsTestObjPrototypeFunctionConditionalOverload):
+        (WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation): Deleted.
+        (WebCore::jsTestObjConstructorFunctionOverloadedMethod1): Deleted.
+        * bindings/scripts/test/TestObj.idl:
+
</ins><span class="cx"> 2016-08-26  Beth Dakin  &lt;bdakin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         charactersAroundPosition can be wrong because it crosses editing boundaries
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (205047 => 205048)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-08-26 21:23:45 UTC (rev 205047)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-08-26 21:34:21 UTC (rev 205048)
</span><span class="lines">@@ -1537,7 +1537,8 @@
</span><span class="cx">                 $inAppleCopyright = 0;
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            my $conditionalString = $codeGenerator-&gt;GenerateConditionalString($function-&gt;signature);
</del><ins>+            my $conditionalAttribute = getConditionalForFunctionConsideringOverloads($function);
+            my $conditionalString = $conditionalAttribute ? $codeGenerator-&gt;GenerateConditionalStringFromAttributeValue($conditionalAttribute) : undef;
</ins><span class="cx">             push(@headerContent, &quot;#if ${conditionalString}\n&quot;) if $conditionalString;
</span><span class="cx">             my $functionName = GetFunctionName($interface, $className, $function);
</span><span class="cx">             push(@headerContent, &quot;JSC::EncodedJSValue JSC_HOST_CALL ${functionName}(JSC::ExecState*);\n&quot;);
</span><span class="lines">@@ -1674,7 +1675,7 @@
</span><span class="cx"> 
</span><span class="cx">         push(@$hashSpecials, ComputeFunctionSpecial($interface, $function));
</span><span class="cx"> 
</span><del>-        my $conditional = $function-&gt;signature-&gt;extendedAttributes-&gt;{&quot;Conditional&quot;};
</del><ins>+        my $conditional = getConditionalForFunctionConsideringOverloads($function);
</ins><span class="cx">         if ($conditional) {
</span><span class="cx">             $conditionals-&gt;{$name} = $conditional;
</span><span class="cx">         }
</span><span class="lines">@@ -1828,6 +1829,22 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+sub getConditionalForFunctionConsideringOverloads
+{
+    my $function = shift;
+
+    return $function-&gt;signature-&gt;extendedAttributes-&gt;{&quot;Conditional&quot;} unless $function-&gt;{overloads};
+
+    my %conditions;
+    foreach my $overload (@{$function-&gt;{overloads}}) {
+        if ($overload-&gt;signature-&gt;extendedAttributes-&gt;{&quot;Conditional&quot;}) {
+            $conditions{$overload-&gt;signature-&gt;extendedAttributes-&gt;{&quot;Conditional&quot;}} = 1;
+        }
+    }
+    return undef unless keys %conditions;
+    return join(&quot;|&quot;, keys %conditions);
+}
+
</ins><span class="cx"> # Implements the overload resolution algorithm, as defined in the Web IDL specification:
</span><span class="cx"> # http://heycam.github.io/webidl/#es-overloads
</span><span class="cx"> sub GenerateOverloadedFunctionOrConstructor
</span><span class="lines">@@ -1913,6 +1930,9 @@
</span><span class="cx"> 
</span><span class="cx">     my $maxArgCount = LengthOfLongestFunctionParameterList($function-&gt;{overloads});
</span><span class="cx"> 
</span><ins>+    my $conditionalAttribute = getConditionalForFunctionConsideringOverloads($function);
+    my $conditionalString = $conditionalAttribute ? $codeGenerator-&gt;GenerateConditionalStringFromAttributeValue($conditionalAttribute) : undef;
+    push(@implContent, &quot;#if ${conditionalString}\n&quot;) if $conditionalString;
</ins><span class="cx">     if ($isConstructor) {
</span><span class="cx">         push(@implContent, &quot;template&lt;&gt; EncodedJSValue JSC_HOST_CALL ${className}Constructor::construct(ExecState* state)\n&quot;);
</span><span class="cx">     } else {
</span><span class="lines">@@ -1998,7 +2018,9 @@
</span><span class="cx">     } else {
</span><span class="cx">         push(@implContent, &quot;    return throwVMTypeError(state);\n&quot;)
</span><span class="cx">     }
</span><del>-    push(@implContent, &quot;}\n\n&quot;);
</del><ins>+    push(@implContent, &quot;}\n&quot;);
+    push(@implContent, &quot;#endif\n&quot;) if $conditionalString;
+    push(@implContent, &quot;\n&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # As per Web IDL specification, the length of a function Object is its number of mandatory parameters.
</span><span class="lines">@@ -2291,7 +2313,8 @@
</span><span class="cx">                 $inAppleCopyright = 0;
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            my $conditionalString = $codeGenerator-&gt;GenerateConditionalString($function-&gt;signature);
</del><ins>+            my $conditionalAttribute = getConditionalForFunctionConsideringOverloads($function);
+            my $conditionalString = $conditionalAttribute ? $codeGenerator-&gt;GenerateConditionalStringFromAttributeValue($conditionalAttribute) : undef;
</ins><span class="cx">             push(@implContent, &quot;#if ${conditionalString}\n&quot;) if $conditionalString;
</span><span class="cx">             my $functionName = GetFunctionName($interface, $className, $function);
</span><span class="cx">             push(@implContent, &quot;JSC::EncodedJSValue JSC_HOST_CALL ${functionName}(JSC::ExecState*);\n&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp (205047 => 205048)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp        2016-08-26 21:23:45 UTC (rev 205047)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp        2016-08-26 21:34:21 UTC (rev 205048)
</span><span class="lines">@@ -395,6 +395,7 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(TEST_FEATURE)
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation(ExecState* state)
</span><span class="cx"> {
</span><span class="cx">     size_t argsCount = std::min&lt;size_t&gt;(1, state-&gt;argumentCount());
</span><span class="lines">@@ -410,6 +411,7 @@
</span><span class="cx">     }
</span><span class="cx">     return argsCount &lt; 1 ? throwVMError(state, createNotEnoughArgumentsError(state)) : throwVMTypeError(state);
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(TEST_FEATURE)
</span><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestGlobalObjectInstanceFunctionTestPrivateFunction(ExecState* state)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (205047 => 205048)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-08-26 21:23:45 UTC (rev 205047)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-08-26 21:34:21 UTC (rev 205048)
</span><span class="lines">@@ -784,6 +784,9 @@
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunction(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNeedsCustomElementReactionStack(JSC::ExecState*);
</span><ins>+#if ENABLE(CONDITION1) || ENABLE(CONDITION2)
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConditionalOverload(JSC::ExecState*);
+#endif
</ins><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAttachShadowRoot(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionToString(JSC::ExecState*);
</span><span class="cx"> 
</span><span class="lines">@@ -1379,6 +1382,11 @@
</span><span class="cx">     { &quot;testPromiseFunctionWithOptionalIntArgument&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument), (intptr_t) (0) } },
</span><span class="cx">     { &quot;testPromiseOverloadedFunction&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionTestPromiseOverloadedFunction), (intptr_t) (1) } },
</span><span class="cx">     { &quot;methodWithNeedsCustomElementReactionStack&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithNeedsCustomElementReactionStack), (intptr_t) (0) } },
</span><ins>+#if ENABLE(CONDITION1) || ENABLE(CONDITION2)
+    { &quot;conditionalOverload&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionConditionalOverload), (intptr_t) (1) } },
+#else
+    { 0, 0, NoIntrinsic, { 0, 0 } },
+#endif
</ins><span class="cx">     { &quot;attachShadowRoot&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionAttachShadowRoot), (intptr_t) (1) } },
</span><span class="cx">     { &quot;toString&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionToString), (intptr_t) (0) } },
</span><span class="cx"> #if ENABLE(Condition1)
</span><span class="lines">@@ -4204,6 +4212,7 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(TEST_FEATURE)
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionEnabledAtRuntimeOperation(ExecState* state)
</span><span class="cx"> {
</span><span class="cx">     size_t argsCount = std::min&lt;size_t&gt;(1, state-&gt;argumentCount());
</span><span class="lines">@@ -4219,6 +4228,7 @@
</span><span class="cx">     }
</span><span class="cx">     return argsCount &lt; 1 ? throwVMError(state, createNotEnoughArgumentsError(state)) : throwVMTypeError(state);
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(ExecState* state)
</span><span class="cx"> {
</span><span class="lines">@@ -5978,6 +5988,7 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(Condition1)
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod1(ExecState* state)
</span><span class="cx"> {
</span><span class="cx">     size_t argsCount = std::min&lt;size_t&gt;(1, state-&gt;argumentCount());
</span><span class="lines">@@ -5993,6 +6004,7 @@
</span><span class="cx">     }
</span><span class="cx">     return argsCount &lt; 1 ? throwVMError(state, createNotEnoughArgumentsError(state)) : throwVMTypeError(state);
</span><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithClamp(ExecState* state)
</span><span class="cx"> {
</span><span class="lines">@@ -6521,6 +6533,64 @@
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(CONDITION1)
+static inline EncodedJSValue jsTestObjPrototypeFunctionConditionalOverload1(ExecState* state)
+{
+    JSValue thisValue = state-&gt;thisValue();
+    auto castedThis = jsDynamicCast&lt;JSTestObj*&gt;(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*state, &quot;TestObject&quot;, &quot;conditionalOverload&quot;);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto&amp; impl = castedThis-&gt;wrapped();
+    if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
+        return throwVMError(state, createNotEnoughArgumentsError(state));
+    auto str = state-&gt;argument(0).toWTFString(state);
+    if (UNLIKELY(state-&gt;hadException()))
+        return JSValue::encode(jsUndefined());
+    impl.conditionalOverload(WTFMove(str));
+    return JSValue::encode(jsUndefined());
+}
+
+#endif
+
+#if ENABLE(CONDITION2)
+static inline EncodedJSValue jsTestObjPrototypeFunctionConditionalOverload2(ExecState* state)
+{
+    JSValue thisValue = state-&gt;thisValue();
+    auto castedThis = jsDynamicCast&lt;JSTestObj*&gt;(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*state, &quot;TestObject&quot;, &quot;conditionalOverload&quot;);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto&amp; impl = castedThis-&gt;wrapped();
+    if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
+        return throwVMError(state, createNotEnoughArgumentsError(state));
+    auto a = convert&lt;int32_t&gt;(*state, state-&gt;argument(0), NormalConversion);
+    if (UNLIKELY(state-&gt;hadException()))
+        return JSValue::encode(jsUndefined());
+    impl.conditionalOverload(WTFMove(a));
+    return JSValue::encode(jsUndefined());
+}
+
+#endif
+
+#if ENABLE(CONDITION1) || ENABLE(CONDITION2)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConditionalOverload(ExecState* state)
+{
+    size_t argsCount = std::min&lt;size_t&gt;(1, state-&gt;argumentCount());
+    if (argsCount == 1) {
+        JSValue distinguishingArg = state-&gt;uncheckedArgument(0);
+#if ENABLE(CONDITION2)
+        if (distinguishingArg.isNumber())
+            return jsTestObjPrototypeFunctionConditionalOverload2(state);
+#endif
+#if ENABLE(CONDITION1)
+        return jsTestObjPrototypeFunctionConditionalOverload1(state);
+#endif
+    }
+    return argsCount &lt; 1 ? throwVMError(state, createNotEnoughArgumentsError(state)) : throwVMTypeError(state);
+}
+#endif
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAttachShadowRoot(ExecState* state)
</span><span class="cx"> {
</span><span class="cx">     JSValue thisValue = state-&gt;thisValue();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (205047 => 205048)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-08-26 21:23:45 UTC (rev 205047)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-08-26 21:34:21 UTC (rev 205048)
</span><span class="lines">@@ -397,6 +397,12 @@
</span><span class="cx">     [CEReactions] void methodWithNeedsCustomElementReactionStack();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if defined(TESTING_JS)
+    // Overloading with conditionals.
+    [Conditional=CONDITION1] void conditionalOverload(DOMString str);
+    [Conditional=CONDITION2] void conditionalOverload(long a);
+#endif
+
</ins><span class="cx">     void attachShadowRoot(TestDictionary init);
</span><span class="cx"> 
</span><span class="cx">     stringifier attribute USVString stringifierAttribute;
</span></span></pre>
</div>
</div>

</body>
</html>