summaryrefslogtreecommitdiffstats
path: root/browser/components/preferences/tests/siteData/site_data_test.html
blob: 758106b0a59d8c3a935074fa27eed6790ad39a02 (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
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="Cache-Control" content="public" />
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">

    <title>Site Data Test</title>

  </head>

  <body>
    <h1>Site Data Test</h1>
    <script type="text/javascript">
      let request = indexedDB.open("TestDatabase", 1);
      request.onupgradeneeded = function(e) {
        let db = e.target.result;
        db.createObjectStore("TestStore", { keyPath: "id" });
      };
      request.onsuccess = function(e) {
        let db = e.target.result;
        let tx = db.transaction("TestStore", "readwrite");
        let store = tx.objectStore("TestStore");
        tx.oncomplete = () => document.dispatchEvent(new CustomEvent("test-indexedDB-done", {bubbles: true, cancelable: false}));
        store.put({ id: "test_id", description: "Site Data Test"});
      };
    </script>
  </body>
</html>