summaryrefslogtreecommitdiffstats
path: root/WebCore/manual-tests/indexed-database.html
blob: da2a1e13e8886d297e3c0515c6e08ee3689134c1 (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
<html>
<body>
<p>This is a test that only applies to IndexedDB.  <span id=enabled>Our test for whether you have it enabled seems to have failed.</span></p>

<p>Please follow these steps in order:</p>

<p>First, click <a href="javascript: doOpen(true)">here</a> to open an indexedDB database.  Look in the proper place in your file system (the place being specific to each port) and verify a file was created.  You should be able to open the file up with sqlite and examine it that way as well.</p>

<p>Next, close the browser, delete the file, replace it with some garbage, and make it read only to the user the browser is running as.  Now click <a href="javascript: doOpen(false)">here</a>.  You should get some sort of error.</p>

<p>Close the browser, delete the file you made, and click <a href="javascript: doOpen(true)">here</a>.  All should be well again.</p>

<p>Status: <span id=status>...</span></p>

<script>

if (!('indexedDB' in window))
    document.getElementById("enabled").innerHTML = "<font color=red>Your build does NOT seem to have it enabled.  So all code on this page is disabled.</font>";
else
    document.getElementById("enabled").innerHTML = "<font color=green>Your build seems to have it enabled.</font>";

function status(str, color)
{
    if (color)
        str = "<font color='" + color + "'>" + str + "</font>";
    document.getElementById("status").innerHTML = str;
}

function doOpen(expectSuccess)
{
    status("Calling open");
    request = indexedDB.open("xyz");
    request.onsuccess = function() {
        if (expectSuccess)
            status("Open successful", "green");        
        else
            status("Open was successful...but shouldn't have been", "red");        
    };
    request.onerror = function() {
        if (expectSuccess)
            status("Unexpected error: " + event.message, "red");
        else
            status("Expected error: " + event.message, "green");
    };
}

</script>
</body>
</html>