1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
5 * Tests that the profile service refuses to flush when the profiles.ini file
9 function check_unchanged(service) {
11 !service.isListOutdated,
12 "Should not have detected a modification."
16 Assert.ok(true, "Should have flushed.");
18 Assert.ok(false, "Should have succeeded flushing.");
22 function check_outdated(service) {
23 Assert.ok(service.isListOutdated, "Should have detected a modification.");
26 Assert.ok(false, "Should have failed to flush.");
30 Cr.NS_ERROR_DATABASE_CHANGED,
31 "Should have refused to flush."
36 add_task(async () => {
37 let service = getProfileService();
39 Assert.ok(!service.isListOutdated, "Should not be modified yet.");
41 let profilesini = gDataHome.clone();
42 profilesini.append("profiles.ini");
44 Assert.ok(!profilesini.exists(), "File should not exist yet.");
45 profilesini.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o644);
46 check_outdated(service);
48 profilesini.remove(false);
49 check_unchanged(service);
51 let oldTime = profilesini.lastModifiedTime;
52 profilesini.lastModifiedTime = oldTime - 10000;
53 check_outdated(service);
55 // We can't reset the modification time back to exactly what it was, so I
56 // guess we can't do much more here :(