1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/basic/splice-delete-non-configurable-during-shrink.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,26 @@ 1.4 +/* Test that splice causing deletion of a non-configurable property stops at exactly step 12(v) of ES5 15.4.4.12 */ 1.5 + 1.6 +var O = [1,2,3,4,5,6]; 1.7 +var A = undefined; 1.8 +Object.defineProperty(O, 3, { configurable: false }); 1.9 + 1.10 +try 1.11 +{ 1.12 + A = O.splice(0, 6); 1.13 + throw new Error("didn't throw, returned " + A); 1.14 +} 1.15 +catch (e) 1.16 +{ 1.17 + assertEq(e instanceof TypeError, true, 1.18 + "deleting O[3] should have caused a TypeError"); 1.19 +} 1.20 + 1.21 +assertEq(O.length, 6); // setting length not reached 1.22 +assertEq(A, undefined); // return value not reached 1.23 + 1.24 +assertEq(O[5], undefined); // deletion reached 1.25 +assertEq(O[4], undefined); // deletion reached 1.26 +assertEq(O[3], 4); // deletion caused exception 1.27 +assertEq(O[2], 3); // deletion not reached 1.28 +assertEq(O[1], 2); // deletion not reached 1.29 +assertEq(O[0], 1); // deletion not reached