Bug 1869896 - Put automatic restart behind Nimbus experiment r=nalexander,application-update-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D196483
This commit is contained in:
Nipun Shukla 2023-12-20 18:57:53 +00:00
parent 11a7de2215
commit 32825b041c
7 changed files with 38 additions and 2 deletions

View File

@ -188,6 +188,8 @@ mobile/android/locales/
modules/libpref/greprefs.js
modules/libpref/init/all.js
modules/libpref/test/unit/*data/
toolkit/components/backgroundtasks/defaults/backgroundtasks.js
toolkit/components/backgroundtasks/defaults/backgroundtasks_browser.js
# Only contains non-standard test files.
python/

View File

@ -1161,6 +1161,8 @@ mobile/android/locales/
modules/libpref/greprefs.js
modules/libpref/init/all.js
modules/libpref/test/unit/*data/
toolkit/components/backgroundtasks/defaults/backgroundtasks.js
toolkit/components/backgroundtasks/defaults/backgroundtasks_browser.js
# Only contains non-standard test files.
python/

View File

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#filter substitution;
// These preferences override Gecko preferences in `greprefs.js`. Use
// `backgroundtasks_browser.js` to override browser/-specific preferences in
// `firefox.js`.
@ -45,3 +47,10 @@ pref("security.nocertdb", true);
// Prevent asynchronous preference writes.
pref("preferences.allow.omt-write", false);
// Enable automatic restarts during background updates for Nightly builds.
#ifdef NIGHTLY_BUILD
pref("app.update.background.automaticRestartEnabled", true);
#else
pref("app.update.background.automaticRestartEnabled", false);
#endif

View File

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#filter substitution;
// These preferences override override browser/-specific preferences in
// `firefox.js`. Use `backgroundtasks.js` to override general Gecko preferences
// in `greprefs.js`.

View File

@ -91,11 +91,11 @@ if CONFIG["MOZ_BUILD_APP"] == "browser":
"tests/BackgroundTask_targeting.sys.mjs",
]
FINAL_TARGET_FILES.browser.defaults.backgroundtasks += [
FINAL_TARGET_PP_FILES.browser.defaults.backgroundtasks += [
"defaults/backgroundtasks_browser.js",
]
FINAL_TARGET_FILES.defaults.backgroundtasks += [
FINAL_TARGET_PP_FILES.defaults.backgroundtasks += [
"defaults/backgroundtasks.js",
]

View File

@ -1172,6 +1172,23 @@ backgroundTaskMessage:
path: "browser/components/newtab/content-src/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json"
variables: {}
backgroundUpdateAutomaticRestart:
description: "Whether to automatically restart when the background update task could make more progress."
owner: nalexander@mozilla.com
applications:
- firefox-desktop-background-task
hasExposure: false
isEarlyStartup: false
variables:
enabled:
type: boolean
fallbackPref: app.update.background.automaticRestartEnabled
description: >-
When true, make the background update task restart when the final update state is `READY_FOR_RESTART`.
Generally, this will finish applying a staged update, completing the update earlier than it
otherwise would have been completed.
pictureinpicture:
description: Message for first time Picture-in-Picture users
owner: nbaumgardner@mozilla.com

View File

@ -17,6 +17,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
AppUpdater: "resource://gre/modules/AppUpdater.sys.mjs",
BackgroundTasksUtils: "resource://gre/modules/BackgroundTasksUtils.sys.mjs",
ExtensionUtils: "resource://gre/modules/ExtensionUtils.sys.mjs",
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
UpdateUtils: "resource://gre/modules/UpdateUtils.sys.mjs",
});
@ -436,6 +437,9 @@ export async function runBackgroundTask(commandLine) {
);
// If a restart loop is occurring then automaticRestartFound will be true.
if (
lazy.NimbusFeatures.backgroundUpdateAutomaticRestart.getVariable(
"enabled"
) &&
updateStatus === lazy.AppUpdater.STATUS.READY_FOR_RESTART &&
!automaticRestartFound
) {