summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/auto-regress/bug674843.js
blob: ff1167c9bb3e4504b2c754ada73a03c0634eb70d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Binary: cache/js-dbg-64-d066929dd830-linux
// Flags: -m
//
function fnSupportsArrayIndexGettersOnObjects() {
    if (fnExists(Object.defineProperty)) {
        var obj = {};
        Object.defineProperty(obj, "0", {
            get: function () {
                supportsArrayIndexGettersOnObjects = true;
            }
        });
        var res = obj[0];
    }
    return supportsArrayIndexGettersOnObjects;
}
function fnExists( /*arguments*/ ) {
    return true;
}
var ES5Harness = (function () {
    var $this = this;
    function registerTest(test) {
        if (!(test.precondition && !test.precondition())) {
            try {
                var res = test.test.call($this);
            } catch (e) {}
        }
    }
    return {
        registerTest: registerTest
    }
})();
ES5Harness.registerTest({
    test: function testcase() {
        function callbackfn(accum, val, idx, obj) {
            if (idx === 1 && val === 1) {}
        }
        var obj = {
            length: 10
        };
        Object.defineProperty(obj, "0", {
            get: function () {
                defineProperty(idx, idx, registerTest + ": }}}}}");
            },
        });
        try {
            Array.prototype.reduce.call(obj, callbackfn, "initialValue");
        } finally {}
    },
    precondition: function prereq() {
        return fnExists(Array.prototype.reduce) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects();
    }
});
ES5Harness.registerTest({
    test: function testcase() {
        var obj = {};
        Object.defineProperty(obj, "property", {
            configurable: new Date()
        });
    },
    precondition: function prereq() {
        return fnExists(gczeal(2));
    }
});