REGRESSION (r178097): JavaScript TypeError after clicking on compose button in Yahoo...
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jul 2015 20:54:15 +0000 (20:54 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jul 2015 20:54:15 +0000 (20:54 +0000)
commit368e2a81a478dda836dca0e92ba8ef54d6c67954
treef5296f95b26211af777746c21a5fe3f6c473d9e5
parent6ec180293cab88affc44e57727fdfc7cb7e7806b
REGRESSION (r178097): JavaScript TypeError after clicking on compose button in Yahoo Mail
https://bugs.webkit.org/show_bug.cgi?id=146515
<rdar://problem/21348421>

Reviewed by Chris Dumez.

Source/WebCore:

Fixes an issue where extra arguments passed to a Web IDL overloaded function, whose implementation
is generated by the bindings generator script, are not ignored as per the note in section "Interface object [[Call]] method"
of the Web IDL spec, <http://www.w3.org/TR/2012/CR-WebIDL-20120419/> (19 April 2012).

Currently for an overloaded function the JavaScript bindings generator script emits code to
throw a TypeError when it cannot find a candidate function that takes the same number of
arguments as passed by a caller. Prior to the change made in bug #139179 (r178097), the
bindings code for HTMLSelectElement.add() was written by hand and ignored extra arguments
that were passed to it. Following this change, the bindings code for HTMLSelectElement.add()
is generated by the bindings generator script. Therefore, we throw a TypeError when Yahoo Mail
calls HTMLSelectElement.add() with extra arguments because the code emitted by the bindings
generator script does not ignore them.

* bindings/scripts/CodeGeneratorJS.pm:
(LengthOfLongestFunctionParameterList): Added. Computes the length of longest overload parameter list.
(GenerateOverloadedFunction): Emit code that ignores more arguments than LengthOfLongestFunctionParameterList().
(GenerateOverloadedConstructorDefinition): Ditto.
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod12): Added; expected result for an overloaded
function that takes a variadic number of Blob elements.
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod): Update expected result. The added
if-conditional expression for the IDL declaration overloadedMethod(Blob... blobArgs) is empty
because we do not support overloading of functions with variadic arguments.
(WebCore::jsTestObjConstructorFunctionOverloadedMethod1):
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
(WebCore::JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors5): Added; expected
result for an overloaded constructors that takes a variadic number of long arguments.
(WebCore::JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors): Update expected
result. The added if-conditional expression for the IDL declaration Constructor(long... longArgs) is empty
because we do not support overloading of constructors with variadic arguments.
* bindings/scripts/test/TestObj.idl: Added declaration overloadedMethod(Blob...). Also fixed
typo in license block text.
* bindings/scripts/test/TestOverloadedConstructors.idl: Added declaration Constructor(long... longArgs).
Also fixed typo in license block text.

LayoutTests:

Add new sub-tests to LayoutTests/fast/dom/HTMLSelectElement/{add, options-collection-add}.html,
simplify existing test code, share common code, and update expected results.

Additionally, update results for tests in LayoutTests/fast/canvas now that we ignore extra
arguments passed to a Web IDL overloaded function whose implementation is generated by the
bindings generator script.

* fast/canvas/canvas-overloads-drawImage-expected.txt:
* fast/canvas/canvas-overloads-setFillColor-expected.txt:
* fast/canvas/canvas-overloads-setShadow-expected.txt:
* fast/canvas/canvas-overloads-setStrokeColor-expected.txt:
* fast/canvas/script-tests/canvas-overloads-drawImage.js:
* fast/canvas/script-tests/canvas-overloads-setFillColor.js:
* fast/canvas/script-tests/canvas-overloads-setShadow.js:
* fast/canvas/script-tests/canvas-overloads-setStrokeColor.js:
* 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:
* fast/dom/HTMLSelectElement/resources/html-select-and-options-collection-utilities.js: Added.
(createSelectElementWithTestData):
(deepCopy):
(createOption):
(createGroup):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@186265 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/canvas/canvas-overloads-drawImage-expected.txt
LayoutTests/fast/canvas/canvas-overloads-setFillColor-expected.txt
LayoutTests/fast/canvas/canvas-overloads-setShadow-expected.txt
LayoutTests/fast/canvas/canvas-overloads-setStrokeColor-expected.txt
LayoutTests/fast/canvas/script-tests/canvas-overloads-drawImage.js
LayoutTests/fast/canvas/script-tests/canvas-overloads-setFillColor.js
LayoutTests/fast/canvas/script-tests/canvas-overloads-setShadow.js
LayoutTests/fast/canvas/script-tests/canvas-overloads-setStrokeColor.js
LayoutTests/fast/dom/HTMLSelectElement/add-expected.txt
LayoutTests/fast/dom/HTMLSelectElement/add.html
LayoutTests/fast/dom/HTMLSelectElement/options-collection-add-expected.txt
LayoutTests/fast/dom/HTMLSelectElement/options-collection-add.html
LayoutTests/fast/dom/HTMLSelectElement/resources/html-select-and-options-collection-utilities.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp
Source/WebCore/bindings/scripts/test/TestObj.idl
Source/WebCore/bindings/scripts/test/TestOverloadedConstructors.idl