diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/IndexedDB/transaction-requestqueue.htm | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-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 'testing/web-platform/tests/IndexedDB/transaction-requestqueue.htm')
-rw-r--r-- | testing/web-platform/tests/IndexedDB/transaction-requestqueue.htm | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/testing/web-platform/tests/IndexedDB/transaction-requestqueue.htm b/testing/web-platform/tests/IndexedDB/transaction-requestqueue.htm new file mode 100644 index 000000000..b5706fe81 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/transaction-requestqueue.htm @@ -0,0 +1,89 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<title>Transactions have a request queue</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=support.js></script> + +<script> + +var db, t = async_test(document.title, {timeout: 10000}), + keys = { txn: [], txn2: [] }, + open_rq = createdb(t) + +open_rq.onupgradeneeded = function(e) { + var i, os; + db = e.target.result; + + for (i = 1; i < 6; i++) + { + os = db.createObjectStore("os" + i, { autoIncrement: true, keyPath: "k" }); + os.add({ os: "os" + i }); + os.put({ os: "os" + i, k: i}); + os.add({ os: "os" + i }); + } +} + +open_rq.onsuccess = function(e) { + var txn = db.transaction(["os2", "os1", "os3", "os5"]) + txn.objectStore("os1").openCursor().onsuccess = reg("txn") + txn.objectStore("os3").openCursor().onsuccess = reg("txn") + txn.objectStore("os1").get(2).onsuccess = reg("txn") + txn.objectStore("os2").get(3).onsuccess = reg("txn") + + var txn2 = db.transaction(["os4", "os3", "os1", "os5"]) + var os4 = txn2.objectStore("os4") + + for (var i=0; i < 3; i++) { + os4.openCursor().onsuccess = reg("txn2") + os4.get(5).onsuccess = reg("txn2") + os4.get(4).onsuccess = reg("txn2") + txn.objectStore("os2").get(1).onsuccess = reg("txn") + txn2.objectStore("os3").get(1).onsuccess = reg("txn2") + } + + txn2.objectStore("os1").get(2).onsuccess = reg("txn2") + txn.objectStore("os1").openCursor(null, "prev").onsuccess = reg("txn") + os4.openCursor(null, "prev").onsuccess = reg("txn2") + + txn.oncomplete = t.step_func(finish); + txn2.oncomplete = t.step_func(finish); +} + + +function reg(n) { + return t.step_func(function (e) { + var v = e.target.result; + if (v.value) v = v.value; + keys[n].push(v.os + ": " + v.k); + }); +} + +var finish_to_go = 2; +function finish() { + if (--finish_to_go) + return; + + assert_array_equals(keys['txn'], [ + "os1: 1", + "os3: 1", + "os1: 2", + "os2: 3", + "os2: 1", "os2: 1", "os2: 1", + "os1: 2", + ], 'transaction keys'); + + assert_array_equals(keys['txn2'], [ + "os4: 1", "os4: 5", "os4: 4", "os3: 1", + "os4: 1", "os4: 5", "os4: 4", "os3: 1", + "os4: 1", "os4: 5", "os4: 4", "os3: 1", + "os1: 2", + "os4: 5", + ], 'transaction 2 keys'); + + t.done(); +} +</script> + +<div id="log"></div> |