Title: [109035] trunk
Revision
109035
Author
hara...@chromium.org
Date
2012-02-27 15:59:55 -0800 (Mon, 27 Feb 2012)

Log Message

[JSC] Add [ConstructorParameters=] to all custom constructors
https://bugs.webkit.org/show_bug.cgi?id=78221

Reviewed by Adam Barth.

Source/WebCore:

This patch adds [ConstructorParameters=X] to IDL files that have
custom constructors, where X is the maximum number of arguments
of the constructor. [ConstructorParameters=X] is needed for custom
constructors, because custom constructors do not have a signature
in IDL files and thus CodeGeneratorJS.pm cannot know the number of
constructor arguments.

Test: fast/js/constructor-length.html

* dom/WebKitMutationObserver.idl:
* html/DOMFormData.idl:
* html/canvas/ArrayBuffer.idl:
* html/canvas/DataView.idl:
* 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:
* webaudio/AudioContext.idl:

* bindings/scripts/test/TestTypedArray.idl:

* bindings/scripts/test/JS/JSFloat64Array.cpp: Updated run-bindings-tests results.
(WebCore::JSFloat64ArrayConstructor::finishCreation):

LayoutTests:

The added tests check the length property of the custom constructors.

* fast/js/constructor-length.html:
* platform/mac/fast/js/constructor-length-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (109034 => 109035)


--- trunk/LayoutTests/ChangeLog	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/LayoutTests/ChangeLog	2012-02-27 23:59:55 UTC (rev 109035)
@@ -1,3 +1,15 @@
+2012-02-27  Kentaro Hara  <hara...@chromium.org>
+
+        [JSC] Add [ConstructorParameters=] to all custom constructors
+        https://bugs.webkit.org/show_bug.cgi?id=78221
+
+        Reviewed by Adam Barth.
+
+        The added tests check the length property of the custom constructors.
+
+        * fast/js/constructor-length.html:
+        * platform/mac/fast/js/constructor-length-expected.txt:
+
 2012-02-27  Adrienne Walker  <e...@google.com>
 
         [chromium] Unreviewed gardening, mark many svg tests as flaky crashers

Modified: trunk/LayoutTests/fast/js/constructor-length.html (109034 => 109035)


--- trunk/LayoutTests/fast/js/constructor-length.html	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/LayoutTests/fast/js/constructor-length.html	2012-02-27 23:59:55 UTC (rev 109035)
@@ -7,17 +7,26 @@
 <script>
 description("This tests the length property of constructors.");
 
+shouldBe('ArrayBuffer.length', '1');
+shouldBe('AudioContext.length', '0');
 shouldBe('BeforeLoadEvent.length', '2');
 shouldBe('CloseEvent.length', '2');
 shouldBe('CustomEvent.length', '2');
+shouldBe('DOMFormData.length', '0');
 shouldBe('DOMParser.length', '0');
 shouldBe('DOMURL.length', '0');
+shouldBe('DataView.length', '3');
 shouldBe('ErrorEvent.length', '2');
 shouldBe('Event.length', '2');
 shouldBe('EventSource.length', '1');
+shouldBe('Float32Array.length', '1');
+shouldBe('Float64Array.length', '1');
 shouldBe('FileReader.length', '0');
 shouldBe('FileReaderSync.length', '0');
 shouldBe('HashChangeEvent.length', '2');
+shouldBe('Int16Array.length', '1');
+shouldBe('Int32Array.length', '1');
+shouldBe('Int8Array.length', '1');
 shouldBe('Intent.length', '3');
 shouldBe('MediaController.length', '0');
 shouldBe('MediaStream.length', '2');
@@ -33,11 +42,18 @@
 shouldBe('StorageEvent.length', '2');
 shouldBe('TextTrackCue.length', '6');
 shouldBe('TrackEvent.length', '2');
+shouldBe('Uint16Array.length', '1');
+shouldBe('Uint32Array.length', '1');
+shouldBe('Uint8Array.length', '1');
+shouldBe('Uint8ClampedArray.length', '1');
 shouldBe('WebGLContextEvent.length', '2');
 shouldBe('WebKitAnimationEvent.length', '2');
 shouldBe('WebKitBlobBuilder.length', '0');
 shouldBe('WebKitCSSMatrix.length', '1');
