summaryrefslogtreecommitdiffstats
path: root/devtools/client/storage/test/storage-indexeddb-duplicate-names.html
blob: 0f448f372723a94f6390869843e0a2464e774213 (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
<!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">
    "use strict";

    /* exported setup */
    function setup() {
      createIndexedDB("idb1");
      createIndexedDB("idb2");
    }

    function createIndexedDB(name) {
      const open = indexedDB.open(name);

      open.onsuccess = function () {
        const db = open.result;
        db.close();
      };
    }

    function deleteDB(dbName) {
      return new Promise(resolve => {
        dump(`removing database ${dbName} from ${document.location}\n`);
        indexedDB.deleteDatabase(dbName).onsuccess = resolve;
      });
    }

    window.clear = async function () {
      await deleteDB("idb1");
      await deleteDB("idb2");

      dump(`removed indexedDB data from ${document.location}\n`);
    };
  </script>
</head>
<body>
  <h1>storage-indexeddb-duplicate-names.html</h1>
</body>
</html>