summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/arrays/fillwithundefined-length-nonwriteable.js
blob: 852d84116cc55a76dfb9a897289ee483f124ba15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var called = false;
var a = [/* hole */, undefined, {
    toString() {
        if (!called) {
            called = true;
            a.length = 3;
            Object.defineProperty(a, "length", {writable:false});
        }
        return 0;
    }
}, 0];
a.sort();

assertEq(a.length, 3);
assertEq(a[1], 0);
assertEq(a[2], undefined);