+shouldBe('WebKitMutationObserver.length', '1');
+shouldBe('WebKitPoint.length', '2');
 shouldBe('WebKitTransitionEvent.length', '2');
+shouldBe('WebSocket.length', '1');
 shouldBe('Worker.length', '1');
 shouldBe('XMLHttpRequest.length', '0');
 shouldBe('XMLSerializer.length', '0');

Modified: trunk/LayoutTests/platform/mac/fast/js/constructor-length-expected.txt (109034 => 109035)


--- trunk/LayoutTests/platform/mac/fast/js/constructor-length-expected.txt	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/LayoutTests/platform/mac/fast/js/constructor-length-expected.txt	2012-02-27 23:59:55 UTC (rev 109035)
@@ -3,17 +3,26 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+PASS ArrayBuffer.length is 1
+FAIL AudioContext.length should be 0. Threw exception ReferenceError: Can't find variable: AudioContext
 PASS BeforeLoadEvent.length is 2
 PASS CloseEvent.length is 2
 PASS CustomEvent.length is 2
+FAIL DOMFormData.length should be 0. Threw exception ReferenceError: Can't find variable: DOMFormData
 PASS DOMParser.length is 0
 FAIL DOMURL.length should be 0. Threw exception ReferenceError: Can't find variable: DOMURL
+PASS DataView.length is 3
 PASS ErrorEvent.length is 2
 PASS Event.length is 2
 PASS EventSource.length is 1
+PASS Float32Array.length is 1
+PASS Float64Array.length is 1
 PASS FileReader.length is 0
 FAIL FileReaderSync.length should be 0. Threw exception ReferenceError: Can't find variable: FileReaderSync
 PASS HashChangeEvent.length is 2
+PASS Int16Array.length is 1
+PASS Int32Array.length is 1
+PASS Int8Array.length is 1
 FAIL Intent.length should be 3. Threw exception ReferenceError: Can't find variable: Intent
 PASS MediaController.length is 0
 FAIL MediaStream.length should be 2. Threw exception ReferenceError: Can't find variable: MediaStream
@@ -29,11 +38,18 @@
 PASS StorageEvent.length is 2
 PASS TextTrackCue.length is 6
 PASS TrackEvent.length is 2
+PASS Uint16Array.length is 1
+PASS Uint32Array.length is 1
+PASS Uint8Array.length is 1
+PASS Uint8ClampedArray.length is 1
 PASS WebGLContextEvent.length is 2
 PASS WebKitAnimationEvent.length is 2
 PASS WebKitBlobBuilder.length is 0
 PASS WebKitCSSMatrix.length is 1
+PASS WebKitMutationObserver.length is 1
+PASS WebKitPoint.length is 2
 PASS WebKitTransitionEvent.length is 2
+PASS WebSocket.length is 1
 PASS Worker.length is 1
 PASS XMLHttpRequest.length is 0
 PASS XMLSerializer.length is 0

Modified: trunk/Source/WebCore/ChangeLog (109034 => 109035)


--- trunk/Source/WebCore/ChangeLog	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/ChangeLog	2012-02-27 23:59:55 UTC (rev 109035)
@@ -1,3 +1,39 @@
+2012-02-27  Kentaro Hara  <hara...@chromium.org>
+
+        [JSC] Add [ConstructorParameters=] to all custom constructors
+        https://bugs.webkit.org/show_bug.cgi?id=78221
+
+        Reviewed by Adam Barth.
+
+        This patch adds [ConstructorParameters=X] to IDL files that have
+        custom constructors, where X is the maximum number of arguments
+        of the constructor. [ConstructorParameters=X] is needed for custom
+        constructors, because custom constructors do not have a signature
+        in IDL files and thus CodeGeneratorJS.pm cannot know the number of
+        constructor arguments.
+
+        Test: fast/js/constructor-length.html
+
+        * dom/WebKitMutationObserver.idl:
+        * html/DOMFormData.idl:
+        * html/canvas/ArrayBuffer.idl:
+        * html/canvas/DataView.idl:
+        * 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:
+        * webaudio/AudioContext.idl:
+
+        * bindings/scripts/test/TestTypedArray.idl:
+
+        * bindings/scripts/test/JS/JSFloat64Array.cpp: Updated run-bindings-tests results.
+        (WebCore::JSFloat64ArrayConstructor::finishCreation):
+
 2012-02-23  Raphael Kubo da Costa  <k...@profusion.mobi>
 
         [BlackBerry][EFL] Provide dummy RunLoop implementations.

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSFloat64Array.cpp (109034 => 109035)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSFloat64Array.cpp	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSFloat64Array.cpp	2012-02-27 23:59:55 UTC (rev 109035)
@@ -65,6 +65,7 @@
     Base::finishCreation(exec->globalData());
     ASSERT(inherits(&s_info));
     putDirect(exec->globalData(), exec->propertyNames().prototype, JSFloat64ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly);
