Title: [186450] releases/WebKitGTK/webkit-2.8
Revision
186450
Author
[email protected]
Date
2015-07-07 05:15:10 -0700 (Tue, 07 Jul 2015)

Log Message

Merge r186275 - REGRESSION (r178097): HTMLSelectElement.add(option, undefined) prepends option to the list of options; should append to the end of the list of options
https://bugs.webkit.org/show_bug.cgi?id=146566
<rdar://problem/21663919>

Reviewed by Ryosuke Niwa.

Source/WebCore:

HTMLSelectElement.add(X, undefined) is supposed to be equivalent to
HTMLSelectElement.add(X) which should *append* X. The same is true
for HTMLOptionsCollection.add(X, undefined).

However, due to a bug in our bindings generator for overloaded
operations, the actual behavior was not the expected one. The
second overload would be chosen: add(X, index) and undefined would
be converted as 0-index, which would *prepend* X.

This patch fixes the bindings generator so that undefined is allowed
for optional parameters of an overload operation, when doing the
overload resolution.

Tests:
- fast/dom/HTMLSelectElement/add.html
- fast/dom/HTMLSelectElement/options-collection-add.html
- http/tests/websocket/tests/hybi/undefined-protocol.html

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheckExpression):
Allow undefined value for optional parameters when doing the overload
resolution.

* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter):
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
(WebCore::JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors):
* bindings/scripts/test/TestObj.idl:
Add bindings tests coverage and rebaseline.

LayoutTests:

* fast/dom/HTMLSelectElement/add-expected.txt:
* fast/dom/HTMLSelectElement/add.html:
* fast/dom/HTMLSelectElement/options-collection-add-expected.txt:
* fast/dom/HTMLSelectElement/options-collection-add.html:
Update tests so that calling add(X, undefined) is expected to append X,
not prepend it.

* http/tests/websocket/tests/hybi/undefined-protocol-expected.txt: Added.
* http/tests/websocket/tests/hybi/undefined-protocol.html: Added.
Add test coverage for "new WebSocket(url, undefined)" as WebSocket is
using constructor overloads with optional parameters. Previously, calling
new WebSocket(url, undefined) was equivalent to calling
new WebSocket(url, "undefined") even though it is supposed to be
equivalent to calling new WebSocket(url).

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog (186449 => 186450)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog	2015-07-07 11:55:04 UTC (rev 186449)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog	2015-07-07 12:15:10 UTC (rev 186450)
@@ -1,3 +1,26 @@
+2015-07-03  Chris Dumez  <[email protected]>
+
+        REGRESSION (r178097): HTMLSelectElement.add(option, undefined) prepends option to the list of options; should append to the end of the list of options
+        https://bugs.webkit.org/show_bug.cgi?id=146566
+        <rdar://problem/21663919>
+
+        Reviewed by Ryosuke Niwa.
+
+        * fast/dom/HTMLSelectElement/add-expected.txt:
+        * fast/dom/HTMLSelectElement/add.html:
+        * fast/dom/HTMLSelectElement/options-collection-add-expected.txt:
+        * fast/dom/HTMLSelectElement/options-collection-add.html:
+        Update tests so that calling add(X, undefined) is expected to append X,
+        not prepend it.
+
+        * http/tests/websocket/tests/hybi/undefined-protocol-expected.txt: Added.
+        * http/tests/websocket/tests/hybi/undefined-protocol.html: Added.
+        Add test coverage for "new WebSocket(url, undefined)" as WebSocket is
+        using constructor overloads with optional parameters. Previously, calling
+        new WebSocket(url, undefined) was equivalent to calling
+        new WebSocket(url, "undefined") even though it is supposed to be
+        equivalent to calling new WebSocket(url).
+
 2015-07-03  Daniel Bates  <[email protected]>
 
         REGRESSION (r178097): _javascript_ TypeError after clicking on compose button in Yahoo Mail

Modified: releases/WebKitGTK/webkit-2.8/LayoutTests/fast/dom/HTMLSelectElement/add-expected.txt (186449 => 186450)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/fast/dom/HTMLSelectElement/add-expected.txt	2015-07-07 11:55:04 UTC (rev 186449)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/fast/dom/HTMLSelectElement/add-expected.txt	2015-07-07 12:15:10 UTC (rev 186450)
@@ -35,7 +35,7 @@
 PASS testAdd(createOption("Y20"), -Infinity) is "Y20,0,1,2"
 PASS testAdd(createOption("Y21"), "foo") is "Y21,0,1,2"
 PASS testAdd(createOption("Y22"), NaN) is "Y22,0,1,2"
