mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1918194 - Pre: Add pref to allow downloading without BITS in background update task. r=bytesized,application-update-reviewers
There are lots of ways to achieve this for tests; this one is easier to understand than mocking parts deep inside of `UpdateService.sys.mjs`, i.e., within the `lazy` container object. Differential Revision: https://phabricator.services.mozilla.com/D221859
This commit is contained in:
parent
8999660240
commit
8eadf5e644
@ -61,6 +61,8 @@ const UPDATESERVICE_CID = Components.ID(
|
||||
const PREF_APP_UPDATE_ALTUPDATEDIRPATH = "app.update.altUpdateDirPath";
|
||||
const PREF_APP_UPDATE_BACKGROUNDERRORS = "app.update.backgroundErrors";
|
||||
const PREF_APP_UPDATE_BACKGROUNDMAXERRORS = "app.update.backgroundMaxErrors";
|
||||
const PREF_APP_UPDATE_BACKGROUND_ALLOWDOWNLOADSWITHOUTBITS =
|
||||
"app.update.background.allowDownloadsWithoutBITS";
|
||||
const PREF_APP_UPDATE_BITS_ENABLED = "app.update.BITS.enabled";
|
||||
const PREF_APP_UPDATE_CANCELATIONS = "app.update.cancelations";
|
||||
const PREF_APP_UPDATE_CANCELATIONS_OSX = "app.update.cancelations.osx";
|
||||
@ -6200,7 +6202,16 @@ class Downloader {
|
||||
let patchFile = updateDir.clone();
|
||||
patchFile.append(FILE_UPDATE_MAR);
|
||||
|
||||
if (lazy.gIsBackgroundTaskMode) {
|
||||
// Background updates generally should not fall back to internal (Necko)
|
||||
// downloads: on Windows, they should only use Windows BITS. In
|
||||
// automation, this pref allows Necko for testing.
|
||||
let allowDownloadsWithoutBITS =
|
||||
Cu.isInAutomation &&
|
||||
Services.prefs.getBoolPref(
|
||||
PREF_APP_UPDATE_BACKGROUND_ALLOWDOWNLOADSWITHOUTBITS,
|
||||
false
|
||||
);
|
||||
if (lazy.gIsBackgroundTaskMode && !allowDownloadsWithoutBITS) {
|
||||
// We don't normally run a background update if we can't use BITS, but
|
||||
// this branch is possible because we do fall back from BITS failures by
|
||||
// attempting an internal download.
|
||||
|
Loading…
Reference in New Issue
Block a user