js/src/jit-test/tests/arrays/setelem-one-past-nonwritable-length.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/arrays/setelem-one-past-nonwritable-length.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,20 @@
     1.4 +function f(arr, i, v)
     1.5 +{
     1.6 +  arr[i] = v;
     1.7 +}
     1.8 +
     1.9 +function test()
    1.10 +{
    1.11 +  // Use a much-greater capacity than the eventual non-writable length.
    1.12 +  var a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
    1.13 +  Object.defineProperty(a, "length", { writable: false, value: 6 });
    1.14 +
    1.15 +  for (var i = 0; i < 100; i++)
    1.16 +    f(a, a.length, i);
    1.17 +
    1.18 +  assertEq(a.hasOwnProperty(6), false);
    1.19 +  assertEq(a[6], undefined);
    1.20 +  assertEq(a.length, 6);
    1.21 +}
    1.22 +
    1.23 +test();

mercurial