Bug 1155081 - Part 4: Replace ThrowError with ThrowTypeError/ThrowRangeError in Intl.js. r=till
authorTooru Fujisawa <arai_a@mac.com>
Mon, 20 Apr 2015 13:58:16 +0900
changeset 239965 efa863af21b3d693bec619cca61ab2c994b889c8
parent 239964 273ba0af084ea84e31da7c3b79ad942f190d63f9
child 239966 cb6a170682c3457ebd4efc748e52e80b7da69ef8
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 4: Replace ThrowError with ThrowTypeError/ThrowRangeError in Intl.js. r=till
js/src/builtin/Intl.js
--- a/js/src/builtin/Intl.js
+++ b/js/src/builtin/Intl.js
@@ -838,17 +838,17 @@ function SupportedLocales(availableLocal
         // Steps 1.a-b.
         options = ToObject(options);
         matcher = options.localeMatcher;
 
         // Step 1.c.
         if (matcher !== undefined) {
             matcher = ToString(matcher);
             if (matcher !== "lookup" && matcher !== "best fit")
-                ThrowError(JSMSG_INVALID_LOCALE_MATCHER, matcher);
+                ThrowRangeError(JSMSG_INVALID_LOCALE_MATCHER, matcher);
         }
     }
 
     // Steps 2-3.
     var subset = (matcher === undefined || matcher === "best fit")
                  ? BestFitSupportedLocales(availableLocales, requestedLocales)
                  : LookupSupportedLocales(availableLocales, requestedLocales);
 
@@ -883,17 +883,17 @@ function GetOption(options, property, ty
             value = ToBoolean(value);
         else if (type === "string")
             value = ToString(value);
         else
             assert(false, "GetOption");
 
         // Step 2.d.
         if (values !== undefined && callFunction(std_Array_indexOf, values, value) === -1)
-            ThrowError(JSMSG_INVALID_OPTION_VALUE, property, value);
+            ThrowRangeError(JSMSG_INVALID_OPTION_VALUE, property, value);
 
         // Step 2.e.
         return value;
     }
 
     // Step 3.
     return fallback;
 }
@@ -912,17 +912,17 @@ function GetNumberOption(options, proper
 
     // Step 1.
     var value = options[property];
 
     // Step 2.
     if (value !== undefined) {
         value = ToNumber(value);
         if (Number_isNaN(value) || value < minimum || value > maximum)
-            ThrowError(JSMSG_INVALID_DIGITS_VALUE, value);
+            ThrowRangeError(JSMSG_INVALID_DIGITS_VALUE, value);
         return std_Math_floor(value);
     }
 
     // Step 3.
     return fallback;
 }
 
 
@@ -1076,17 +1076,17 @@ function isInitializedIntlObject(obj) {
  */
 function getIntlObjectInternals(obj, className, methodName) {
     assert(typeof className === "string", "bad className for getIntlObjectInternals");
 
     var internals = callFunction(std_WeakMap_get, internalsMap, obj);
     assert(internals === undefined || isInitializedIntlObject(obj), "bad mapping in internalsMap");
 
     if (internals === undefined || internals.type !== className)
-        ThrowError(JSMSG_INTL_OBJECT_NOT_INITED, className, methodName, className);
+        ThrowTypeError(JSMSG_INTL_OBJECT_NOT_INITED, className, methodName, className);
 
     return internals;
 }
 
 
 /**
  * Get the internal properties of known-Intl object |obj|.  For use only by
  * C++ code that knows what it's doing!
@@ -1250,17 +1250,17 @@ function getCollatorInternals(obj, metho
  *
  * Spec: ECMAScript Internationalization API Specification, 10.1.1.
  */
 function InitializeCollator(collator, locales, options) {
     assert(IsObject(collator), "InitializeCollator");
 
     // Step 1.
     if (isInitializedIntlObject(collator))
-        ThrowError(JSMSG_INTL_OBJECT_REINITED);
+        ThrowTypeError(JSMSG_INTL_OBJECT_REINITED);
 
     // Step 2.
     var internals = initializeIntlObject(collator);
 
     // Lazy Collator data has the following structure:
     //
     //   {
     //     requestedLocales: List of locales,
@@ -1592,17 +1592,17 @@ function getNumberFormatInternals(obj, m
  *
  * Spec: ECMAScript Internationalization API Specification, 11.1.1.
  */
 function InitializeNumberFormat(numberFormat, locales, options) {
     assert(IsObject(numberFormat), "InitializeNumberFormat");
 
     // Step 1.
     if (isInitializedIntlObject(numberFormat))
-        ThrowError(JSMSG_INTL_OBJECT_REINITED);
+        ThrowTypeError(JSMSG_INTL_OBJECT_REINITED);
 
     // Step 2.
     var internals = initializeIntlObject(numberFormat);
 
     // Lazy NumberFormat data has the following structure:
     //
     //   {
     //     requestedLocales: List of locales,
@@ -1661,21 +1661,21 @@ function InitializeNumberFormat(numberFo
     // Compute formatting options.
     // Step 15.
     var s = GetOption(options, "style", "string", ["decimal", "percent", "currency"], "decimal");
     lazyNumberFormatData.style = s;
 
     // Steps 17-20.
     var c = GetOption(options, "currency", "string", undefined, undefined);
     if (c !== undefined && !IsWellFormedCurrencyCode(c))
-        ThrowError(JSMSG_INVALID_CURRENCY_CODE, c);
+        ThrowRangeError(JSMSG_INVALID_CURRENCY_CODE, c);
     var cDigits;
     if (s === "currency") {
         if (c === undefined)
-            ThrowError(JSMSG_UNDEFINED_CURRENCY);
+            ThrowTypeError(JSMSG_UNDEFINED_CURRENCY);
 
         // Steps 20.a-c.
         c = toASCIIUpperCase(c);
         lazyNumberFormatData.currency = c;
         cDigits = CurrencyDigits(c);
     }
 
     // Step 21.
@@ -2040,17 +2040,17 @@ var dateTimeComponents = std_Object_getO
  *
  * Spec: ECMAScript Internationalization API Specification, 12.1.1.
  */
 function InitializeDateTimeFormat(dateTimeFormat, locales, options) {
     assert(IsObject(dateTimeFormat), "InitializeDateTimeFormat");
 
     // Step 1.
     if (isInitializedIntlObject(dateTimeFormat))
-        ThrowError(JSMSG_INTL_OBJECT_REINITED);
+        ThrowTypeError(JSMSG_INTL_OBJECT_REINITED);
 
     // Step 2.
     var internals = initializeIntlObject(dateTimeFormat);
 
     // Lazy DateTimeFormat data has the following structure:
     //
     //   {
     //     requestedLocales: List of locales,
@@ -2096,17 +2096,17 @@ function InitializeDateTimeFormat(dateTi
                   "best fit");
     localeOpt.localeMatcher = localeMatcher;
 
     // Steps 15-17.
     var tz = options.timeZone;
     if (tz !== undefined) {
         tz = toASCIIUpperCase(ToString(tz));
         if (tz !== "UTC")
-            ThrowError(JSMSG_INVALID_TIME_ZONE, tz);
+            ThrowRangeError(JSMSG_INVALID_TIME_ZONE, tz);
     }
     lazyDateTimeFormatData.timeZone = tz;
 
     // Step 18.
     var formatOpt = new Record();
     lazyDateTimeFormatData.formatOpt = formatOpt;
 
     // Step 19.