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/quota/test/xpcshell/test_groupMismatch.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.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/quota/test/xpcshell/test_groupMismatch.js')
-rw-r--r-- | dom/quota/test/xpcshell/test_groupMismatch.js | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/dom/quota/test/xpcshell/test_groupMismatch.js b/dom/quota/test/xpcshell/test_groupMismatch.js new file mode 100644 index 0000000000..41a72d51ad --- /dev/null +++ b/dom/quota/test/xpcshell/test_groupMismatch.js @@ -0,0 +1,74 @@ +/** + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +/** + * This test is mainly to verify that metadata files with old group information + * get updated. See bug 1535995. + */ + +loadScript("dom/quota/test/common/file.js"); + +async function testSteps() { + const metadataFile = getRelativeFile( + "storage/default/https+++foo.bar.mozilla-iot.org/.metadata-v2" + ); + + async function readMetadataFile() { + let file = await File.createFromNsIFile(metadataFile); + + let buffer = await new Promise(resolve => { + let reader = new FileReader(); + reader.onloadend = () => resolve(reader.result); + reader.readAsArrayBuffer(file); + }); + + return buffer; + } + + info("Clearing"); + + let request = clear(); + await requestFinished(request); + + info("Installing package"); + + // The profile contains one initialized origin directory, a script for origin + // initialization and the storage database: + // - storage/default/https+++foo.bar.mozilla-iot.org + // - create_db.js + // - storage.sqlite + // The file create_db.js in the package was run locally, specifically it was + // temporarily added to xpcshell.ini and then executed: + // mach xpcshell-test --interactive dom/localstorage/test/xpcshell/create_db.js + // Note: to make it become the profile in the test, additional manual steps + // are needed. + // 1. Manually change the group in .metadata and .metadata-v2 from + // "bar.mozilla-iot.org" to "mozilla-iot.org". + // 2. Remove the folder "storage/temporary". + // 3. Remove the file "storage/ls-archive.sqlite". + installPackage("groupMismatch_profile"); + + info("Reading out contents of metadata file"); + + let metadataBuffer = await readMetadataFile(); + + info("Initializing"); + + request = init(); + await requestFinished(request); + + info("Initializing temporary storage"); + + request = initTemporaryStorage(); + await requestFinished(request); + + info("Reading out contents of metadata file"); + + let metadataBuffer2 = await readMetadataFile(); + + info("Verifying blobs differ"); + + ok(!compareBuffers(metadataBuffer, metadataBuffer2), "Metadata differ"); +} |