diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/IndexedDB/resources/idbworker.js | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/IndexedDB/resources/idbworker.js')
-rw-r--r-- | testing/web-platform/tests/IndexedDB/resources/idbworker.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/testing/web-platform/tests/IndexedDB/resources/idbworker.js b/testing/web-platform/tests/IndexedDB/resources/idbworker.js new file mode 100644 index 0000000000..04a421fa38 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/resources/idbworker.js @@ -0,0 +1,34 @@ +var db + +self.addEventListener('message', MessageHandler, false) + +function MessageHandler(e) +{ + var open_rq, idb = self.indexedDB || self.msIndexedDB || self.webkitIndexedDB || self.mozIndexedDB + + if (!idb) + { + self.postMessage(false) + return + } + else + self.postMessage(true) + + open_rq = idb.open("webworker101", 1) + + open_rq.onupgradeneeded = function(e) { + db = e.target.result + db.createObjectStore("store") + .add("test", 1) + } + open_rq.onsuccess = function(e) { + db = e.target.result + db.onerror = function() { self.postMessage("db.error") } + db.transaction("store", "readonly", {durability: 'relaxed'}).objectStore("store").get(1).onsuccess = function(e) { + self.postMessage(e.target.result) + db.close() + } + } + open_rq.onerror = function() { self.postMessage("open.error") } + open_rq.onblocked = function() { self.postMessage("open.blocked") } +} |