Title: [161702] trunk
Revision
161702
Author
[email protected]
Date
2014-01-10 17:09:58 -0800 (Fri, 10 Jan 2014)

Log Message

[JSC] Revise typed array implementations to match ECMAScript and WebGL Specification
https://bugs.webkit.org/show_bug.cgi?id=126754

Reviewed by Filip Pizlo.

Source/_javascript_Core:

The ECMAScript specification forbids calling the typed array
constructors without using "new". Change the call data to return
none so we throw and exception in these cases.

* runtime/JSGenericTypedArrayViewConstructorInlines.h:
(JSC::JSGenericTypedArrayViewConstructor<ViewClass>::getCallData):

LayoutTests:

New test which checks that we throw an exception when calling
any of the typed array constructors without using "new".

* js/script-tests/typedarray-constructors.js: Added.
* js/typedarray-constructors-expected.txt: Added.
* js/typedarray-constructors.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (161701 => 161702)


--- trunk/LayoutTests/ChangeLog	2014-01-11 01:05:18 UTC (rev 161701)
+++ trunk/LayoutTests/ChangeLog	2014-01-11 01:09:58 UTC (rev 161702)
@@ -1,3 +1,17 @@
+2014-01-10  Dean Jackson  <[email protected]>
+
+        [JSC] Revise typed array implementations to match ECMAScript and WebGL Specification
+        https://bugs.webkit.org/show_bug.cgi?id=126754
+
+        Reviewed by Filip Pizlo.
+
+        New test which checks that we throw an exception when calling
+        any of the typed array constructors without using "new".
+
+        * js/script-tests/typedarray-constructors.js: Added.
+        * js/typedarray-constructors-expected.txt: Added.
+        * js/typedarray-constructors.html: Added.
+
 2014-01-10  Myles C. Maxfield  <[email protected]>
 
         CSS word-spacing property does not obey percentages

Added: trunk/LayoutTests/js/script-tests/typedarray-constructors.js (0 => 161702)


--- trunk/LayoutTests/js/script-tests/typedarray-constructors.js	                        (rev 0)
+++ trunk/LayoutTests/js/script-tests/typedarray-constructors.js	2014-01-11 01:09:58 UTC (rev 161702)
@@ -0,0 +1,35 @@
+description(
+'This test case tests the various typed array and related constructors. ' +
+'In particular, makes sure that you use the "new" keyword when using the constructors.'
+);
+
+shouldThrow("Int8Array()");
+shouldNotThrow("new Int8Array()");
+
+shouldThrow("Int16Array()");
+shouldNotThrow("new Int16Array()");
+
+shouldThrow("Int32Array()");
+shouldNotThrow("new Int32Array()");
+
+shouldThrow("Uint8Array()");
+shouldNotThrow("new Uint8Array()");
+
+shouldThrow("Uint16Array()");
+shouldNotThrow("new Uint16Array()");
+
+shouldThrow("Uint32Array()");
+shouldNotThrow("new Uint32Array()");
+
+shouldThrow("Uint8ClampedArray()");
+shouldNotThrow("new Uint8ClampedArray()");
+
+shouldThrow("Float32Array()");
+shouldNotThrow("new Float32Array()");
+
+shouldThrow("Float64Array()");
+shouldNotThrow("new Float64Array()");
+
+shouldThrow("DataView(new ArrayBuffer())");
+shouldNotThrow("new DataView(new ArrayBuffer())");
+
Property changes on: trunk/LayoutTests/js/script-tests/typedarray-constructors.js
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/js/typedarray-constructors-expected.txt (0 => 161702)


--- trunk/LayoutTests/js/typedarray-constructors-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/js/typedarray-constructors-expected.txt	2014-01-11 01:09:58 UTC (rev 161702)
@@ -0,0 +1,29 @@
+This test case tests the various typed array and related constructors. In particular, makes sure that you use the "new" keyword when using the constructors.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Int8Array() threw exception TypeError: Function is not a function (evaluating 'Int8Array()').
+PASS new Int8Array() did not throw exception.
+PASS Int16Array() threw exception TypeError: Function is not a function (evaluating 'Int16Array()').
+PASS new Int16Array() did not throw exception.
+PASS Int32Array() threw exception TypeError: Function is not a function (evaluating 'Int32Array()').
+PASS new Int32Array() did not throw exception.
+PASS Uint8Array() threw exception TypeError: Function is not a function (evaluating 'Uint8Array()').
+PASS new Uint8Array() did not throw exception.
+PASS Uint16Array() threw exception TypeError: Function is not a function (evaluating 'Uint16Array()').
+PASS new Uint16Array() did not throw exception.
+PASS Uint32Array() threw exception TypeError: Function is not a function (evaluating 'Uint32Array()').
+PASS new Uint32Array() did not throw exception.
+PASS Uint8ClampedArray() threw exception TypeError: Function is not a function (evaluating 'Uint8ClampedArray()').
+PASS new Uint8ClampedArray() did not throw exception.
+PASS Float32Array() threw exception TypeError: Function is not a function (evaluating 'Float32Array()').
+PASS new Float32Array() did not throw exception.
+PASS Float64Array() threw exception TypeError: Function is not a function (evaluating 'Float64Array()').
+PASS new Float64Array() did not throw exception.
+PASS DataView(new ArrayBuffer()) threw exception TypeError: Function is not a function (evaluating 'DataView(new ArrayBuffer())').
+PASS new DataView(new ArrayBuffer()) did not throw exception.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/js/typedarray-constructors-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/js/typedarray-constructors.html (0 => 161702)


--- trunk/LayoutTests/js/typedarray-constructors.html	                        (rev 0)
+++ trunk/LayoutTests/js/typedarray-constructors.html	2014-01-11 01:09:58 UTC (rev 161702)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/js/typedarray-constructors.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/_javascript_Core/ChangeLog (161701 => 161702)


--- trunk/Source/_javascript_Core/ChangeLog	2014-01-11 01:05:18 UTC (rev 161701)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-01-11 01:09:58 UTC (rev 161702)
@@ -1,3 +1,17 @@
+2014-01-10  Dean Jackson  <[email protected]>
+
+        [JSC] Revise typed array implementations to match ECMAScript and WebGL Specification
+        https://bugs.webkit.org/show_bug.cgi?id=126754
+
+        Reviewed by Filip Pizlo.
+
+        The ECMAScript specification forbids calling the typed array
+        constructors without using "new". Change the call data to return
+        none so we throw and exception in these cases.
+
+        * runtime/JSGenericTypedArrayViewConstructorInlines.h:
+        (JSC::JSGenericTypedArrayViewConstructor<ViewClass>::getCallData):
+
 2014-01-10  Benjamin Poulain  <[email protected]>
 
         Remove the BlackBerry port from trunk

Modified: trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewConstructorInlines.h (161701 => 161702)


--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewConstructorInlines.h	2014-01-11 01:05:18 UTC (rev 161701)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewConstructorInlines.h	2014-01-11 01:09:58 UTC (rev 161702)
@@ -157,7 +157,7 @@
 CallType JSGenericTypedArrayViewConstructor<ViewClass>::getCallData(JSCell*, CallData& callData)
 {
     callData.native.function = constructGenericTypedArrayView<ViewClass>;
-    return CallTypeHost;
+    return CallTypeNone;
 }
 
 } // namespace JSC
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to