summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/resources/database-lock-after-reload-2.html
blob: d73a0df5d80f98122ecd140dba61fcf328939d5a (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
<html>
<head>
<script>
var database;

function log(message)
{
    document.getElementById("console").innerHTML += message + "<br>";
}

function finishTest()
{
    log("Test part 2 Complete");
    if (window.layoutTestController)
        layoutTestController.notifyDone();
}

function errorFunction(tx, error)
{
    log("Test failed - " + error.message);
    finishTest();
}

function addData(db)
{
    db.transaction(function(tx) { 
        log("Inserting some data");

        tx.executeSql("INSERT INTO DataTest (testData) VALUES (?)", ["A"], function(tx, result) { }, errorFunction);
    }, function(){}, function() { 
        finishTest();
    });
}

function runTest()
{
    if (window.layoutTestController) {
        layoutTestController.dumpAsText();
        layoutTestController.waitUntilDone();
    }
    
    try {
        database = openDatabase("DatabaseLockTest", "1.0", "Test for database locking", 5242880);
        addData(database);
    } catch(e) {
        log("Error - could not open database");
        finishTest();
    }
}

</script>
</head>

<body onload="runTest()">
<pre id="console">
</pre>
</body>

</html>