mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 875433 - Array.prototype.iterator is the same function object as .values. r=jorendorff.
--HG-- extra : rebase_source : 0b9b93bd796ba2c528b89c377b8aac922631ec98
This commit is contained in:
parent
93726c7d29
commit
d0c792512a
@ -0,0 +1,4 @@
|
||||
// Array.prototype.iterator is the same function object as .values.
|
||||
|
||||
assertEq(Array.prototype.values, Array.prototype.iterator);
|
||||
assertEq(Array.prototype.iterator.name, "values");
|
@ -2671,7 +2671,7 @@ array_filter(JSContext *cx, unsigned argc, Value *vp)
|
||||
return false;
|
||||
|
||||
if (ToBoolean(ag.rval())) {
|
||||
if(!SetArrayElement(cx, arr, to, kValue))
|
||||
if (!SetArrayElement(cx, arr, to, kValue))
|
||||
return false;
|
||||
to++;
|
||||
}
|
||||
@ -2728,7 +2728,6 @@ static const JSFunctionSpec array_methods[] = {
|
||||
{"some", {NULL, NULL}, 1,0, "ArraySome"},
|
||||
{"every", {NULL, NULL}, 1,0, "ArrayEvery"},
|
||||
|
||||
JS_FN("iterator", JS_ArrayIterator, 0,0),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
@ -2847,6 +2846,14 @@ js_InitArrayClass(JSContext *cx, HandleObject obj)
|
||||
if (!DefineConstructorAndPrototype(cx, global, JSProto_Array, ctor, arrayProto))
|
||||
return NULL;
|
||||
|
||||
JSFunction *fun = JS_DefineFunction(cx, arrayProto, "values", JS_ArrayIterator, 0, 0);
|
||||
if (!fun)
|
||||
return NULL;
|
||||
|
||||
RootedValue funval(cx, ObjectValue(*fun));
|
||||
if (!JS_DefineProperty(cx, arrayProto, "iterator", funval, NULL, NULL, 0))
|
||||
return NULL;
|
||||
|
||||
return arrayProto;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user