summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/js/exceptions-thrown-in-callbacks.html
blob: ae52d53da1d0425c383ca091ba2113265b8afc29 (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
This test ensures that exceptions are handled correctly by the various callback mechanisms present in WebCore.
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

var db = openDatabase("exception-info-test", "1.0", "Test for exception information thrown by callbacks and timers", 1);

function errorObject(msg) {
    return { message: "FAIL: message incorrectly pulled from thrown object in " + msg, 
             toString: function() {return "PASS: toString called on exception value thrown from " + msg} }
}

function eventTest() {
    setTimeout(dbTransactionTest, 0);
    throw errorObject("event handler");
}

function dbTransactionTest() {
    db.transaction(function(tx) { 
        setTimeout(dbStatementTest, 0);
        throw errorObject("sql transaction callback");
    });
}

function dbStatementTest() {
    db.transaction(
        function(tx) {
            tx.executeSql("I am bogus syntax", [], function() {
        }, function(tx, error) {
            setTimeout(timerTest, 0);
            throw errorObject("sql error callback");
        });
    });
}

function timerTest() {
    if (window.testRunner)
        setTimeout("testRunner.notifyDone()", 0);
    throw errorObject("timer");
}

window.onload = eventTest;
</script>