diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/IndexedDB/transaction-create_in_versionchange.htm | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/IndexedDB/transaction-create_in_versionchange.htm')
-rw-r--r-- | testing/web-platform/tests/IndexedDB/transaction-create_in_versionchange.htm | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/testing/web-platform/tests/IndexedDB/transaction-create_in_versionchange.htm b/testing/web-platform/tests/IndexedDB/transaction-create_in_versionchange.htm new file mode 100644 index 0000000000..d5bcfd45d8 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-create_in_versionchange.htm @@ -0,0 +1,82 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<title>Attempt to create new transactions inside a versionchange transaction</title> +<link rel="author" href="mailto:odinho@opera.com" title="Odin Hørthe Omdal"> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=resources/support.js></script> + +<script> + var db, events = [], + open_rq = createdb(async_test()) + + open_rq.onupgradeneeded = function(e) { + db = e.target.result + + db.createObjectStore("store") + .add("versionchange1", 1) + .addEventListener("success", log("versionchange_add.success")) + + assert_throws_dom('InvalidStateError', function() { db.transaction("store", "readonly", {durability: 'relaxed'}) }) + + e.target.transaction + .objectStore("store") + .count(2) + .addEventListener("success", log("versionchange_count.success")) + + assert_throws_dom('InvalidStateError', function() { db.transaction("store", "readwrite", {durability: 'relaxed'}) }) + + open_rq.transaction + .objectStore("store") + .add("versionchange2", 2) + .addEventListener("success", log("versionchange_add2.success")) + + open_rq.transaction.oncomplete = function(e) { + log("versionchange_txn.complete")(e) + + db.transaction("store", "readonly", {durability: 'relaxed'}) + .objectStore("store") + .count() + .addEventListener("success", log("complete_count.success")) + } + } + + open_rq.onsuccess = function(e) { + log("open_rq.success")(e) + + var txn = db.transaction("store", "readwrite", {durability: 'relaxed'}) + txn.objectStore("store") + .put("woo", 1) + .addEventListener("success", log("complete2_get.success")) + + txn.oncomplete = this.step_func(function(e) { + assert_array_equals(events, [ + "versionchange_add.success: 1", + "versionchange_count.success: 0", + "versionchange_add2.success: 2", + "versionchange_txn.complete", + + "open_rq.success: [object IDBDatabase]", + + "complete_count.success: 2", + "complete2_get.success: 1", + ], + "events") + this.done() + }) + } + + + function log(msg) { + return function(e) { + if(e && e.target && e.target.error) + events.push(msg + ": " + e.target.error.name) + else if(e && e.target && e.target.result !== undefined) + events.push(msg + ": " + e.target.result) + else + events.push(msg) + }; + } +</script> + +<div id=log></div> |