Bug 875433 - Implement Array.prototype.values. r=jorendorff.

--HG--
extra : commitid : COQ24oLNaPl
extra : rebase_source : 800c882bfae5481e3580a2e4de00bac1cda1a57f
This commit is contained in:
Tom Schuster 2016-03-21 10:44:35 -05:00
parent d738e7170c
commit 96226d8425
3 changed files with 20 additions and 1 deletions

View File

@ -3170,6 +3170,7 @@ static const JSFunctionSpec array_methods[] = {
JS_SELF_HOSTED_SYM_FN(iterator, "ArrayValues", 0,0),
JS_SELF_HOSTED_FN("entries", "ArrayEntries", 0,0),
JS_SELF_HOSTED_FN("keys", "ArrayKeys", 0,0),
JS_SELF_HOSTED_FN("values", "ArrayValues", 0,0),
/* ES7 additions */
JS_SELF_HOSTED_FN("includes", "ArrayIncludes", 2,0),

View File

@ -0,0 +1,18 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/ */
assertEq(Array.prototype.values, Array.prototype[Symbol.iterator]);
assertEq(Array.prototype.values.name, "values");
assertEq(Array.prototype.values.length, 0);
function valuesUnscopeable() {
var values = "foo";
with ([1, 2, 3]) {
assertEq(indexOf, Array.prototype.indexOf);
assertEq(values, "foo");
}
}
valuesUnscopeable();
if (typeof reportCompare === 'function')
reportCompare(0, 0);

View File

@ -191,7 +191,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681
"pop", "shift", "unshift", "splice", "concat", "slice", "lastIndexOf", "indexOf",
"includes", "forEach", "map", "reduce", "reduceRight", "filter", "some", "every", "find",
"findIndex", "copyWithin", "fill", Symbol.iterator, Symbol.unscopables, "entries", "keys",
"constructor"];
"values", "constructor"];
gConstructorProperties['Array'] =
constructorProps(["join", "reverse", "sort", "push", "pop", "shift",
"unshift", "splice", "concat", "slice", "isArray",