Index: test/mjsunit/array-pop.js |
diff --git a/test/mjsunit/array-pop.js b/test/mjsunit/array-pop.js |
index 9608cd4ce5acbbc51bb22d46f8930c85bdd5b359..a8d131e20facfa19bf3e66f21a3a9462f39c1bd0 100644 |
--- a/test/mjsunit/array-pop.js |
+++ b/test/mjsunit/array-pop.js |
@@ -58,6 +58,29 @@ |
assertEquals(undefined, a.pop(1, 2, 3), "9th pop"); |
assertEquals(0, a.length, "length 9th pop"); |
} |
+ |
+ // Check that pop works on inherited properties. |
+ for (var i = 0; i < 10 ;i++) { // Ensure ICs are stabilized. |
+ Array.prototype[1] = 1; |
+ Array.prototype[3] = 3; |
+ Array.prototype[5] = 5; |
+ Array.prototype[7] = 7; |
+ Array.prototype[9] = 9; |
+ a = [0,1,2,,4,,6,7,8,,]; |
+ assertEquals(10, a.length, "inherit-initial-length"); |
+ for (var j = 9; j >= 0; j--) { |
+ assertEquals(j + 1, a.length, "inherit-pre-length-" + j); |
+ assertTrue(j in a, "has property " + j); |
+ var own = a.hasOwnProperty(j); |
+ var inherited = Array.prototype.hasOwnProperty(j); |
+ assertEquals(j, a.pop(), "inherit-pop"); |
+ assertEquals(j, a.length, "inherit-post-length"); |
+ assertFalse(a.hasOwnProperty(j), "inherit-deleted-own-" + j); |
+ assertEquals(inherited, Array.prototype.hasOwnProperty(j), |
+ "inherit-not-deleted-inherited" + j); |
+ } |
+ Array.prototype.length = 0; // Clean-up. |
+ } |
})(); |
// Test the case of not JSArray receiver. |