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
|
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>Storage inspector IndexedDBs with duplicate names</title>
<script type="application/javascript;version=1.7">
"use strict";
function createIndexedDBs() {
createIndexedDB("idb1", "temporary");
createIndexedDB("idb1", "default");
createIndexedDB("idb1", "persistent");
createIndexedDB("idb2", "temporary");
createIndexedDB("idb2", "default");
createIndexedDB("idb2", "persistent");
}
function createIndexedDB(name, storage) {
let open = indexedDB.open(name, {storage: storage});
open.onsuccess = function () {
let db = open.result;
db.close();
};
}
function deleteDB(dbName, storage) {
return new Promise(resolve => {
dump(`removing database ${dbName} (${storage}) from ${document.location}\n`);
indexedDB.deleteDatabase(dbName, { storage: storage }).onsuccess = resolve;
});
}
window.clear = function* () {
yield deleteDB("idb1", "temporary");
yield deleteDB("idb1", "default");
yield deleteDB("idb1", "persistent");
yield deleteDB("idb2", "temporary");
yield deleteDB("idb2", "default");
yield deleteDB("idb2", "persistent");
dump(`removed indexedDB data from ${document.location}\n`);
};
</script>
</head>
<body onload="createIndexedDBs()">
<h1>storage-indexeddb-duplicate-names.html</h1>
</body>
</html>
|