Bug 1333197 - Lazily initialize default timezone in DateTimeFormat prototype. r=Waldo, a=jcristau
authorAndré Bargull <andre.bargull@gmail.com>
Wed, 15 Feb 2017 09:14:02 -0800
changeset 376370 70eb26b3bee4ee2389688b71f8fa35b13ed63173
parent 376369 f5c5f1f52313834d9908f589d9bed32b23c670a8
child 376371 5a45005087d21b83fc59c34a5b14ea0c9356c51e
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo, jcristau
bugs1333197
milestone53.0a2
Bug 1333197 - Lazily initialize default timezone in DateTimeFormat prototype. r=Waldo, a=jcristau
js/src/builtin/Intl.js
--- a/js/src/builtin/Intl.js
+++ b/js/src/builtin/Intl.js
@@ -2223,17 +2223,22 @@ function resolveDateTimeFormatInternals(
     internalProps.calendar = r.ca;
     internalProps.numberingSystem = r.nu;
 
     // Compute formatting options.
     // Step 14.
     var dataLocale = r.dataLocale;
 
     // Steps 15-17.
-    internalProps.timeZone = lazyDateTimeFormatData.timeZone;
+    var tz = lazyDateTimeFormatData.timeZone;
+    if (tz === undefined) {
+        // Step 16.
+        tz = DefaultTimeZone();
+    }
+    internalProps.timeZone = tz;
 
     // Step 18.
     var formatOpt = lazyDateTimeFormatData.formatOpt;
 
     // Steps 27-28, more or less - see comment after this function.
     var pattern = toBestICUPattern(dataLocale, formatOpt);
 
     // Step 29.
@@ -2343,19 +2348,16 @@ function InitializeDateTimeFormat(dateTi
 
         // Step 15.b.
         var timeZone = intl_IsValidTimeZoneName(tz);
         if (timeZone === null)
             ThrowRangeError(JSMSG_INVALID_TIME_ZONE, tz);
 
         // Step 15.c.
         tz = CanonicalizeTimeZoneName(timeZone);
-    } else {
-        // Step 16.
-        tz = DefaultTimeZone();
     }
     lazyDateTimeFormatData.timeZone = tz;
 
     // Step 18.
     var formatOpt = new Record();
     lazyDateTimeFormatData.formatOpt = formatOpt;
 
     // Step 19.