+    putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(123), ReadOnly | DontDelete | DontEnum);
 }
 
 bool JSFloat64ArrayConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)

Modified: trunk/Source/WebCore/bindings/scripts/test/TestTypedArray.idl (109034 => 109035)


--- trunk/Source/WebCore/bindings/scripts/test/TestTypedArray.idl	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/bindings/scripts/test/TestTypedArray.idl	2012-02-27 23:59:55 UTC (rev 109035)
@@ -27,6 +27,7 @@
 module html {
     interface [
         CustomConstructor,
+        ConstructorParameters=123,
         NumericIndexedGetter,
         CustomIndexedSetter,
         JSGenerateToNativeObject,

Modified: trunk/Source/WebCore/dom/WebKitMutationObserver.idl (109034 => 109035)


--- trunk/Source/WebCore/dom/WebKitMutationObserver.idl	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/dom/WebKitMutationObserver.idl	2012-02-27 23:59:55 UTC (rev 109035)
@@ -31,7 +31,8 @@
 module core {
     interface [
         Conditional=MUTATION_OBSERVERS,
-        CustomConstructor
+        CustomConstructor,
+        ConstructorParameters=1
     ] WebKitMutationObserver {
         [Custom] void observe(in Node target, in MutationObserverOptions options)
             raises(DOMException);

Modified: trunk/Source/WebCore/html/DOMFormData.idl (109034 => 109035)


--- trunk/Source/WebCore/html/DOMFormData.idl	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/html/DOMFormData.idl	2012-02-27 23:59:55 UTC (rev 109035)
@@ -32,6 +32,7 @@
 
     interface [
         CustomConstructor,
+        ConstructorParameters=1,
         JSGenerateToNativeObject,
         JSGenerateToJSObject,
         InterfaceName=FormData

Modified: trunk/Source/WebCore/html/canvas/ArrayBuffer.idl (109034 => 109035)


--- trunk/Source/WebCore/html/canvas/ArrayBuffer.idl	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/html/canvas/ArrayBuffer.idl	2012-02-27 23:59:55 UTC (rev 109035)
@@ -28,6 +28,7 @@
     interface [
         JSGenerateIsReachable=Impl,
         CustomConstructor,
+        ConstructorParameters=1,
         JSNoStaticTables
     ] ArrayBuffer {
         readonly attribute int byteLength;

Modified: trunk/Source/WebCore/html/canvas/DataView.idl (109034 => 109035)


--- trunk/Source/WebCore/html/canvas/DataView.idl	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/html/canvas/DataView.idl	2012-02-27 23:59:55 UTC (rev 109035)
@@ -27,6 +27,7 @@
 
     interface [
         CustomConstructor,
+        ConstructorParameters=3,
         CustomToJSObject,
         JSNoStaticTables
     ] DataView : ArrayBufferView {

Modified: trunk/Source/WebCore/html/canvas/Float32Array.idl (109034 => 109035)


--- trunk/Source/WebCore/html/canvas/Float32Array.idl	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/html/canvas/Float32Array.idl	2012-02-27 23:59:55 UTC (rev 109035)
@@ -27,6 +27,7 @@
 module html {
     interface [
         CustomConstructor,
+        ConstructorParameters=1,
         NumericIndexedGetter,
         CustomIndexedSetter,
         JSGenerateToNativeObject,

Modified: trunk/Source/WebCore/html/canvas/Float64Array.idl (109034 => 109035)


--- trunk/Source/WebCore/html/canvas/Float64Array.idl	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/html/canvas/Float64Array.idl	2012-02-27 23:59:55 UTC (rev 109035)
@@ -27,6 +27,7 @@
 module html {
     interface [
         CustomConstructor,
+        ConstructorParameters=1,
         NumericIndexedGetter,
         CustomIndexedSetter,
         JSGenerateToNativeObject,

Modified: trunk/Source/WebCore/html/canvas/Int16Array.idl (109034 => 109035)


--- trunk/Source/WebCore/html/canvas/Int16Array.idl	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/html/canvas/Int16Array.idl	2012-02-27 23:59:55 UTC (rev 109035)
@@ -26,6 +26,7 @@
 module html {
     interface [
         CustomConstructor,
+        ConstructorParameters=1,
         NumericIndexedGetter,
         CustomIndexedSetter,
         JSGenerateToNativeObject,

Modified: trunk/Source/WebCore/html/canvas/Int32Array.idl (109034 => 109035)


--- trunk/Source/WebCore/html/canvas/Int32Array.idl	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/html/canvas/Int32Array.idl	2012-02-27 23:59:55 UTC (rev 109035)
@@ -27,6 +27,7 @@
 module html {
     interface [
         CustomConstructor,
+        ConstructorParameters=1,
         NumericIndexedGetter,
         CustomIndexedSetter,
         JSGenerateToNativeObject,

Modified: trunk/Source/WebCore/html/canvas/Int8Array.idl (109034 => 109035)


--- trunk/Source/WebCore/html/canvas/Int8Array.idl	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/html/canvas/Int8Array.idl	2012-02-27 23:59:55 UTC (rev 109035)
@@ -27,6 +27,7 @@
 module html {
     interface [
         CustomConstructor,
+        ConstructorParameters=1,
         NumericIndexedGetter,
         CustomIndexedSetter,
         JSGenerateToNativeObject,

Modified: trunk/Source/WebCore/html/canvas/Uint16Array.idl (109034 => 109035)


--- trunk/Source/WebCore/html/canvas/Uint16Array.idl	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/html/canvas/Uint16Array.idl	2012-02-27 23:59:55 UTC (rev 109035)
@@ -27,6 +27,7 @@
 module html {
     interface [
         CustomConstructor,
+        ConstructorParameters=1,
         NumericIndexedGetter,
         CustomIndexedSetter,
         JSGenerateToNativeObject,

Modified: trunk/Source/WebCore/html/canvas/Uint32Array.idl (109034 => 109035)


--- trunk/Source/WebCore/html/canvas/Uint32Array.idl	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/html/canvas/Uint32Array.idl	2012-02-27 23:59:55 UTC (rev 109035)
@@ -27,6 +27,7 @@
 module html {
     interface [
         CustomConstructor,
+        ConstructorParameters=1,
         NumericIndexedGetter,
         CustomIndexedSetter,
         JSGenerateToNativeObject,

Modified: trunk/Source/WebCore/html/canvas/Uint8Array.idl (109034 => 109035)


--- trunk/Source/WebCore/html/canvas/Uint8Array.idl	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/html/canvas/Uint8Array.idl	2012-02-27 23:59:55 UTC (rev 109035)
@@ -27,6 +27,7 @@
 module html {
     interface [
         CustomConstructor,
+        ConstructorParameters=1,
         NumericIndexedGetter,
         CustomIndexedSetter,
         JSGenerateToNativeObject,

Modified: trunk/Source/WebCore/html/canvas/Uint8ClampedArray.idl (109034 => 109035)


--- trunk/Source/WebCore/html/canvas/Uint8ClampedArray.idl	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/html/canvas/Uint8ClampedArray.idl	2012-02-27 23:59:55 UTC (rev 109035)
@@ -27,6 +27,7 @@
 module html {
     interface [
         CustomConstructor,
+        ConstructorParameters=1,
         NumericIndexedGetter,
         CustomIndexedSetter,
         JSGenerateToNativeObject,

Modified: trunk/Source/WebCore/webaudio/AudioContext.idl (109034 => 109035)


--- trunk/Source/WebCore/webaudio/AudioContext.idl	2012-02-27 23:56:09 UTC (rev 109034)
+++ trunk/Source/WebCore/webaudio/AudioContext.idl	2012-02-27 23:59:55 UTC (rev 109035)
@@ -28,6 +28,7 @@
         Conditional=WEB_AUDIO,
         ActiveDOMObject,
         CustomConstructor,
+        ConstructorParameters=0,
         JSCustomMarkFunction,
 #if defined(V8_BINDING) && V8_BINDING
         EventTarget
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to