Commit 51073d5f authored by arv's avatar arv Committed by Commit bot

i18n.js was not using original functions

The i18n.js code was calling a lot of methods, which might have been
removed or replaced by user code.

Make sure we use the original functions.

BUG=v8:4220
LOG=N
R=adamk, littledan
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_chromium_rel_ng;tryserver.blink:linux_blink_rel

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

Cr-Commit-Position: refs/heads/master@{#29268}
parent 93d130ce
......@@ -1676,6 +1676,7 @@ utils.SetUpLockedPrototype(InternalPackedArray, GlobalArray(), [
// Exports
utils.Export(function(to) {
to.ArrayIndexOf = ArrayIndexOf;
to.ArrayJoin = ArrayJoin;
to.ArrayToString = ArrayToString;
to.InnerArrayEvery = InnerArrayEvery;
......
This diff is collapsed.
......@@ -447,6 +447,7 @@ utils.Export(function(to) {
to.RegExpExec = DoRegExpExec;
to.RegExpExecNoTests = RegExpExecNoTests;
to.RegExpLastMatchInfo = RegExpLastMatchInfo;
to.RegExpTest = RegExpTest;
});
})
......@@ -14,6 +14,8 @@ var GlobalString = global.String;
var InternalArray = utils.InternalArray;
var InternalPackedArray = utils.InternalPackedArray;
var ArrayIndexOf;
var ArrayJoin;
var MathMax;
var MathMin;
var RegExpExec;
......@@ -21,6 +23,8 @@ var RegExpExecNoTests;
var RegExpLastMatchInfo;
utils.Import(function(from) {
ArrayIndexOf = from.ArrayIndexOf;
ArrayJoin = from.ArrayJoin;
MathMax = from.MathMax;
MathMin = from.MathMin;
RegExpExec = from.RegExpExec;
......@@ -191,10 +195,11 @@ function StringNormalizeJS(form) {
var form = form ? TO_STRING_INLINE(form) : 'NFC';
var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD'];
var normalizationForm = NORMALIZATION_FORMS.indexOf(form);
var normalizationForm =
%_CallFunction(NORMALIZATION_FORMS, form, ArrayIndexOf);
if (normalizationForm === -1) {
throw MakeRangeError(kNormalizationForm, NORMALIZATION_FORMS.join(', '));
throw MakeRangeError(kNormalizationForm,
%_CallFunction(NORMALIZATION_FORMS, ', ', ArrayJoin));
}
return %_ValueOf(this);
......@@ -1191,6 +1196,11 @@ utils.InstallFunctions(GlobalString.prototype, DONT_ENUM, [
utils.Export(function(to) {
to.StringCharAt = StringCharAtJS;
to.StringIndexOf = StringIndexOfJS;
to.StringLastIndexOf = StringLastIndexOfJS;
to.StringMatch = StringMatchJS;
to.StringReplace = StringReplace;
to.StringSplit = StringSplitJS;
to.StringSubstr = StringSubstr;
to.StringSubstring = StringSubstring;
});
......
// 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.
assertEquals('', ''.normalize());
assertTrue(delete Array.prototype.indexOf);
assertEquals('', ''.normalize());
assertThrows(function() { ''.normalize('invalid'); }, RangeError);
assertTrue(delete Array.prototype.join);
assertThrows(function() { ''.normalize('invalid'); }, RangeError);
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