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 /storage/test/unit/test_default_journal_size_limit.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 'storage/test/unit/test_default_journal_size_limit.js')
-rw-r--r-- | storage/test/unit/test_default_journal_size_limit.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/storage/test/unit/test_default_journal_size_limit.js b/storage/test/unit/test_default_journal_size_limit.js new file mode 100644 index 0000000000..f2d28b9aa4 --- /dev/null +++ b/storage/test/unit/test_default_journal_size_limit.js @@ -0,0 +1,44 @@ +/* Any copyright is dedicated to the Public Domain. + * https://creativecommons.org/publicdomain/zero/1.0/ */ + +// Tests defaul journal_size_limit + +async function check_journal_size(db) { + let stmt = db.createAsyncStatement("PRAGMA journal_size_limit"); + let value = await new Promise((resolve, reject) => { + stmt.executeAsync({ + handleResult(resultSet) { + resolve(resultSet.getNextRow().getResultByIndex(0)); + }, + handleError(error) { + reject(); + }, + handleCompletion() {}, + }); + }); + Assert.greater(value, 0, "There is a positive journal_size_limit"); + stmt.finalize(); + await new Promise(resolve => db.asyncClose(resolve)); +} + +async function getDbPath(name) { + let path = PathUtils.join(PathUtils.profileDir, name + ".sqlite"); + Assert.ok(!(await IOUtils.exists(path))); + return path; +} + +add_task(async function () { + await check_journal_size( + Services.storage.openDatabase( + new FileUtils.File(await getDbPath("journal")) + ) + ); + await check_journal_size( + Services.storage.openUnsharedDatabase( + new FileUtils.File(await getDbPath("journalUnshared")) + ) + ); + await check_journal_size( + await openAsyncDatabase(new FileUtils.File(await getDbPath("journalAsync"))) + ); +}); |