Bug 1897321 - Add minVersion variable to whatsNewPage Nimbus feature r=omc-reviewers,firefox-desktop-core-reviewers ,aminomancer

Differential Revision: https://phabricator.services.mozilla.com/D211892
This commit is contained in:
hanna alemu 2024-05-29 14:43:17 +00:00
parent 82329d580f
commit 868833e264
3 changed files with 22 additions and 3 deletions

View File

@ -3062,7 +3062,9 @@ pref("browser.backup.sqlite.step_delay_ms", 250);
pref("browser.profiles.enabled", false);
pref("startup.homepage_override_url_nimbus", "");
// These prefs are referring to the Fx update version
pref("startup.homepage_override_nimbus_maxVersion", "");
pref("startup.homepage_override_nimbus_minVersion", "");
// Pref to enable the content relevancy feature.
pref("toolkit.contentRelevancy.enabled", false);

View File

@ -750,17 +750,28 @@ nsBrowserContentHandler.prototype = {
const nimbusOverrideUrl = Services.urlFormatter.formatURLPref(
"startup.homepage_override_url_nimbus"
);
// This defines the maximum allowed Fx update version to see the
// nimbus WNP. For ex, if maxVersion is set to 127 but user updates
// to 128, they will not qualify.
const maxVersion = Services.prefs.getCharPref(
"startup.homepage_override_nimbus_maxVersion",
""
);
// This defines the minimum allowed Fx update version to see the
// nimbus WNP. For ex, if minVersion is set to 126 but user updates
// to 124, they will not qualify.
const minVersion = Services.prefs.getCharPref(
"startup.homepage_override_nimbus_minVersion",
""
);
let nimbusWNP;
// Update version should be less than or equal to maxVersion set by
// the experiment
// The update version should be less than or equal to maxVersion and
// greater or equal to minVersion set by the experiment.
if (
nimbusOverrideUrl &&
Services.vc.compare(update.appVersion, maxVersion) <= 0
Services.vc.compare(update.appVersion, maxVersion) <= 0 &&
Services.vc.compare(update.appVersion, minVersion) >= 0
) {
try {
let uri = Services.io.newURI(nimbusOverrideUrl);

View File

@ -1338,6 +1338,12 @@ whatsNewPage:
setPref:
branch: user
pref: startup.homepage_override_nimbus_maxVersion
minVersion:
description: Minimum Firefox update version
type: string
setPref:
branch: user
pref: startup.homepage_override_nimbus_minVersion
pbNewtab:
description: "A Firefox Messaging System message for the pbNewtab message channel"