2
* Any copyright is dedicated to the Public Domain.
3
* http://creativecommons.org/licenses/publicdomain/
6
//-----------------------------------------------------------------------------
7
var BUGNUMBER = 668024;
9
'Array.prototype.splice, when it deletes elements, should make sure any ' +
10
'deleted but not visited elements are suppressed from subsequent enumeration';
12
print(BUGNUMBER + ": " + summary);
18
var arr = [0, 1, 2, 3, 4, 5, , 7];
21
var sawOneBeforeThree = true;
26
// The order of enumeration of properties is unspecified, so technically,
27
// it would be kosher to enumerate "1" last, say, such that all properties
28
// in the array actually were enumerated, including an index which splice
29
// would delete. Don't flag that case as a failure. (SpiderMonkey doesn't
30
// do this, and neither do any of the other browser engines, but it is
31
// permissible behavior.)
32
if (seen.indexOf("3") >= 0)
34
sawOneBeforeThree = false;
44
if (sawOneBeforeThree)
48
// If a property that has not yet been visited during enumeration is
49
// deleted, then it will not be visited.
51
// So if we haven't seen "3" by the time we see "1", the splice call above
52
// will delete "3", and therefore we must not see it.
53
assertEq(seen.indexOf("3"), -1);
56
/******************************************************************************/
58
if (typeof reportCompare === "function")
59
reportCompare(true, true);
61
print("Tests complete");