mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 875433 - Implement Array.prototype.values. r=jorendorff.
--HG-- extra : commitid : COQ24oLNaPl extra : rebase_source : 800c882bfae5481e3580a2e4de00bac1cda1a57f
This commit is contained in:
parent
d738e7170c
commit
96226d8425
@ -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),
|
||||
|
18
js/src/tests/ecma_6/Array/values.js
Normal file
18
js/src/tests/ecma_6/Array/values.js
Normal 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);
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user