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 /toolkit/profile/xpcshell/test_conflict_installs.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 'toolkit/profile/xpcshell/test_conflict_installs.js')
-rw-r--r-- | toolkit/profile/xpcshell/test_conflict_installs.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/toolkit/profile/xpcshell/test_conflict_installs.js b/toolkit/profile/xpcshell/test_conflict_installs.js new file mode 100644 index 0000000000..741e7ed70f --- /dev/null +++ b/toolkit/profile/xpcshell/test_conflict_installs.js @@ -0,0 +1,40 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/* + * Tests that the profile service refuses to flush when the install.ini file + * has been modified. + */ + +function check_unchanged(service) { + Assert.ok( + !service.isListOutdated, + "Should not have detected a modification." + ); + try { + service.flush(); + Assert.ok(true, "Should have flushed."); + } catch (e) { + Assert.ok(false, "Should have succeeded flushing."); + } +} + +add_task(async () => { + let service = getProfileService(); + + Assert.ok(!service.isListOutdated, "Should not be modified yet."); + + let installsini = gDataHome.clone(); + installsini.append("installs.ini"); + + Assert.ok(!installsini.exists(), "File should not exist yet."); + installsini.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o644); + + installsini.remove(false); + // We have to do profile selection to actually have any install data. + selectStartupProfile(); + check_unchanged(service); + + // We can't reset the modification time back to exactly what it was, so I + // guess we can't do much more here :( +}); |