Bug 1867190 - Add prefs for PHC probablities r=glandium
[gecko.git] / toolkit / profile / xpcshell / test_conflict_installs.js
blob741e7ed70f40d02f45da89988661bdb0be424c9e
1 /* Any copyright is dedicated to the Public Domain.
2    http://creativecommons.org/publicdomain/zero/1.0/ */
4 /*
5  * Tests that the profile service refuses to flush when the install.ini file
6  * has been modified.
7  */
9 function check_unchanged(service) {
10   Assert.ok(
11     !service.isListOutdated,
12     "Should not have detected a modification."
13   );
14   try {
15     service.flush();
16     Assert.ok(true, "Should have flushed.");
17   } catch (e) {
18     Assert.ok(false, "Should have succeeded flushing.");
19   }
22 add_task(async () => {
23   let service = getProfileService();
25   Assert.ok(!service.isListOutdated, "Should not be modified yet.");
27   let installsini = gDataHome.clone();
28   installsini.append("installs.ini");
30   Assert.ok(!installsini.exists(), "File should not exist yet.");
31   installsini.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o644);
33   installsini.remove(false);
34   // We have to do profile selection to actually have any install data.
35   selectStartupProfile();
36   check_unchanged(service);
38   // We can't reset the modification time back to exactly what it was, so I
39   // guess we can't do much more here :(
40 });