v8/test/intl/regress-5179.js
littledan 97e8046e44 Avoid calling the builtin String.prototype.split in Intl
The Intl code previously called the initial value of String.prototype.split
for some internal operations. However, this did not have the intended effect
as Intl only needs to split strings by strings, but String.prototype.split
has integration with Symbol.split for RegExps.

This patch replaces the calls of StringSplit in the Intl implementation
with direct calls to the %StringSplit runtime function to avoid the issue.

R=yangguo@chromium.org
BUG=v8:5179

Review-Url: https://codereview.chromium.org/2126073002
Cr-Commit-Position: refs/heads/master@{#37615}
2016-07-08 16:53:09 +00:00

16 lines
467 B
JavaScript

// 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.
Object.defineProperty(String.prototype, Symbol.split, {
get() {
return function(obj, limit) {
return [, null];
}
}
});
dtf = new Intl.DateTimeFormat("de", {timeZone:"America/bueNos_airES"});
assertEquals("America/Buenos_Aires", dtf.resolvedOptions().timeZone);