Bug 1155081 - Part 9: Replace ThrowError with ThrowTypeError in TypedArray.js. r=till
authorTooru Fujisawa <arai_a@mac.com>
Mon, 20 Apr 2015 13:58:17 +0900
changeset 239970 74ee493929092c9bd8d276cfa02613532843078e
parent 239969 156c934d3a6698e4d6ce135315b2772a1317cdf9
child 239971 757bedb296720e765b867d885938d6c7f4d67195
push id28618
push userkwierso@gmail.com
push dateMon, 20 Apr 2015 23:44:35 +0000
treeherdermozilla-central@bfbb2f3babcb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1155081
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1155081 - Part 9: Replace ThrowError with ThrowTypeError in TypedArray.js. r=till
js/src/builtin/TypedArray.js
--- a/js/src/builtin/TypedArray.js
+++ b/js/src/builtin/TypedArray.js
@@ -244,19 +244,19 @@ function TypedArrayFind(predicate, thisA
     // Steps 1-2.
     var O = this;
 
     // Steps 3-5.
     var len = TypedArrayLength(O);
 
     // Step 6.
     if (arguments.length === 0)
-        ThrowError(JSMSG_MISSING_FUN_ARG, 0, "%TypedArray%.prototype.find");
+        ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, "%TypedArray%.prototype.find");
     if (!IsCallable(predicate))
-        ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(0, predicate));
+        ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(0, predicate));
 
     // Step 7.
     var T = thisArg;
 
     // Steps 8-9.
     // Steps a (implicit), and g.
     for (var k = 0; k < len; k++) {
         // Steps a-c.
@@ -281,19 +281,19 @@ function TypedArrayFindIndex(predicate, 
     // Steps 1-2.
     var O = this;
 
     // Steps 3-5.
     var len = TypedArrayLength(O);
 
     // Step 6.
     if (arguments.length === 0)
-        ThrowError(JSMSG_MISSING_FUN_ARG, 0, "%TypedArray%.prototype.findIndex");
+        ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, "%TypedArray%.prototype.findIndex");
     if (!IsCallable(predicate))
-        ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(0, predicate));
+        ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(0, predicate));
 
     // Step 7.
     var T = thisArg;
 
     // Steps 8-9.
     // Steps a (implicit), and g.
     for (var k = 0; k < len; k++) {
         // Steps a-f.
@@ -316,19 +316,19 @@ function TypedArrayForEach(callbackfn, t
     // Step 1-2.
     var O = this;
 
     // Step 3-4.
     var len = TypedArrayLength(O);
 
     // Step 5.
     if (arguments.length === 0)
-	ThrowError(JSMSG_MISSING_FUN_ARG, 0, 'TypedArray.prototype.forEach');
+	ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'TypedArray.prototype.forEach');
     if (!IsCallable(callbackfn))
-	ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
+	ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
 
     // Step 6.
     var T = thisArg;
 
     // Step 7-8.
     // Step 7, 8a (implicit) and 8e.
     for (var k = 0; k < len; k++) {
 	// Step 8b-8c are unnecessary since the condition always holds true for TypedArray.
@@ -500,19 +500,19 @@ function TypedArrayMap(callbackfn, thisA
                             "TypedArrayMap");
     }
 
     // Step 4.
     var len = TypedArrayLength(O);
 
     // Step 5.
     if (arguments.length === 0)
-        ThrowError(JSMSG_MISSING_FUN_ARG, 0, '%TypedArray%.prototype.map');
+        ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, '%TypedArray%.prototype.map');
     if (!IsCallable(callbackfn))
-        ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
+        ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
 
     // Step 6.
     var T = thisArg;
 
     // Step 7.
     var defaultConstructor = _ConstructorForTypedArray(O);
 
     // Steps 8-9.
@@ -542,23 +542,23 @@ function TypedArrayReduce(callbackfn/*, 
     // Steps 1-2.
     var O = this;
 
     // Steps 3-5.
     var len = TypedArrayLength(O);
 
     // Step 6.
     if (arguments.length === 0)
-        ThrowError(JSMSG_MISSING_FUN_ARG, 0, "%TypedArray%.prototype.reduce");
+        ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, "%TypedArray%.prototype.reduce");
     if (!IsCallable(callbackfn))
-        ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
+        ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
 
     // Step 7.
     if (len === 0 && arguments.length === 1)
-        ThrowError(JSMSG_EMPTY_ARRAY_REDUCE);
+        ThrowTypeError(JSMSG_EMPTY_ARRAY_REDUCE);
 
     // Step 8.
     var k = 0;
 
     // Steps 9-10.
     // Omit some steps, since 'accumulator' should always be O[0] in step 10 for typed arrays.
     var accumulator = arguments.length > 1 ? arguments[1] : O[k++];
 
@@ -581,23 +581,23 @@ function TypedArrayReduceRight(callbackf
     // Steps 1-2.
     var O = this;
 
     // Steps 3-5.
     var len = TypedArrayLength(O);
 
     // Step 6.
     if (arguments.length === 0)
-        ThrowError(JSMSG_MISSING_FUN_ARG, 0, "%TypedArray%.prototype.reduceRight");
+        ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, "%TypedArray%.prototype.reduceRight");
     if (!IsCallable(callbackfn))
-        ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
+        ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
 
     // Step 7.
     if (len === 0 && arguments.length === 1)
-        ThrowError(JSMSG_EMPTY_ARRAY_REDUCE);
+        ThrowTypeError(JSMSG_EMPTY_ARRAY_REDUCE);
 
     // Step 8.
     var k = len - 1;
 
     // Steps 9-10.
     // Omit some steps, since 'accumulator' should always be O[len-1] in step 10 for typed arrays.
     var accumulator = arguments.length > 1 ? arguments[1] : O[k--];
 
@@ -719,19 +719,19 @@ function TypedArraySome(callbackfn, this
     // Steps 1-2.
     var O = this;
 
     // Steps 3-5.
     var len = TypedArrayLength(O);
 
     // Step 6.
     if (arguments.length === 0)
-        ThrowError(JSMSG_MISSING_FUN_ARG, 0, "%TypedArray%.prototype.some");
+        ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, "%TypedArray%.prototype.some");
     if (!IsCallable(callbackfn))
-        ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
+        ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(0, callbackfn));
 
     // Step 7.
     var T = thisArg;
 
     // Steps 8-9.
     // Omit steps 9.a-9.c and the 'if' clause in step 9.d, since there are no holes in typed arrays.
     for (var k = 0; k < len; k++) {
         // Steps 9.d.i-9.d.ii.
@@ -863,24 +863,24 @@ function TypedArrayIncludes(searchElemen
 
 // ES6 draft rev30 (2014/12/24) 22.2.2.1 %TypedArray%.from(source[, mapfn[, thisArg]]).
 function TypedArrayStaticFrom(source, mapfn = undefined, thisArg = undefined) {
     // Step 1.
     var C = this;
 
     // Step 2.
     if (!IsConstructor(C))
-        ThrowError(JSMSG_NOT_CONSTRUCTOR, DecompileArg(1, C));
+        ThrowTypeError(JSMSG_NOT_CONSTRUCTOR, DecompileArg(1, C));
 
     // Step 3.
     var f = mapfn;
 
     // Step 4.
     if (f !== undefined && !IsCallable(f))
-        ThrowError(JSMSG_NOT_FUNCTION, DecompileArg(1, f));
+        ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(1, f));
 
     // Steps 5-6.
     return TypedArrayFrom(C, undefined, source, f, thisArg);
 }
 
 // ES6 draft rev30 (2014/12/24) 22.2.2.1.1 TypedArrayFrom().
 function TypedArrayFrom(constructor, target, items, mapfn, thisArg) {
     // Step 1.
@@ -917,17 +917,17 @@ function TypedArrayFrom(constructor, tar
         // Step 10.c.
         var values = new List();
 
         // Steps 10.d-e.
         while (true) {
             // Steps 10.e.i-ii.
             var next = iterator.next();
             if (!IsObject(next))
-                ThrowError(JSMSG_NEXT_RETURNED_PRIMITIVE);
+                ThrowTypeError(JSMSG_NEXT_RETURNED_PRIMITIVE);
 
             // Steps 10.e.iii-vi.
             if (next.done)
                 break;
             values.push(next.value);
         }
 
         // Step 10.f.
@@ -996,17 +996,17 @@ function TypedArrayStaticOf(/*...items*/
     // Step 2.
     var items = arguments;
 
     // Step 3.
     var C = this;
 
     // Steps 4-5.
     if (!IsConstructor(C))
-        ThrowError(JSMSG_NOT_CONSTRUCTOR, typeof C);
+        ThrowTypeError(JSMSG_NOT_CONSTRUCTOR, typeof C);
 
     var newObj = new C(len);
 
     // Steps 6-7.
     for (var k = 0; k < len; k++)
         newObj[k] = items[k]
 
     // Step 8.