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/greprefs.js
modules/libpref/init/all.js modules/libpref/init/all.js
modules/libpref/test/unit/*data/ modules/libpref/test/unit/*data/
toolkit/components/backgroundtasks/defaults/backgroundtasks.js
toolkit/components/backgroundtasks/defaults/backgroundtasks_browser.js
# Only contains non-standard test files. # Only contains non-standard test files.
python/ python/

View file

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

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#filter substitution;
// These preferences override Gecko preferences in `greprefs.js`. Use // These preferences override Gecko preferences in `greprefs.js`. Use
// `backgroundtasks_browser.js` to override browser/-specific preferences in // `backgroundtasks_browser.js` to override browser/-specific preferences in
// `firefox.js`. // `firefox.js`.
@ -45,3 +47,10 @@ pref("security.nocertdb", true);
// Prevent asynchronous preference writes. // Prevent asynchronous preference writes.
pref("preferences.allow.omt-write", false); 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#filter substitution;
// These preferences override override browser/-specific preferences in // These preferences override override browser/-specific preferences in
// `firefox.js`. Use `backgroundtasks.js` to override general Gecko preferences // `firefox.js`. Use `backgroundtasks.js` to override general Gecko preferences
// in `greprefs.js`. // in `greprefs.js`.

View file

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

View file

@ -1172,6 +1172,23 @@ backgroundTaskMessage:
path: "browser/components/newtab/content-src/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json" path: "browser/components/newtab/content-src/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json"
variables: {} 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: pictureinpicture:
description: Message for first time Picture-in-Picture users description: Message for first time Picture-in-Picture users
owner: nbaumgardner@mozilla.com owner: nbaumgardner@mozilla.com

View file

@ -17,6 +17,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
AppUpdater: "resource://gre/modules/AppUpdater.sys.mjs", AppUpdater: "resource://gre/modules/AppUpdater.sys.mjs",
BackgroundTasksUtils: "resource://gre/modules/BackgroundTasksUtils.sys.mjs", BackgroundTasksUtils: "resource://gre/modules/BackgroundTasksUtils.sys.mjs",
ExtensionUtils: "resource://gre/modules/ExtensionUtils.sys.mjs", ExtensionUtils: "resource://gre/modules/ExtensionUtils.sys.mjs",
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
UpdateUtils: "resource://gre/modules/UpdateUtils.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 a restart loop is occurring then automaticRestartFound will be true.
if ( if (
lazy.NimbusFeatures.backgroundUpdateAutomaticRestart.getVariable(
"enabled"
) &&
updateStatus === lazy.AppUpdater.STATUS.READY_FOR_RESTART && updateStatus === lazy.AppUpdater.STATUS.READY_FOR_RESTART &&
!automaticRestartFound !automaticRestartFound
) { ) {