зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 716d75c8abc2 (bug 1263040) for jsreftest failures
MozReview-Commit-ID: 56VXkA9zl5p
This commit is contained in:
Родитель
e0b2b9e425
Коммит
49a18c7639
|
@ -2346,7 +2346,6 @@ static const JSFunctionSpec intl_static_methods[] = {
|
|||
#if JS_HAS_TOSOURCE
|
||||
JS_FN(js_toSource_str, intl_toSource, 0, 0),
|
||||
#endif
|
||||
JS_SELF_HOSTED_FN("getCanonicalLocales", "Intl_getCanonicalLocales", 1, 0),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
|
|
|
@ -2884,17 +2884,3 @@ function resolveICUPattern(pattern, result) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Intl_getCanonicalLocales(locales) {
|
||||
let codes = CanonicalizeLocaleList(locales);
|
||||
let result = [];
|
||||
|
||||
let len = codes.length;
|
||||
let k = 0;
|
||||
|
||||
while (k < len) {
|
||||
_DefineDataProperty(result, k, codes[k]);
|
||||
k++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
// |reftest| skip-if(!this.hasOwnProperty("Intl"))
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// Tests the getCanonicalLocales function for overridden argument's length.
|
||||
|
||||
var count = 0;
|
||||
var locs = { get length() { if (count++ > 0) throw 42; return 0; } };
|
||||
var locales = Intl.getCanonicalLocales(locs); // shouldn't throw 42
|
||||
assertEq(locales.length, 0);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0, 0);
|
|
@ -1,16 +0,0 @@
|
|||
// |reftest| skip-if(!this.hasOwnProperty("Intl"))
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// Tests the getCanonicalLocales function for overriden Array.push.
|
||||
|
||||
Array.prototype.push = () => { throw 42; };
|
||||
|
||||
// must not throw 42, might if push is used
|
||||
var arr = Intl.getCanonicalLocales(["en-US"]);
|
||||
|
||||
assertShallowArray(arr, ["en-US"]);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0, 0);
|
|
@ -1,16 +0,0 @@
|
|||
// |reftest| skip-if(!this.hasOwnProperty("Intl"))
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// Tests the getCanonicalLocales function for overridden set().
|
||||
|
||||
Object.defineProperty(Array.prototype, 0, { set() { throw 42; } });
|
||||
|
||||
// must not throw 42, might if push is used
|
||||
var arr = Intl.getCanonicalLocales(["en-US"]);
|
||||
|
||||
assertShallowArray(arr, ["en-US"]);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0, 0);
|
|
@ -1,24 +0,0 @@
|
|||
// |reftest| skip-if(!this.hasOwnProperty("Intl"))
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// Locale processing is supposed to internally remove any Unicode extension
|
||||
// sequences in the locale. Test that various weird testcases invoking
|
||||
// algorithmic edge cases don't assert or throw exceptions.
|
||||
|
||||
var weirdCases =
|
||||
[
|
||||
"x-u-foo",
|
||||
"en-x-u-foo",
|
||||
"en-a-bar-x-u-foo",
|
||||
"en-x-u-foo-a-bar",
|
||||
"en-a-bar-u-baz-x-u-foo",
|
||||
];
|
||||
|
||||
for (let weird of weirdCases)
|
||||
assertShallowArray(Intl.getCanonicalLocales(weird), [weird]);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0, 0);
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
// |reftest| skip-if(!this.hasOwnProperty("Intl"))
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// Tests the getCanonicalLocales function for duplicate locales scenario.
|
||||
|
||||
assertShallowArray(
|
||||
Intl.getCanonicalLocales(
|
||||
['ab-cd', 'ff', 'de-rt', 'ab-Cd']), ['ab-CD', 'ff', 'de-RT']);
|
||||
|
||||
var locales = Intl.getCanonicalLocales(["en-US", "en-US"]);
|
||||
assertShallowArray(locales, ['en-US']);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0, 0);
|
|
@ -1,37 +0,0 @@
|
|||
// |reftest| skip-if(!this.hasOwnProperty("Intl"))
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// Tests the getCanonicalLocales function with a diverse set of arguments.
|
||||
|
||||
let gCL = Intl.getCanonicalLocales;
|
||||
|
||||
assertEq(Intl.getCanonicalLocales.length, 1);
|
||||
|
||||
assertShallowArray(gCL(), []);
|
||||
|
||||
assertShallowArray(gCL('ab-cd'), ['ab-CD']);
|
||||
|
||||
assertShallowArray(gCL(['ab-cd']), ['ab-CD']);
|
||||
|
||||
assertShallowArray(gCL(['ab-cd', 'FF']), ['ab-CD', 'ff']);
|
||||
|
||||
assertShallowArray(gCL({'a': 0}), []);
|
||||
|
||||
assertShallowArray(gCL({}), []);
|
||||
|
||||
assertShallowArray(gCL(['ar-ma-u-ca-islamicc']), ['ar-MA-u-ca-islamicc']);
|
||||
|
||||
assertShallowArray(gCL(['th-th-u-nu-thai']), ['th-TH-u-nu-thai']);
|
||||
|
||||
assertShallowArray(gCL(NaN), []);
|
||||
|
||||
assertShallowArray(gCL(1), []);
|
||||
|
||||
Number.prototype[0] = "en-US";
|
||||
Number.prototype.length = 1;
|
||||
assertShallowArray(gCL(NaN), ["en-US"]);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(0, 0);
|
|
@ -1,9 +0,0 @@
|
|||
if (typeof assertShallowArray === 'undefined') {
|
||||
var assertShallowArray = function assertShallowArray(actual, expected) {
|
||||
var len = actual.length;
|
||||
assertEq(len, expected.length, "mismatching array lengths");
|
||||
|
||||
for (var i = 0; i < len; i++)
|
||||
assertEq(actual[i], expected[i], "mismatch at element " + i);
|
||||
}
|
||||
}
|
|
@ -78,16 +78,7 @@ function TestCase(n, d, e, a)
|
|||
this.reason = '';
|
||||
this.bugnumber = typeof(BUGNUMER) != 'undefined' ? BUGNUMBER : '';
|
||||
this.type = (typeof window == 'undefined' ? 'shell' : 'browser');
|
||||
({}).constructor.defineProperty(
|
||||
gTestcases,
|
||||
gTc++,
|
||||
{
|
||||
value: this,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
}
|
||||
);
|
||||
gTestcases[gTc++] = this;
|
||||
}
|
||||
|
||||
gFailureExpected = false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче