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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 function f(arr, i, v)
     2 {
     3   arr[i] = v;
     4 }
     6 function test()
     7 {
     8   // Use a much-greater capacity than the eventual non-writable length.
     9   var a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
    10   Object.defineProperty(a, "length", { writable: false, value: 6 });
    12   for (var i = 0; i < 100; i++)
    13     f(a, a.length, i);
    15   assertEq(a.hasOwnProperty(6), false);
    16   assertEq(a[6], undefined);
    17   assertEq(a.length, 6);
    18 }
    20 test();

mercurial