summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/trace-viewer/third_party/Promises/reworked_APIs/IndexedDB/example/before.html
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/trace-viewer/third_party/Promises/reworked_APIs/IndexedDB/example/before.html')
-rw-r--r--chromium/third_party/trace-viewer/third_party/Promises/reworked_APIs/IndexedDB/example/before.html70
1 files changed, 0 insertions, 70 deletions
diff --git a/chromium/third_party/trace-viewer/third_party/Promises/reworked_APIs/IndexedDB/example/before.html b/chromium/third_party/trace-viewer/third_party/Promises/reworked_APIs/IndexedDB/example/before.html
deleted file mode 100644
index c74e3917d54..00000000000
--- a/chromium/third_party/trace-viewer/third_party/Promises/reworked_APIs/IndexedDB/example/before.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title></title>
- <script>
- "use strict";
-
- // Cribbed from:
- // https://hacks.mozilla.org/2012/02/storing-images-and-files-in-indexeddb/
- var DB_NAME = "example";
- var OBJ_STORE_NAME = "objects";
- var VERSION = 1.0;
-
- var db = null;
-
- var onDBWriteable = function(e) {
- // Create a new Transaction in which to write
- var trans = db.transaction([OBJ_STORE_NAME], "readwrite");
- // Get the Object Store via the Transaction
- var store = trans.objectStore(OBJ_STORE_NAME);
-
- // Write asynchronously
- var key = "thinger"
- var putRequest = store.put({ value: "stuff" }, key);
- putRequest.onsuccess = function(e) {
- console.log("writing successful");
-
- // Read it back
- var getRequest = store.get(key);
- getRequest.onsuccess = function(e) {
- console.log("reading successful:", e.target.result);
- };
- };
- };
-
- // Open up a DB against a particular version
-
- // Note that this call is "async" in the sense that the request
- // deterministically fires the "upgradeneeded" and "success" events in a
- // later turn, giving us a chance to regsiter handlers here. There's
- // nothing in the API contract to indicat that this is so, however.
- var openRequest = this.indexedDB.open(DB_NAME, VERSION);
-
- // If this is the first time we run, upgradeneeded is thrown and we can
- // create the object store.
- openRequest.onupgradeneeded = function (e) {
- console.log("database creation/upgrade needed");
- db = e.target.result;
-
- console.log("creating object store:", OBJ_STORE_NAME)
- // Note that we can only call createObjectStore inside of an
- // upgradeneeded event.
- db.createObjectStore(OBJ_STORE_NAME);
- };
-
- // We can only write once the DB is opened and upgraded/created. onsuccess
- // is always called after onupgradeneeded (if upgradeneeded is true).
- openRequest.onsuccess = function(e) {
- console.log("database opened successfully");
- db = e.target.result;
- console.log(db);
-
- // Now write something to the Object Store
- onDBWriteable(e);
- };
-
- </script>
- </head>
- <body></body>
-</html> \ No newline at end of file