Bug 1339621: Directly add default null collation instead of shifting all elements with unshift(). r=Waldo

--HG--
extra : rebase_source : 46109d27755b7a94d1992d65c2bcb965ca276405
This commit is contained in:
André Bargull 2017-02-14 15:06:24 -08:00
parent 264673d83e
commit 06c6a5f7dd
2 changed files with 7 additions and 3 deletions

View File

@ -1129,6 +1129,12 @@ js::intl_availableCollations(JSContext* cx, unsigned argc, Value* vp)
return false;
uint32_t index = 0;
// The first element of the collations array must be |null| per
// ES2017 Intl, 10.2.3 Internal Slots.
if (!DefineElement(cx, collations, index++, NullHandleValue))
return false;
for (uint32_t i = 0; i < count; i++) {
const char* collation = uenum_next(values, nullptr, &status);
if (U_FAILURE(status)) {

View File

@ -1606,10 +1606,8 @@ var collatorInternalProperties = {
function collatorSortLocaleData(locale) {
var collations = intl_availableCollations(locale);
callFunction(std_Array_unshift, collations, null);
return {
co: collations,
co: intl_availableCollations(locale),
kn: ["false", "true"]
};
}