Bug 1333197: Lazily initialize default timezone in DateTimeFormat prototype. r?till
MozReview-Commit-ID: 3JkeJmUQG1w
--- 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.