diff --git a/toolkit/components/nimbus/FeatureManifest.yaml b/toolkit/components/nimbus/FeatureManifest.yaml index 32750f957b9a..028803ebde0a 100644 --- a/toolkit/components/nimbus/FeatureManifest.yaml +++ b/toolkit/components/nimbus/FeatureManifest.yaml @@ -1798,13 +1798,13 @@ backgroundUpdate: the feature can impact Firefox behaviour and the user experience. isEarlyStartup: false variables: - allowUpdatesForUnelevatedInstallations: + enableUpdatesForUnelevatedInstallations: description: >- Allow the background update process to download and apply updates when the Mozilla Maintenance Service is unavailable but the installation directory can be written. type: boolean - fallbackPref: app.update.background.allowUpdatesForUnelevatedInstallations + setPref: app.update.background.allowUpdatesForUnelevatedInstallations bookmarks: description: Prefs to control aspects of the bookmarks system. diff --git a/toolkit/mozapps/update/BackgroundUpdate.sys.mjs b/toolkit/mozapps/update/BackgroundUpdate.sys.mjs index 282243b9201e..aad1728e65d8 100644 --- a/toolkit/mozapps/update/BackgroundUpdate.sys.mjs +++ b/toolkit/mozapps/update/BackgroundUpdate.sys.mjs @@ -211,10 +211,13 @@ export var BackgroundUpdate = { } if (!serviceRegKeyExists) { - // The nimbus experiment allows users with unelevated installations - // to update in the background. - let allowUnelevated = lazy.NimbusFeatures.backgroundUpdate.getVariable( - "allowUpdatesForUnelevatedInstallations" + // A Nimbus rollout sets this preference and allows users with + // unelevated installations to update in the background. For that to + // work we use the setPref function to toggle a preference, because the + // value for Nimbus is currently not readable in a backgroundtask. The + // preference serves in that case as our communication channel. + let allowUnelevated = await Services.prefs.getBoolPref( + "app.update.background.allowUpdatesForUnelevatedInstallations" ); if (!allowUnelevated) { diff --git a/toolkit/mozapps/update/tests/unit_background_update/test_backgroundupdate_reason_update.js b/toolkit/mozapps/update/tests/unit_background_update/test_backgroundupdate_reason_update.js index c94c1a8cfabd..c5349f5a0606 100644 --- a/toolkit/mozapps/update/tests/unit_background_update/test_backgroundupdate_reason_update.js +++ b/toolkit/mozapps/update/tests/unit_background_update/test_backgroundupdate_reason_update.js @@ -6,12 +6,6 @@ "use strict"; -const lazy = {}; - -ChromeUtils.defineESModuleGetters(lazy, { - NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs", -}); - const { BackgroundUpdate } = ChromeUtils.importESModule( "resource://gre/modules/BackgroundUpdate.sys.mjs" ); @@ -239,39 +233,11 @@ add_task(async function test_reasons_update_manual_update_only() { Assert.ok(!result.includes(REASON.MANUAL_UPDATE_ONLY)); }); -// Ensure that we are starting on a clean machine without the service registry -// key. Enable and disable the Nimbus feature that allows the background -// updater to operate on unelevated installations, verifying that the -// appropriate reason to not update is (respectively, is not) reported. -add_task( - { - skip_if: () => AppConstants.platform != "win", - }, - async function test_unelevated_nimbus_default() { - // Default is disabled. - Assert.equal( - false, - lazy.NimbusFeatures.backgroundUpdate.getVariable( - "allowUpdatesForUnelevatedInstallations" - ), - "default is disabled" - ); - - let r = await reasons(); - Assert.ok( - r.includes(BackgroundUpdate.REASON.SERVICE_REGISTRY_KEY_MISSING), - `SERVICE_REGISTRY_KEY_MISSING in ${JSON.stringify(r)}` - ); - } -); - add_task( { skip_if: () => AppConstants.platform != "win", }, async function test_unelevated_nimbus_enabled() { - let r; - // Enable feature. Services.prefs.setBoolPref( "app.update.background.allowUpdatesForUnelevatedInstallations", @@ -284,7 +250,7 @@ add_task( }); // execute! - r = await reasons(); + let r = await reasons(); Assert.ok( !r.includes(BackgroundUpdate.REASON.SERVICE_REGISTRY_KEY_MISSING), `no SERVICE_REGISTRY_KEY_MISSING in ${JSON.stringify(r)}` diff --git a/toolkit/mozapps/update/tests/unit_background_update/xpcshell.ini b/toolkit/mozapps/update/tests/unit_background_update/xpcshell.ini index 45016b42e29c..7e30ff396be7 100644 --- a/toolkit/mozapps/update/tests/unit_background_update/xpcshell.ini +++ b/toolkit/mozapps/update/tests/unit_background_update/xpcshell.ini @@ -21,4 +21,6 @@ skip-if = [test_backgroundupdate_glean.js] [test_backgroundupdate_reason.js] [test_backgroundupdate_reason_update.js] +run-sequentially = very high failure rate in parallel + [test_backgroundupdate_reason_schedule.js]