Bug 1843202 - Added Nimbus experiment to Windows autostart on login r=nalexander,mconley

Depends on D183504

Differential Revision: https://phabricator.services.mozilla.com/D184437
This commit is contained in:
Nipun Shukla 2023-10-06 15:30:23 +00:00
parent b15137b324
commit 0bb5d4e327
5 changed files with 32 additions and 1 deletions

View File

@ -322,6 +322,9 @@ pref("browser.startup.couldRestoreSession.count", 0);
// users as it is not implemented anywhere else.
#if defined(XP_WIN)
pref("browser.startup.preXulSkeletonUI", true);
// Whether the checkbox to enable Windows launch on login is shown
pref("browser.startup.windowsLaunchOnLogin.enabled", false);
#endif
// Show an upgrade dialog on major upgrades.

View File

@ -30,7 +30,7 @@
<checkbox id="browserRestoreSession"
data-l10n-id="startup-restore-windows-and-tabs"/>
#ifdef XP_WIN
<hbox id="windowsLaunchOnLoginBox" align="center">
<hbox id="windowsLaunchOnLoginBox" align="center" hidden="true">
<checkbox id="windowsLaunchOnLogin"
data-l10n-id="windows-launch-on-login"/>
</hbox>

View File

@ -13,6 +13,7 @@ ChromeUtils.defineESModuleGetters(this, {
MigrationUtils: "resource:///modules/MigrationUtils.sys.mjs",
TranslationsParent: "resource://gre/actors/TranslationsParent.sys.mjs",
WindowsLaunchOnLogin: "resource://gre/modules/WindowsLaunchOnLogin.sys.mjs",
NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
});
// Constants & Enumeration Values
@ -418,6 +419,12 @@ var gMainPane = {
"command",
gMainPane.onWindowsLaunchOnLoginChange
);
NimbusFeatures.windowsLaunchOnLogin.recordExposureEvent({
once: true,
});
if (NimbusFeatures.windowsLaunchOnLogin.getVariable("enabled")) {
document.getElementById("windowsLaunchOnLoginBox").hidden = false;
}
}
gMainPane.updateBrowserStartupUI =
gMainPane.updateBrowserStartupUI.bind(gMainPane);

View File

@ -10,6 +10,13 @@ ChromeUtils.defineESModuleGetters(this, {
WindowsLaunchOnLogin: "resource://gre/modules/WindowsLaunchOnLogin.sys.mjs",
});
add_setup(async function () {
// Ensure checkbox is enabled before running tests
await SpecialPowers.pushPrefEnv({
set: [["browser.startup.windowsLaunchOnLogin.enabled", true]],
});
});
add_task(async function test_check_checkbox() {
await WindowsLaunchOnLogin.withLaunchOnLoginRegistryKey(async wrk => {
// Open preferences to general pane
@ -104,6 +111,7 @@ add_task(async function delete_external_regkey() {
});
registerCleanupFunction(async function () {
await SpecialPowers.popPrefEnv();
await WindowsLaunchOnLogin.withLaunchOnLoginRegistryKey(async wrk => {
let registryName = WindowsLaunchOnLogin.getLaunchOnLoginRegistryName();
if (wrk.hasValue(registryName)) {

View File

@ -518,6 +518,19 @@ moreFromMozilla:
fallbackPref: browser.preferences.moreFromMozilla.template
description: UI template used to display Mozilla products. Possible values simple, advanced. Default is simple.
windowsLaunchOnLogin:
description: "New checkbox in about:preferences startup section to start Firefox on Windows login"
owner: omc@mozilla.com
hasExposure: true
exposureDescription: >-
Exposure is sent once per browsing session when the about:preferences URL is
first accessed.
variables:
enabled:
type: boolean
fallbackPref: browser.startup.windowsLaunchOnLogin.enabled
description: Should users see the Windows launch on login checkbox.
abouthomecache:
description: "The startup about:home cache."
owner: omc@mozilla.com