summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/bug649939.js
blob: 2f1b054730bdc5687956a78951610a1b4c6573a1 (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
// This was the actual bug
assertRaises(StopIteration, function() {
    Iterator.prototype.next();
    Iterator.prototype.next();
});

// The error should have triggered here, but was masked by a latent bug
assertRaises(StopIteration, function() {
    Iterator.prototype.next();
});

// Found by fuzzing
assertRaises(StopIteration, function() {
    (new Iterator({})).__proto__.next();
});


function assertRaises(exc, callback) {
    var caught = false;
    try {
        callback();
    } catch (e) {
        assertEq(e instanceof StopIteration, true);
        caught = true;
    }
    assertEq(caught, true);
}