summaryrefslogtreecommitdiffstats
path: root/WebCore/manual-tests/indexeddb-persists.html
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/manual-tests/indexeddb-persists.html')
-rw-r--r--WebCore/manual-tests/indexeddb-persists.html69
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>