v8/test/mjsunit/regress/regress-builtinbust-7.js
mvstanton@chromium.org 0c3e70a3b6 Bugfix: internationalization routines fail on monkeypatching.
Calls to Object.defineProperty() and Object.apply() are not safe.

R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/253903003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@21071 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-04-30 07:36:12 +00:00

31 lines
988 B
JavaScript

// Copyright 2014 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.
function overflow() {
return overflow() + 1;
}
Object.defineProperty = overflow;
assertDoesNotThrow(function() { Intl.Collator.supportedLocalesOf("en"); });
var date = new Date(Date.UTC(2004, 12, 25, 3, 0, 0));
var options = {
weekday: "long",
year: "numeric",
month: "long",
day: "numeric"
};
Object.apply = overflow;
assertDoesNotThrow(function() { date.toLocaleDateString("de-DE", options); });
var options_incomplete = {};
assertDoesNotThrow(function() {
date.toLocaleDateString("de-DE", options_incomplete);
});
assertTrue(options_incomplete.hasOwnProperty("year"));
assertDoesNotThrow(function() { date.toLocaleDateString("de-DE", undefined); });
assertDoesNotThrow(function() { date.toLocaleDateString("de-DE"); });
assertThrows(function() { date.toLocaleDateString("de-DE", null); }, TypeError);