Bug 1596544 - intl_ValidateAndCanonicalizeUnicodeExtensionType should ignore the second |option| argument until it's needed to report an error. r=anba
authorJeff Walden <jwalden@mit.edu>
Tue, 19 Nov 2019 04:55:39 +0000
changeset 502538 b5c5ba07d3dbd0d07b66fa42a103f4df2c27d3a2
parent 502537 8ac99aff562c3065c7ad806e4ee54f1f85134668
child 502539 1f4bac75290ebf1aed98980395180250e19c01a1
push id36818
push userdvarga@mozilla.com
push dateTue, 19 Nov 2019 10:59:22 +0000
treeherdermozilla-central@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersanba
bugs1596544
milestone72.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 1596544 - intl_ValidateAndCanonicalizeUnicodeExtensionType should ignore the second |option| argument until it's needed to report an error. r=anba Differential Revision: https://phabricator.services.mozilla.com/D53145
js/src/builtin/intl/Locale.cpp
--- a/js/src/builtin/intl/Locale.cpp
+++ b/js/src/builtin/intl/Locale.cpp
@@ -1338,29 +1338,26 @@ bool js::intl_TryValidateAndCanonicalize
   return true;
 }
 
 bool js::intl_ValidateAndCanonicalizeUnicodeExtensionType(JSContext* cx,
                                                           unsigned argc,
                                                           Value* vp) {
   CallArgs args = CallArgsFromVp(argc, vp);
   MOZ_ASSERT(args.length() == 2);
+  MOZ_ASSERT(args[0].isString());
+  MOZ_ASSERT(args[1].isString());
 
   RootedLinearString unicodeType(cx, args[0].toString()->ensureLinear(cx));
   if (!unicodeType) {
     return false;
   }
 
-  RootedLinearString option(cx, args[1].toString()->ensureLinear(cx));
-  if (!option) {
-    return false;
-  }
-
   if (!IsValidUnicodeExtensionValue(unicodeType)) {
-    UniqueChars optionChars = EncodeAscii(cx, option);
+    UniqueChars optionChars = EncodeAscii(cx, args[1].toString());
     if (!optionChars) {
       return false;
     }
 
     UniqueChars unicodeTypeChars = QuoteString(cx, unicodeType, '"');
     if (!unicodeTypeChars) {
       return false;
     }