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