diff options
| author | John Reck <jreck@google.com> | 2010-11-04 12:00:17 -0700 |
|---|---|---|
| committer | John Reck <jreck@google.com> | 2010-11-09 11:35:04 -0800 |
| commit | e14391e94c850b8bd03680c23b38978db68687a8 (patch) | |
| tree | 3fed87e6620fecaf3edc7259ae58a11662bedcb2 /WebCore/manual-tests/indexeddb-persists.html | |
| parent | 1bd705833a68f07850cf7e204b26f8d328d16951 (diff) | |
| download | external_webkit-e14391e94c850b8bd03680c23b38978db68687a8.zip external_webkit-e14391e94c850b8bd03680c23b38978db68687a8.tar.gz external_webkit-e14391e94c850b8bd03680c23b38978db68687a8.tar.bz2 | |
Merge Webkit at r70949: Initial merge by git.
Change-Id: I77b8645c083b5d0da8dba73ed01d4014aab9848e
Diffstat (limited to 'WebCore/manual-tests/indexeddb-persists.html')
| -rw-r--r-- | WebCore/manual-tests/indexeddb-persists.html | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/WebCore/manual-tests/indexeddb-persists.html b/WebCore/manual-tests/indexeddb-persists.html new file mode 100644 index 0000000..6f5e036 --- /dev/null +++ b/WebCore/manual-tests/indexeddb-persists.html @@ -0,0 +1,69 @@ +<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: setData()">here</a> to open a database and set some data within it.</p> + +<p>Next, close the browser and then re-open this page.</p> + +<p>Lastly, click <a href="javascript: verifyData()">here</a> to verify the data was there</p> + +<p>Status: <span id=status>...</span></p> + +<script> + +if (!('webkitIndexedDB' 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 setData() +{ + status("Something must have gone wrong (or we're still working)...", "red"); + + webkitIndexedDB.open("someDB", "some description").onsuccess = function() { + event.result.setVersion("some version").onsuccess = function() { + var db = event.source; + while (db.objectStores.length) + db.removeObjectStore(db.objectStores[0]); + db.createObjectStore("test").put("value", "key").onsuccess = function() { + status("Value set", "green"); + } + } + } +} + +function verifyData() +{ + status("Something must have gone wrong (or we're still working)...", "red"); + + webkitIndexedDB.open("someDB", "some description").onsuccess = function() { + try { + var result = event.result.transaction([]).objectStore("test").get("key"); + result.onsuccess = function() { + if (event.result == "value") + status("Value verified", "green"); + else + status("Value incorrect!", "red"); + } + result.onerror = function() { + status("An error occurred: " + event.code + " " + event.message, "red"); + } + } catch (e) { + status("An exception occurred: " + e, "red"); + } + } +} + +</script> +</body> +</html> |
