'length' property of DOM bindings functions returns wrong value
authorch.dumez@sisa.samsung.com <ch.dumez@sisa.samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Apr 2013 21:59:26 +0000 (21:59 +0000)
committerch.dumez@sisa.samsung.com <ch.dumez@sisa.samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Apr 2013 21:59:26 +0000 (21:59 +0000)
commit871f0b586e162c758edab2de55f2d49f23a58791
tree5859e0343dccb31b12b1b54b4cca6b82faef5c30
parent9090a42eeaefdd7fd86951aaead7b590723ed36f
'length' property of DOM bindings functions returns wrong value
https://bugs.webkit.org/show_bug.cgi?id=110569

Reviewed by Geoffrey Garen.

Source/WebCore:

Make the 'length' property of Function objects and Interface
objects behave according to the latest Web IDL specification
editor draft:
http://dev.w3.org/2006/webapi/WebIDL/#es-interface-call
http://dev.w3.org/2006/webapi/WebIDL/#es-operations

As a result, only mandatory arguments are taken into account
when computing the value for the 'length' property. This
behavior is consistent with Firefox and Blink.

Tests: fast/js/constructor-length.html
       fast/js/function-length.html

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
(GenerateConstructorHelperMethods):
Update the JSC code generator to only account for mandatory parameters
when computing the value for the 'length' property of Function objects
and constructors.

* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
(WebCore::JSTestActiveDOMObjectConstructor::finishCreation):
* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
(WebCore::JSTestCustomNamedGetterConstructor::finishCreation):
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
(WebCore::JSTestEventConstructorConstructor::finishCreation):
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::JSTestEventTargetConstructor::finishCreation):
(WebCore):
* bindings/scripts/test/JS/JSTestException.cpp:
(WebCore::JSTestExceptionConstructor::finishCreation):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSTestInterfaceConstructor::finishCreation):
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
(WebCore::JSTestMediaQueryListListenerConstructor::finishCreation):
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
(WebCore::JSTestNamedConstructorConstructor::finishCreation):
(WebCore::JSTestNamedConstructorNamedConstructor::finishCreation):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore):
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
(WebCore::JSTestSerializedScriptValueInterfaceConstructor::finishCreation):
(WebCore):
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
(WebCore):
Rebaseline bindings tests results.

* fileapi/Blob.idl:
Remove 'ConstructorParameters=2' extended attribute as the correct value
is 0, given that a Blob can be constructed without parameter.

* html/canvas/DataView.idl:
Update ConstructorParameters extended attribute value from 3 to 1 as only
one of the 3 parameters is mandatory.

* html/canvas/Float32Array.idl:
* html/canvas/Float64Array.idl:
* html/canvas/Int16Array.idl:
* html/canvas/Int32Array.idl:
* html/canvas/Int8Array.idl:
* html/canvas/Uint16Array.idl:
* html/canvas/Uint32Array.idl:
* html/canvas/Uint8Array.idl:
* html/canvas/Uint8ClampedArray.idl:
Remove 'ConstructorParameters=1' extended attribute from interfaces using
'ConstructorTemplate=TypedArray' as the bindings generator now properly
compute the number of constructor parameters for such interfaces.

* page/WebKitPoint.idl:
Remove 'ConstructorParameters=2' extended attribute as the correct value
should be 0, given that a WebKitPoint can be constructed without parameters.

LayoutTests:

Update fast/js/constructor-length.html test case now that only
mandatory arguments are considered for the constructor length.

Also add a new fast/js/function-length.html test to make sure
that the 'length' property of Function objects from DOM
bindings behaves according to the Web IDL specification as
this was not covered by existing tests.

* fast/files/blob-constructor-expected.txt: Rebaseline.
* fast/files/script-tests/blob-constructor.js: Update test now that Blob constructor
length is 0 instead of 2.
* fast/js/constructor-length.html:
* fast/js/function-length-expected.txt: Added.
* fast/js/function-length.html: Added.
* platform/blackberry/fast/js/constructor-length-expected.txt: Rebaseline.
* platform/efl/TestExpectations: Unskip fast/js/constructor-length.html for EFL port.
* platform/efl/fast/js/constructor-length-expected.txt: Copied from LayoutTests/platform/mac/fast/js/constructor-length-expected.txt.
* platform/gtk/fast/js/constructor-length-expected.txt: Rebaseline.
* platform/mac/fast/js/constructor-length-expected.txt: Rebaseline.
* platform/qt/fast/js/constructor-length-expected.txt: Rebaseline.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@148997 268f45cc-cd09-0410-ab3c-d52691b4dbfc
37 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/files/blob-constructor-expected.txt
LayoutTests/fast/files/script-tests/blob-constructor.js
LayoutTests/fast/js/constructor-length.html
LayoutTests/fast/js/function-length-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/function-length.html [new file with mode: 0644]
LayoutTests/platform/blackberry/fast/js/constructor-length-expected.txt
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/efl/fast/js/constructor-length-expected.txt [new file with mode: 0644]
LayoutTests/platform/gtk/fast/js/constructor-length-expected.txt
LayoutTests/platform/mac/fast/js/constructor-length-expected.txt
LayoutTests/platform/qt/fast/js/constructor-length-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp
Source/WebCore/fileapi/Blob.idl
Source/WebCore/html/canvas/DataView.idl
Source/WebCore/html/canvas/Float32Array.idl
Source/WebCore/html/canvas/Float64Array.idl
Source/WebCore/html/canvas/Int16Array.idl
Source/WebCore/html/canvas/Int32Array.idl
Source/WebCore/html/canvas/Int8Array.idl
Source/WebCore/html/canvas/Uint16Array.idl
Source/WebCore/html/canvas/Uint32Array.idl
Source/WebCore/html/canvas/Uint8Array.idl
Source/WebCore/html/canvas/Uint8ClampedArray.idl
Source/WebCore/page/WebKitPoint.idl