Skip to content

Commit

Permalink
Bug 1843202 - Added Nimbus experiment to Windows autostart on login r…
Browse files Browse the repository at this point in the history
…=nalexander,mconley

Depends on D183504

Differential Revision: https://phabricator.services.mozilla.com/D184437
  • Loading branch information
nipunshukla21 committed Oct 6, 2023
1 parent b15137b commit 0bb5d4e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
3 changes: 3 additions & 0 deletions browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion browser/components/preferences/main.inc.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
7 changes: 7 additions & 0 deletions browser/components/preferences/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)) {
Expand Down
13 changes: 13 additions & 0 deletions toolkit/components/nimbus/FeatureManifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: [email protected]
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: [email protected]
Expand Down

0 comments on commit 0bb5d4e

Please sign in to comment.