Diff
Modified: trunk/LayoutTests/ChangeLog (161788 => 161789)
--- trunk/LayoutTests/ChangeLog 2014-01-12 02:49:22 UTC (rev 161788)
+++ trunk/LayoutTests/ChangeLog 2014-01-12 02:51:19 UTC (rev 161789)
@@ -1,3 +1,19 @@
+2014-01-11 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.
+ * resources/standalone-pre.js: Add missing 'shouldNotThrow'
+ method (duplicated from resources/js-test-pre.js)
+
2014-01-10 Commit Queue <[email protected]>
Unreviewed, rolling out r161702.
Modified: trunk/LayoutTests/fast/canvas/webgl/data-view-test-expected.txt (161788 => 161789)
--- trunk/LayoutTests/fast/canvas/webgl/data-view-test-expected.txt 2014-01-12 02:49:22 UTC (rev 161788)
+++ trunk/LayoutTests/fast/canvas/webgl/data-view-test-expected.txt 2014-01-12 02:51:19 UTC (rev 161789)
@@ -4,7 +4,7 @@
Test for constructor not called as a function
-FAIL DataView(new ArrayBuffer) does not throw exception
+PASS DataView(new ArrayBuffer) threw exception
Test for constructor taking 1 argument
PASS view = new DataView(arayBuffer) is defined.
Added: trunk/LayoutTests/js/script-tests/typedarray-constructors.js (0 => 161789)
--- trunk/LayoutTests/js/script-tests/typedarray-constructors.js (rev 0)
+++ trunk/LayoutTests/js/script-tests/typedarray-constructors.js 2014-01-12 02:51:19 UTC (rev 161789)
@@ -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())");
+
Added: trunk/LayoutTests/js/typedarray-constructors-expected.txt (0 => 161789)
--- trunk/LayoutTests/js/typedarray-constructors-expected.txt (rev 0)
+++ trunk/LayoutTests/js/typedarray-constructors-expected.txt 2014-01-12 02:51:19 UTC (rev 161789)
@@ -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
+
Added: trunk/LayoutTests/js/typedarray-constructors.html (0 => 161789)
--- trunk/LayoutTests/js/typedarray-constructors.html (rev 0)
+++ trunk/LayoutTests/js/typedarray-constructors.html 2014-01-12 02:51:19 UTC (rev 161789)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/resources/standalone-pre.js (161788 => 161789)
--- trunk/LayoutTests/resources/standalone-pre.js 2014-01-12 02:49:22 UTC (rev 161788)
+++ trunk/LayoutTests/resources/standalone-pre.js 2014-01-12 02:51:19 UTC (rev 161789)
@@ -206,6 +206,14 @@
testFailed(_a + " should be undefined. Was " + _av);
}
+function shouldNotThrow(_a) {
+ try {
+ eval(_a);
+ testPassed(_a + " did not throw exception.");
+ } catch (e) {
+ testFailed(_a + " should not throw exception. Threw exception " + e + ".");
+ }
+}
function shouldThrow(_a, _e)
{
Modified: trunk/Source/_javascript_Core/ChangeLog (161788 => 161789)
--- trunk/Source/_javascript_Core/ChangeLog 2014-01-12 02:49:22 UTC (rev 161788)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-01-12 02:51:19 UTC (rev 161789)
@@ -1,3 +1,17 @@
+2014-01-11 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-11 Anders Carlsson <[email protected]>
Try to fix the build by introducing a constructor.
Modified: trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewConstructorInlines.h (161788 => 161789)
--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewConstructorInlines.h 2014-01-12 02:49:22 UTC (rev 161788)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewConstructorInlines.h 2014-01-12 02:51:19 UTC (rev 161789)
@@ -157,7 +157,7 @@
CallType JSGenericTypedArrayViewConstructor<ViewClass>::getCallData(JSCell*, CallData& callData)
{
callData.native.function = constructGenericTypedArrayView<ViewClass>;
- return CallTypeHost;
+ return CallTypeNone;
}
} // namespace JSC