Title: [201364] trunk/Source/_javascript_Core
Revision
201364
Author
keith_mil...@apple.com
Date
2016-05-24 17:12:37 -0700 (Tue, 24 May 2016)

Log Message

TypedArray.prototype.slice should not throw if no arguments are provided
https://bugs.webkit.org/show_bug.cgi?id=158044
<rdar://problem/26433280>

Reviewed by Geoffrey Garen.

We were throwing an exception if the TypedArray.prototype.slice function
was not provided arguments. This was wrong. Instead we should just assume
the first argument was 0.

* runtime/JSGenericTypedArrayViewPrototypeFunctions.h:
(JSC::genericTypedArrayViewProtoFuncSlice): Deleted.
* tests/stress/typedarray-slice.js:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (201363 => 201364)


--- trunk/Source/_javascript_Core/ChangeLog	2016-05-24 23:49:57 UTC (rev 201363)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-05-25 00:12:37 UTC (rev 201364)
@@ -1,5 +1,21 @@
 2016-05-24  Keith Miller  <keith_mil...@apple.com>
 
+        TypedArray.prototype.slice should not throw if no arguments are provided
+        https://bugs.webkit.org/show_bug.cgi?id=158044
+        <rdar://problem/26433280>
+
+        Reviewed by Geoffrey Garen.
+
+        We were throwing an exception if the TypedArray.prototype.slice function
+        was not provided arguments. This was wrong. Instead we should just assume
+        the first argument was 0.
+
+        * runtime/JSGenericTypedArrayViewPrototypeFunctions.h:
+        (JSC::genericTypedArrayViewProtoFuncSlice): Deleted.
+        * tests/stress/typedarray-slice.js:
+
+2016-05-24  Keith Miller  <keith_mil...@apple.com>
+
         LLInt should be able to cache prototype loads for values in GetById
         https://bugs.webkit.org/show_bug.cgi?id=158032
 

Modified: trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewPrototypeFunctions.h (201363 => 201364)


--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewPrototypeFunctions.h	2016-05-24 23:49:57 UTC (rev 201363)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewPrototypeFunctions.h	2016-05-25 00:12:37 UTC (rev 201364)
@@ -370,9 +370,6 @@
     if (thisObject->isNeutered())
         return throwVMTypeError(exec, typedArrayBufferHasBeenDetachedErrorMessage);
 
-    if (!exec->argumentCount())
-        return throwVMError(exec, createTypeError(exec, "Expected at least one argument"));
-
     unsigned thisLength = thisObject->length();
 
     unsigned begin = argumentClampedIndexFromStartOrEnd(exec, 0, thisLength);

Modified: trunk/Source/_javascript_Core/tests/stress/typedarray-slice.js (201363 => 201364)


--- trunk/Source/_javascript_Core/tests/stress/typedarray-slice.js	2016-05-24 23:49:57 UTC (rev 201363)
+++ trunk/Source/_javascript_Core/tests/stress/typedarray-slice.js	2016-05-25 00:12:37 UTC (rev 201364)
@@ -16,6 +16,7 @@
 shouldBeTrue("testPrototypeFunction('slice', '(2, 3)', [12, 5, 8, 13, 44], [8], [12, 5, 8, 13, 44])");
 shouldBeTrue("testPrototypeFunction('slice', '(5, 5)', [12, 5, 8, 13, 44], [])");
 shouldBeTrue("testPrototypeFunction('slice', '(0, 5)', [12, 5, 8, 13, 44], [12, 5, 8, 13, 44])");
+shouldBeTrue("testPrototypeFunction('slice', '()', [12, 5, 8, 13, 44], [12, 5, 8, 13, 44])");
 shouldBeTrue("testPrototypeFunction('slice', '(0, -5)', [12, 5, 8, 13, 44], [])");
 shouldBeTrue("testPrototypeFunction('slice', '(-3, -2)', [12, 5, 8, 13, 44], [8])");
 shouldBeTrue("testPrototypeFunction('slice', '(4, 2)', [12, 5, 8, 13, 44], [])");
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to