-PASS testAdd(createOption("Y23"), undefined) is "Y23,0,1,2"
+PASS testAdd(createOption("Y23"), undefined) is "0,1,2,Y23"
 PASS testAdd(createOption("Y24"), -2) is "0,1,2,Y24"
 PASS testAdd(createOption("X"), mySelect.options[0]) is "X,0,1,2"
 PASS testAdd(createOption("X"), mySelect.options[1]) is "0,X,1,2"

Modified: releases/WebKitGTK/webkit-2.8/LayoutTests/fast/dom/HTMLSelectElement/add.html (186449 => 186450)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/fast/dom/HTMLSelectElement/add.html	2015-07-07 11:55:04 UTC (rev 186449)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/fast/dom/HTMLSelectElement/add.html	2015-07-07 12:15:10 UTC (rev 186450)
@@ -49,7 +49,7 @@
 shouldBeEqualToString('testAdd(createOption("Y20"), -Infinity)', "Y20,0,1,2");
 shouldBeEqualToString('testAdd(createOption("Y21"), "foo")', "Y21,0,1,2");
 shouldBeEqualToString('testAdd(createOption("Y22"), NaN)', "Y22,0,1,2");
-shouldBeEqualToString('testAdd(createOption("Y23"), undefined)', "Y23,0,1,2");
+shouldBeEqualToString('testAdd(createOption("Y23"), undefined)', "0,1,2,Y23");
 shouldBeEqualToString('testAdd(createOption("Y24"), -2)', "0,1,2,Y24");
 shouldBeEqualToString('testAdd(createOption("X"), mySelect.options[0])', "X,0,1,2");
 shouldBeEqualToString('testAdd(createOption("X"), mySelect.options[1])', "0,X,1,2");

Modified: releases/WebKitGTK/webkit-2.8/LayoutTests/fast/dom/HTMLSelectElement/options-collection-add-expected.txt (186449 => 186450)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/fast/dom/HTMLSelectElement/options-collection-add-expected.txt	2015-07-07 11:55:04 UTC (rev 186449)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/fast/dom/HTMLSelectElement/options-collection-add-expected.txt	2015-07-07 12:15:10 UTC (rev 186450)
@@ -45,7 +45,7 @@
 PASS testAdd(createOption("Y20"), -Infinity) is "Y20,0,1,2"
 PASS testAdd(createOption("Y21"), "foo") is "Y21,0,1,2"
 PASS testAdd(createOption("Y22"), NaN) is "Y22,0,1,2"
-PASS testAdd(createOption("Y23"), undefined) is "Y23,0,1,2"
+PASS testAdd(createOption("Y23"), undefined) is "0,1,2,Y23"
 PASS testAdd(createOption("Y24"), -2) is "0,1,2,Y24"
 PASS testAdd(createOption("X"), mySelect.options[0]) is "X,0,1,2"
 PASS testAdd(createOption("X"), mySelect.options[1]) is "0,X,1,2"

Modified: releases/WebKitGTK/webkit-2.8/LayoutTests/fast/dom/HTMLSelectElement/options-collection-add.html (186449 => 186450)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/fast/dom/HTMLSelectElement/options-collection-add.html	2015-07-07 11:55:04 UTC (rev 186449)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/fast/dom/HTMLSelectElement/options-collection-add.html	2015-07-07 12:15:10 UTC (rev 186450)
@@ -69,7 +69,7 @@
 shouldBeEqualToString('testAdd(createOption("Y20"), -Infinity)', "Y20,0,1,2");
 shouldBeEqualToString('testAdd(createOption("Y21"), "foo")', "Y21,0,1,2");
 shouldBeEqualToString('testAdd(createOption("Y22"), NaN)', "Y22,0,1,2");
