Commit 8226c88b authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[i18n] Ensure [[ToString]] conversion of time zone names.

This adds a missing conversion of time zone names to string primitives
before case conversion and regular expression matching are applied.

This is in sync with ECMA-402, section 12.1.1.1, step 16(a).

R=jochen@chromium.org
TEST=mjsunit/regress/regress-crbug-627935
BUG=chromium:627935

Review-Url: https://codereview.chromium.org/2143003005
Cr-Commit-Position: refs/heads/master@{#37757}
parent 6bceabac
......@@ -1785,6 +1785,9 @@ function canonicalizeTimeZoneID(tzID) {
return tzID;
}
// Convert zone name to string.
tzID = TO_STRING(tzID);
// Special case handling (UTC, GMT).
var upperID = %StringToUpperCase(tzID);
if (upperID === 'UTC' || upperID === 'GMT' ||
......
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
assertThrows("Intl.DateTimeFormat('en-US', {timeZone: 0})", RangeError);
assertThrows("Intl.DateTimeFormat('en-US', {timeZone: true})", RangeError);
assertThrows("Intl.DateTimeFormat('en-US', {timeZone: null})", RangeError);
var object = { toString: function() { return "UTC" } };
assertDoesNotThrow("Intl.DateTimeFormat('en-US', {timeZone: object})");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment