feat: add update check disabling
(cherry picked from commit d97ab048aaea261d6f78640b62290a53815042f5)
This commit is contained in:
@@ -474,6 +474,7 @@ BrowserGlue.prototype = {
|
||||
// check for update if our build is old
|
||||
if (
|
||||
AppConstants.MOZ_UPDATER &&
|
||||
Services.prefs.getBoolPref("app.update.enabled") &&
|
||||
Services.prefs.getBoolPref("app.update.checkInstallTime")
|
||||
) {
|
||||
let buildID = Services.appinfo.appBuildID;
|
||||
|
||||
@@ -690,6 +690,9 @@
|
||||
<radio id="manualDesktop"
|
||||
value="false"
|
||||
data-l10n-id="update-application-check-choose"/>
|
||||
<radio id="disabledDesktop"
|
||||
value="disabled"
|
||||
data-l10n-id="update-application-manual"/>
|
||||
</radiogroup>
|
||||
<hbox id="updateSettingCrossUserWarningDesc" hidden="true">
|
||||
<hbox class="info-icon-container">
|
||||
|
||||
@@ -50,6 +50,9 @@ const ICON_URL_APP =
|
||||
// was set by us to a custom handler icon and CSS should not try to override it.
|
||||
const APP_ICON_ATTR_NAME = "appHandlerIcon";
|
||||
|
||||
// WATERFOX
|
||||
const PREF_UPDATE_ENABLED = "app.update.enabled";
|
||||
|
||||
Preferences.addAll([
|
||||
// Startup
|
||||
{ id: "browser.startup.page", type: "int" },
|
||||
@@ -183,6 +186,11 @@ Preferences.addAll([
|
||||
|
||||
// Media
|
||||
{ id: "media.hardwaremediakeys.enabled", type: "bool" },
|
||||
|
||||
// WATERFOX
|
||||
// Enable auto update checking
|
||||
{ id: "app.update.enabled", type: "bool" },
|
||||
|
||||
]);
|
||||
|
||||
if (AppConstants.HAVE_SHELL_SERVICE) {
|
||||
@@ -884,6 +892,8 @@ var gMainPane = {
|
||||
// Start with no option selected since we are still reading the value
|
||||
document.getElementById("autoDesktop").removeAttribute("selected");
|
||||
document.getElementById("manualDesktop").removeAttribute("selected");
|
||||
// WATERFOX
|
||||
document.getElementById("disabledDesktop").removeAttribute("selected");
|
||||
// Start reading the correct value from the disk
|
||||
this.readUpdateAutoPref();
|
||||
setEventListener("updateRadioGroup", "command", event => {
|
||||
@@ -2621,7 +2631,10 @@ var gMainPane = {
|
||||
|
||||
radiogroup.disabled = true;
|
||||
let enabled = await UpdateUtils.getAppUpdateAutoEnabled();
|
||||
radiogroup.value = enabled;
|
||||
// WATERFOX
|
||||
// If user sets app.update.enabled to false, set value to disabled, else use enabled
|
||||
let manualUpdates = Services.prefs.getBoolPref(PREF_UPDATE_ENABLED, true);
|
||||
radiogroup.value = !manualUpdates ? "disabled" : enabled;
|
||||
radiogroup.disabled = false;
|
||||
|
||||
this.maybeDisableBackgroundUpdateControls();
|
||||
@@ -2646,6 +2659,12 @@ var gMainPane = {
|
||||
try {
|
||||
await UpdateUtils.setAppUpdateAutoEnabled(updateAutoValue);
|
||||
await _disableTimeOverPromise;
|
||||
// WATERFOX
|
||||
// Ensure enabled pref is updated based on radiogroup value
|
||||
Services.prefs.setBoolPref(
|
||||
PREF_UPDATE_ENABLED,
|
||||
radiogroup.value != "disabled"
|
||||
);
|
||||
radiogroup.disabled = false;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@@ -2860,7 +2879,17 @@ var gMainPane = {
|
||||
if (aData != "true" && aData != "false") {
|
||||
throw new Error("Invalid preference value for app.update.auto");
|
||||
}
|
||||
document.getElementById("updateRadioGroup").value = aData;
|
||||
// WATERFOX
|
||||
// Going from Auto to Disable needs to be correctly reflected here
|
||||
// At this point app.update.enabled has not yet been set, so we
|
||||
// want to set disabled if it is going from true->false and is
|
||||
// currently true
|
||||
let manualUpdates = Services.prefs.getBoolPref(
|
||||
"app.update.enabled",
|
||||
true
|
||||
);
|
||||
document.getElementById("updateRadioGroup").value =
|
||||
manualUpdates && !(aData === "true") ? "disabled" : aData;
|
||||
this.maybeDisableBackgroundUpdateControls();
|
||||
} else if (aTopic == BACKGROUND_UPDATE_CHANGED_TOPIC) {
|
||||
if (!AppConstants.MOZ_UPDATE_AGENT) {
|
||||
|
||||
@@ -254,6 +254,11 @@ export class AppUpdater {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.#updateDisabledByPref) {
|
||||
this.#setStatus(AppUpdater.STATUS.NEVER_CHECKED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.aus.disabled) {
|
||||
LOG("AppUpdater:check - AUS disabled");
|
||||
this.#setStatus(AppUpdater.STATUS.UPDATE_DISABLED_BY_POLICY);
|
||||
@@ -412,6 +417,10 @@ export class AppUpdater {
|
||||
return Services.sysinfo.getProperty("isPackagedApp");
|
||||
}
|
||||
|
||||
get #updateDisabledByPref() {
|
||||
return !Services.prefs.getBoolPref("app.update.enabled", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads an update mar or connects to an in-progress download.
|
||||
* Doesn't resolve until the update is ready to install, or a failure state
|
||||
|
||||
@@ -3898,6 +3898,15 @@ export class UpdateService {
|
||||
* See nsIUpdateService.idl
|
||||
*/
|
||||
get canUsuallyCheckForUpdates() {
|
||||
let prefEnabled = Services.prefs.getBoolPref("app.update.enabled", true);
|
||||
if (!prefEnabled) {
|
||||
LOG(
|
||||
"UpdateService.canUsuallyCheckForUpdates - unable to automatically check " +
|
||||
"the preference is disabled."
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.disabled) {
|
||||
LOG(
|
||||
"UpdateService.canUsuallyCheckForUpdates - unable to automatically check " +
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
pref("accessibility.support.url", "https://www.waterfox.net/support/accessibility-services")
|
||||
pref("app.support.baseURL", "https://www.waterfox.net/support/%OS%/");
|
||||
pref("app.update.badgeWaitTime", 0);
|
||||
pref("app.update.enabled", true);
|
||||
pref("app.update.notifyDuringDownload", true);
|
||||
pref("app.update.promptWaitTime", 3600);
|
||||
pref("app.update.url.override", "", sticky);
|
||||
|
||||
Reference in New Issue
Block a user