• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<script>
4function finishTest()
5{
6    if (window.layoutTestController)
7        layoutTestController.notifyDone();
8}
9
10function runTest()
11{
12    if (window.layoutTestController) {
13        layoutTestController.clearAllDatabases();
14        layoutTestController.dumpAsText();
15        layoutTestController.waitUntilDone();
16    }
17
18    try {
19        var db = openDatabase("NullCallbacks", "1.0", "Test for null callbacks.", 1);
20        db.transaction(function(tx) {
21            tx.executeSql("CREATE TABLE IF NOT EXISTS Test (Foo INT)", null);
22            tx.executeSql("INSERT INTO Test VALUES (?)", [1], null, null);
23            tx.executeSql("INSERT INTO Test VALUES (?)", [2], null);
24            tx.executeSql("INSERT INTO Test VALUES (3)", null, null, null);
25            tx.executeSql("INSERT INTO Test VALUES (?)", [4], null,
26                function(tx, error) {});
27        }, null, null);
28
29        db.transaction(function(tx) {
30            tx.executeSql("INSERT INTO Test VALUES (?)", [5]);
31        }, null, function() { finishTest(); });
32    } catch(err) {
33        document.getElementById("console").innerHTML = "FAIL";
34        finishTest();
35    }
36}
37
38</script>
39</head>
40
41<body onload="runTest()">
42This test checks that 'null' can be used wherever we expect an optional callback.
43<pre id="console">PASS</pre>
44</body>
45
46</html>
47