diff options
Diffstat (limited to 'devtools/client/storage/test/storage-idb-delete-blocked.html')
-rw-r--r-- | devtools/client/storage/test/storage-idb-delete-blocked.html | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/devtools/client/storage/test/storage-idb-delete-blocked.html b/devtools/client/storage/test/storage-idb-delete-blocked.html new file mode 100644 index 0000000000..7c7b597421 --- /dev/null +++ b/devtools/client/storage/test/storage-idb-delete-blocked.html @@ -0,0 +1,47 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta charset="utf-8"> + <title>Test for proper listing indexedDB databases with no object stores</title> +</head> +<body> +<script type="application/javascript"> +"use strict"; +let db; + +window.setup = async function () { + db = await new Promise((resolve, reject) => { + const request = indexedDB.open("idb", 1); + + request.onsuccess = e => resolve(e.target.result); + request.onerror = e => reject(new Error("error opening db connection")); + }); + + dump("opened indexedDB\n"); +}; + +window.closeDb = function() { + db.close(); +}; + +window.deleteDb = async function () { + await new Promise((resolve, reject) => { + const request = indexedDB.deleteDatabase("idb"); + + request.onsuccess = resolve; + request.onerror = e => reject(new Error("error deleting db")); + }); +}; + +window.clear = async function () { + for (const dbName of ["idb1", "idb2"]) { + await new Promise(resolve => { + indexedDB.deleteDatabase(dbName).onsuccess = resolve; + }); + } + dump("removed indexedDB items from main page\n"); +}; + +</script> +</body> +</html> |