-shouldBeEqualToString('testAdd(createOption("Y23"), undefined)', "Y23,0,1,2");
+shouldBeEqualToString('testAdd(createOption("Y23"), undefined)', "0,1,2,Y23");
 shouldBeEqualToString('testAdd(createOption("Y24"), -2)', "0,1,2,Y24");
 shouldBeEqualToString('testAdd(createOption("X"), mySelect.options[0])', "X,0,1,2");
 shouldBeEqualToString('testAdd(createOption("X"), mySelect.options[1])', "0,X,1,2");

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/websocket/tests/hybi/undefined-protocol-expected.txt (0 => 186450)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/websocket/tests/hybi/undefined-protocol-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/websocket/tests/hybi/undefined-protocol-expected.txt	2015-07-07 12:15:10 UTC (rev 186450)
@@ -0,0 +1,16 @@
+Test that passing undefined as protocols is equivalent to not passing any protocols
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS ws.protocol is ""
+Connected
+PASS ws.protocol is ""
+Closed
+PASS ws.protocol is ""
+PASS closeEvent.wasClean is true
+Exited onclose handler
+PASS ws.protocol is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/websocket/tests/hybi/undefined-protocol.html (0 => 186450)


--- releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/websocket/tests/hybi/undefined-protocol.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/LayoutTests/http/tests/websocket/tests/hybi/undefined-protocol.html	2015-07-07 12:15:10 UTC (rev 186450)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script type="text/_javascript_">
+description("Test that passing undefined as protocols is equivalent to not passing any protocols");
+
+window.jsTestIsAsync = true;
+
+var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/hybi/simple", undefined);
+var closeEvent;
+
+shouldBeEqualToString("ws.protocol", "");
+
+ws._onopen_ = function()
+{
+    debug("Connected");
+    shouldBeEqualToString("ws.protocol", "");
+};
+
+ws._onclose_ = function(event)
+{
+    debug("Closed");
+    shouldBeEqualToString("ws.protocol", "");
+    closeEvent = event;
+    shouldBeTrue("closeEvent.wasClean");
+    setTimeout("checkAfterOnClose()", 0);
+};
+
+function checkAfterOnClose()
+{
+    debug("Exited onclose handler");
+    shouldBeEqualToString("ws.protocol", "");
+    finishJSTest();
+}
+
+</script>
+<script src=""
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (186449 => 186450)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-07-07 11:55:04 UTC (rev 186449)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-07-07 12:15:10 UTC (rev 186450)
@@ -1,3 +1,44 @@
+2015-07-03  Chris Dumez  <[email protected]>
+
+        REGRESSION (r178097): HTMLSelectElement.add(option, undefined) prepends option to the list of options; should append to the end of the list of options
+        https://bugs.webkit.org/show_bug.cgi?id=146566
+        <rdar://problem/21663919>
+
+        Reviewed by Ryosuke Niwa.
+
+        HTMLSelectElement.add(X, undefined) is supposed to be equivalent to
+        HTMLSelectElement.add(X) which should *append* X. The same is true
+        for HTMLOptionsCollection.add(X, undefined).
+
+        However, due to a bug in our bindings generator for overloaded
+        operations, the actual behavior was not the expected one. The
+        second overload would be chosen: add(X, index) and undefined would
+        be converted as 0-index, which would *prepend* X.
+
+        This patch fixes the bindings generator so that undefined is allowed
+        for optional parameters of an overload operation, when doing the
+        overload resolution.
+
+        Tests:
+        - fast/dom/HTMLSelectElement/add.html
+        - fast/dom/HTMLSelectElement/options-collection-add.html
+        - http/tests/websocket/tests/hybi/undefined-protocol.html
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateParametersCheckExpression):
+        Allow undefined value for optional parameters when doing the overload
+        resolution.
+
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter):
+        * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
+        (WebCore::JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors):
+        * bindings/scripts/test/TestObj.idl:
+        Add bindings tests coverage and rebaseline.
+
 2015-07-03  Kyounga Ra  <[email protected]>
 
         Memory leak for a protected Element having pending events in ImageLoader. 

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (186449 => 186450)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2015-07-07 11:55:04 UTC (rev 186449)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2015-07-07 12:15:10 UTC (rev 186450)
@@ -1334,20 +1334,22 @@
             # For Callbacks only checks if the value is null or object.
             push(@andExpression, "(${value}.isNull() || ${value}.isFunction())");
             $usedArguments{$parameterIndex} = 1;
