summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testBug502914.js
blob: d01ee9786e25e9c02c66c290cbc5813efccbfd58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function testBug502914() {
    // Assigning a non-function to a function-valued property on trace should
    // bump the shape.
    function f1() {}
    function C() {}
    var x = C.prototype = {m: f1};
    x.m();  // brand scope
    var arr = [new C, new C, new C, x];
    try {
        for (var i = 0; i < 4; i++) {
            arr[i].m = 12;
            x.m();  // should throw last time through
        }
    } catch (exc) {
        return exc.constructor.name;
    }
    return "no exception";
}
assertEq(testBug502914(), "TypeError");