mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
[mq]: fix-iter.diff
* * * [mq]: fix-iter2.js * * * [mq]: itertest.js
This commit is contained in:
parent
14b2bbd7d8
commit
28e3bcfb71
8
js/src/jit-test/tests/basic/bug624041-1.js
Normal file
8
js/src/jit-test/tests/basic/bug624041-1.js
Normal file
@ -0,0 +1,8 @@
|
||||
var count = 0;
|
||||
|
||||
var a = [0, 1];
|
||||
for (var i in a) {
|
||||
assertEq(++count <= 1, true);
|
||||
a.shift();
|
||||
}
|
||||
|
11
js/src/jit-test/tests/basic/bug624041-2.js
Normal file
11
js/src/jit-test/tests/basic/bug624041-2.js
Normal file
@ -0,0 +1,11 @@
|
||||
var s = '';
|
||||
|
||||
var a = [, 0, 1];
|
||||
for (var i in a) {
|
||||
a.reverse();
|
||||
s += i + ',';
|
||||
}
|
||||
|
||||
// Index of the element with value '0'.
|
||||
assertEq(s, '1,');
|
||||
|
@ -1484,10 +1484,15 @@ array_reverse(JSContext *cx, uintN argc, Value *vp)
|
||||
|
||||
uint32 lo = 0, hi = len - 1;
|
||||
for (; lo < hi; lo++, hi--) {
|
||||
Value tmp = obj->getDenseArrayElement(lo);
|
||||
obj->setDenseArrayElement(lo, obj->getDenseArrayElement(hi));
|
||||
obj->setDenseArrayElement(hi, tmp);
|
||||
}
|
||||
Value origlo = obj->getDenseArrayElement(lo);
|
||||
Value orighi = obj->getDenseArrayElement(hi);
|
||||
obj->setDenseArrayElement(lo, orighi);
|
||||
if (orighi.isMagic(JS_ARRAY_HOLE))
|
||||
js_SuppressDeletedProperty(cx, obj, INT_TO_JSID(lo));
|
||||
obj->setDenseArrayElement(hi, origlo);
|
||||
if (origlo.isMagic(JS_ARRAY_HOLE))
|
||||
js_SuppressDeletedProperty(cx, obj, INT_TO_JSID(hi));
|
||||
}
|
||||
|
||||
/*
|
||||
* Per ECMA-262, don't update the length of the array, even if the new
|
||||
@ -2156,6 +2161,8 @@ array_shift(JSContext *cx, uintN argc, Value *vp)
|
||||
memmove(elems, elems + 1, length * sizeof(jsval));
|
||||
obj->setDenseArrayElement(length, MagicValue(JS_ARRAY_HOLE));
|
||||
obj->setArrayLength(length);
|
||||
if (!js_SuppressDeletedProperty(cx, obj, INT_TO_JSID(length)));
|
||||
return JS_FALSE;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user