-        } elsif ($codeGenerator->GetArrayType($type) || $codeGenerator->GetSequenceType($type)) {
-            # FIXME: Add proper support for T[], T[]?, sequence<T>
-            if ($parameter->isNullable) {
-                push(@andExpression, "(${value}.isNull() || (${value}.isObject() && isJSArray(${value})))");
-            } else {
-                push(@andExpression, "(${value}.isObject() && isJSArray(${value}))");
-            }
-            $usedArguments{$parameterIndex} = 1;
         } elsif (!IsNativeType($type)) {
-            if ($parameter->isNullable) {
-                push(@andExpression, "(${value}.isNull() || (${value}.isObject() && asObject(${value})->inherits(JS${type}::info())))");
+            my $condition = "";
+            $condition .= "${value}.isUndefined() || " if $parameter->isOptional;
+
+            # FIXME: WebIDL says that undefined is also acceptable for nullable parameters and
+            # should be converted to null:
+            # http://heycam.github.io/webidl/#es-nullable-type
+            $condition .= "${value}.isNull() || " if $parameter->isNullable;
+
+            if ($codeGenerator->GetArrayType($type) || $codeGenerator->GetSequenceType($type)) {
+                # FIXME: Add proper support for T[], T[]?, sequence<T>.
+                $condition .= "(${value}.isObject() && isJSArray(${value}))";
             } else {
-                push(@andExpression, "(${value}.isObject() && asObject(${value})->inherits(JS${type}::info()))");
+                $condition .= "(${value}.isObject() && asObject(${value})->inherits(JS${type}::info()))";
             }
+            push(@andExpression, "(" . $condition . ")");
             $usedArguments{$parameterIndex} = 1;
         }
         $parameterIndex++;

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (186449 => 186450)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2015-07-07 11:55:04 UTC (rev 186449)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2015-07-07 12:15:10 UTC (rev 186450)
@@ -127,6 +127,7 @@
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConditionalMethod3(JSC::ExecState*);
 #endif
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionClassMethod(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionClassMethodWithOptional(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionClassMethod2(JSC::ExecState*);
@@ -622,6 +623,7 @@
     { 0, 0, NoIntrinsic, 0, 0 },
 #endif
     { "overloadedMethod", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOverloadedMethod), (intptr_t) (2) },
+    { "overloadedMethodWithOptionalParameter", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter), (intptr_t) (1) },
     { "classMethodWithClamp", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionClassMethodWithClamp), (intptr_t) (2) },
     { "methodWithUnsignedLongSequence", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence), (intptr_t) (1) },
     { "stringArrayFunction", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionStringArrayFunction), (intptr_t) (1) },
@@ -3896,11 +3898,11 @@
         return jsTestObjPrototypeFunctionOverloadedMethod6(exec);
     if ((argsCount == 1 && (arg0.isNull() || (arg0.isObject() && isJSArray(arg0)))))
         return jsTestObjPrototypeFunctionOverloadedMethod7(exec);
-    if ((argsCount == 1 && (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info()))))
+    if ((argsCount == 1 && ((arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info())))))
         return jsTestObjPrototypeFunctionOverloadedMethod8(exec);
-    if ((argsCount == 1 && (arg0.isObject() && isJSArray(arg0))))
+    if ((argsCount == 1 && ((arg0.isObject() && isJSArray(arg0)))))
         return jsTestObjPrototypeFunctionOverloadedMethod9(exec);
-    if ((argsCount == 1 && (arg0.isObject() && isJSArray(arg0))))
+    if ((argsCount == 1 && ((arg0.isObject() && isJSArray(arg0)))))
         return jsTestObjPrototypeFunctionOverloadedMethod10(exec);
     if (argsCount == 1)
         return jsTestObjPrototypeFunctionOverloadedMethod11(exec);
@@ -3911,6 +3913,74 @@
     return throwVMTypeError(exec);
 }
 
