зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1852093 - Change 'allowUpdatesForUnelevatedInstallations' to use setPref, r=bytesized
and rename it to 'enableUpdatesForUnelevatedInstallations'. Rationale: `defaultPref` worked in testing because the pref was manually toggled. But in the wild, the Nimbus feature *did not* set the preference, and therefore the background update task did not witness the changed preference. This meant the background update task was _scheduled_ but, when run, immediately exited with `SERVICE_REGISTRY_KEY_MISSING` because the pref was not set in the background update task profile. Differential Revision: https://phabricator.services.mozilla.com/D187865
This commit is contained in:
Родитель
9a60e8446f
Коммит
154c1ac997
|
@ -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.
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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)}`
|
||||
|
|
|
@ -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]
|
||||
|
|
Загрузка…
Ссылка в новой задаче