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 /dom/indexedDB/test/unit/test_readwriteflush_disabled.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/indexedDB/test/unit/test_readwriteflush_disabled.js')
-rw-r--r-- | dom/indexedDB/test/unit/test_readwriteflush_disabled.js | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/dom/indexedDB/test/unit/test_readwriteflush_disabled.js b/dom/indexedDB/test/unit/test_readwriteflush_disabled.js new file mode 100644 index 0000000000..6271959346 --- /dev/null +++ b/dom/indexedDB/test/unit/test_readwriteflush_disabled.js @@ -0,0 +1,72 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/* exported testGenerator, disableWorkerTest */ +var disableWorkerTest = "Need a way to set temporary prefs from a worker"; + +var testGenerator = testSteps(); + +function* testSteps() { + const name = this.window + ? window.location.pathname + : "test_readwriteflush_disabled.js"; + + info("Resetting experimental pref"); + + if (this.window) { + SpecialPowers.pushPrefEnv( + { + set: [["dom.indexedDB.experimental", false]], + }, + continueToNextStep + ); + yield undefined; + } else { + resetExperimental(); + } + + info("Opening database"); + + let request = indexedDB.open(name); + request.onerror = errorHandler; + request.onupgradeneeded = continueToNextStepSync; + request.onsuccess = unexpectedSuccessHandler; + + yield undefined; + + // upgradeneeded + request.onupgradeneeded = unexpectedSuccessHandler; + request.onsuccess = continueToNextStepSync; + + info("Creating objectStore"); + + request.result.createObjectStore(name); + + yield undefined; + + // success + let db = request.result; + + info("Attempting to create a 'readwriteflush' transaction"); + + let exception; + + try { + db.transaction(name, "readwriteflush"); + } catch (e) { + exception = e; + } + + ok(exception, "'readwriteflush' transaction threw"); + ok(exception instanceof Error, "exception is an Error object"); + is( + exception.message, + "IDBDatabase.transaction: 'readwriteflush' (value of argument 2) is not " + + "a valid value for enumeration IDBTransactionMode.", + "exception has the correct message" + ); + + finishTest(); +} |