+static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1(ExecState* exec)
+{
+    JSValue thisValue = exec->thisValue();
+    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*exec, "TestObj", "overloadedMethodWithOptionalParameter");
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto& impl = castedThis->impl();
+    if (UNLIKELY(exec->argumentCount() < 1))
+        return throwVMError(exec, createNotEnoughArgumentsError(exec));
+    TestObj* objArg1 = JSTestObj::toWrapped(exec->argument(0));
+    if (UNLIKELY(exec->hadException()))
+        return JSValue::encode(jsUndefined());
+
+    size_t argsCount = exec->argumentCount();
+    if (argsCount <= 1) {
+        impl.overloadedMethodWithOptionalParameter(objArg1);
+        return JSValue::encode(jsUndefined());
+    }
+
+    TestObj* objArg2 = JSTestObj::toWrapped(exec->argument(1));
+    if (UNLIKELY(exec->hadException()))
+        return JSValue::encode(jsUndefined());
+    impl.overloadedMethodWithOptionalParameter(objArg1, objArg2);
+    return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2(ExecState* exec)
+{
+    JSValue thisValue = exec->thisValue();
+    JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*exec, "TestObj", "overloadedMethodWithOptionalParameter");
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto& impl = castedThis->impl();
+    if (UNLIKELY(exec->argumentCount() < 1))
+        return throwVMError(exec, createNotEnoughArgumentsError(exec));
+    TestObj* objArg = JSTestObj::toWrapped(exec->argument(0));
+    if (UNLIKELY(exec->hadException()))
+        return JSValue::encode(jsUndefined());
+
+    size_t argsCount = exec->argumentCount();
+    if (argsCount <= 1) {
+        impl.overloadedMethodWithOptionalParameter(objArg);
+        return JSValue::encode(jsUndefined());
+    }
+
+    int longArg = toInt32(exec, exec->argument(1), NormalConversion);
+    if (UNLIKELY(exec->hadException()))
+        return JSValue::encode(jsUndefined());
+    impl.overloadedMethodWithOptionalParameter(objArg, longArg);
+    return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter(ExecState* exec)
+{
+    size_t argsCount = std::min<size_t>(2, exec->argumentCount());
+    JSValue arg0(exec->argument(0));
+    JSValue arg1(exec->argument(1));
+    if ((argsCount == 1 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info())))) || (argsCount == 2 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info()))) && (arg1.isUndefined() || arg1.isNull() || (arg1.isObject() && asObject(arg1)->inherits(JSTestObj::info())))))
+        return jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1(exec);
+    if ((argsCount == 1 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info())))) || (argsCount == 2 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(JSTestObj::info())))))
+        return jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2(exec);
+    if (argsCount < 1)
+        return throwVMError(exec, createNotEnoughArgumentsError(exec));
+    return throwVMTypeError(exec);
+}
+
 EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionClassMethod(ExecState* exec)
 {
     TestObj::classMethod();

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp (186449 => 186450)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp	2015-07-07 11:55:04 UTC (rev 186449)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp	2015-07-07 12:15:10 UTC (rev 186450)
@@ -152,11 +152,11 @@
 {
     size_t argsCount = std::min<size_t>(1, exec->argumentCount());
     JSValue arg0(exec->argument(0));
-    if ((argsCount == 1 && (arg0.isObject() && asObject(arg0)->inherits(JSArrayBuffer::info()))))
+    if ((argsCount == 1 && ((arg0.isObject() && asObject(arg0)->inherits(JSArrayBuffer::info())))))
         return JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors1(exec);
-    if ((argsCount == 1 && (arg0.isObject() && asObject(arg0)->inherits(JSArrayBufferView::info()))))
+    if ((argsCount == 1 && ((arg0.isObject() && asObject(arg0)->inherits(JSArrayBufferView::info())))))
         return JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors2(exec);
-    if ((argsCount == 1 && (arg0.isObject() && asObject(arg0)->inherits(JSBlob::info()))))
+    if ((argsCount == 1 && ((arg0.isObject() && asObject(arg0)->inherits(JSBlob::info())))))
         return JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors3(exec);
     if (argsCount == 1)
         return JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors4(exec);

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/bindings/scripts/test/TestObj.idl (186449 => 186450)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/bindings/scripts/test/TestObj.idl	2015-07-07 11:55:04 UTC (rev 186449)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/bindings/scripts/test/TestObj.idl	2015-07-07 12:15:10 UTC (rev 186450)
@@ -193,6 +193,9 @@
 
     // FIXME: Implement support for overloaded functions with variadic arguments.
     void    overloadedMethod(Blob... blobArgs);
+
+    void overloadedMethodWithOptionalParameter(TestObj? objArg1, optional TestObj? objArg2);
+    void overloadedMethodWithOptionalParameter(TestObj? objArg, optional long longArg);
 #endif
 
     // Class methods within _javascript_ (like what's used for IDBKeyRange).
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to