test_no_window_update_restart.py |
let [resolve] = arguments;
(async () => {
Services.prefs.setIntPref("app.update.download.attempts", 0);
Services.prefs.setIntPref("app.update.download.maxAttempts", 0);
Services.prefs.setBoolPref("app.update.staging.enabled", false);
Services.prefs.setBoolPref("app.update.noWindowAutoRestart.enabled", true);
Services.prefs.setIntPref("app.update.noWindowAutoRestart.delayMs", 1000);
Services.prefs.clearUserPref("testing.no_window_update_restart.silent_restart_env");
let { UpdateUtils } = ChromeUtils.importESModule(
"resource://gre/modules/UpdateUtils.sys.mjs"
);
let origAppUpdateAuto = await UpdateUtils.getAppUpdateAutoEnabled();
await UpdateUtils.setAppUpdateAutoEnabled(true);
// Prevent the update sync manager from thinking there are two instances running
let exePath = Services.dirsvc.get("XREExeF", Ci.nsIFile);
let dirProvider = {
getFile: function AGP_DP_getFile(aProp, aPersistent) {
aPersistent.value = false;
switch (aProp) {
case "XREExeF":
exePath.append("browser-test");
return exePath;
}
return null;
},
QueryInterface: ChromeUtils.generateQI(["nsIDirectoryServiceProvider"]),
};
let ds = Services.dirsvc.QueryInterface(Ci.nsIDirectoryService);
ds.QueryInterface(Ci.nsIProperties).undefine("XREExeF");
ds.registerProvider(dirProvider);
let gSyncManager = Cc["@mozilla.org/updates/update-sync-manager;1"].getService(
Ci.nsIUpdateSyncManager
);
gSyncManager.resetLock();
ds.unregisterProvider(dirProvider);
return origAppUpdateAuto;
})().then(resolve);
|
12492 |