summaryrefslogtreecommitdiffstats
path: root/dom/indexedDB/test/file_app_isolation.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/indexedDB/test/file_app_isolation.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/indexedDB/test/file_app_isolation.html')
-rw-r--r--dom/indexedDB/test/file_app_isolation.html88
1 files changed, 88 insertions, 0 deletions
diff --git a/dom/indexedDB/test/file_app_isolation.html b/dom/indexedDB/test/file_app_isolation.html
new file mode 100644
index 000000000..0ff74e689
--- /dev/null
+++ b/dom/indexedDB/test/file_app_isolation.html
@@ -0,0 +1,88 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ foobar!
+ </body>
+ <script>
+ var data = [
+ { id: "0", name: "foo" },
+ ];
+
+ var action = window.location.search.substring(1);
+ var finished = false;
+ var created = false; // We use that for 'read-no' action.
+
+ function finish(value) {
+ value ? alert('success') : alert('failure');
+ finished = true;
+ }
+
+ var request = window.indexedDB.open('AppIsolationTest');
+
+ request.onupgradeneeded = function(event) {
+ if (finished) {
+ finish(false);
+ return;
+ }
+
+ switch (action) {
+ case 'read-no':
+ created = true;
+ break;
+ case 'read-yes':
+ finish(false);
+ break;
+ case 'write':
+ created = true;
+
+ var db = event.target.result;
+
+ var objectStore = db.createObjectStore("test", { keyPath: "id" });
+ for (var i in data) {
+ objectStore.add(data[i]);
+ }
+ break;
+ }
+ }
+
+ request.onsuccess = function(event) {
+ if (finished) {
+ finish(false);
+ return;
+ }
+
+ var db = event.target.result;
+
+ // Think about close the db!
+ switch (action) {
+ case 'read-no':
+ db.close();
+
+ if (created) { // That means we have created it.
+ indexedDB.deleteDatabase('AppIsolationTest').onsuccess = function() {
+ finish(true);
+ };
+ } else {
+ finish(false);
+ }
+ break;
+ case 'read-yes':
+ db.transaction("test").objectStore("test").get("0").onsuccess = function(event) {
+ var name = event.target.result.name;
+ db.close();
+
+ indexedDB.deleteDatabase('AppIsolationTest').onsuccess = function() {
+ finish(name == 'foo');
+ };
+ };
+ break;
+ case 'write':
+ db.close();
+
+ // Success only if the db was actually created.
+ finish(created);
+ break;
+ }
+ };
+ </script>
+</html>