Bug 1070922 Comment 6 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I see. There is a similar infobar on Remote Settings, which we are also considering removing in bug 1825377. Firefox fetches some messages [from RS](https://firefox.settings.services.mozilla.com/v1/buckets/main/collections/cfr/records), and the relevant one is `INFOBAR_DEFAULT_AND_PIN_87`. Targeting is quite restrictive:

1. triggers on startup
2. Fx is not default browser
3. `browser.shell.checkDefaultBrowser` is set to false
4. OS is not linux
5. profile is between 5 and 15 weeks old

It's probably easier to just change the targeting. You can do that like this:

1. Open [OnboardingMessageProvider](https://searchfox.org/mozilla-central/source/browser/components/asrouter/modules/OnboardingMessageProvider.sys.mjs)
2. Add the following message (it has more permissive targeting) to the `BASE_MESSAGES` array (line 62):
    ```js
    {
      groups: ["cfr"],
      content: {
        text: { string_id: "default-browser-notification-message" },
        type: "global",
        buttons: [
          {
            label: { string_id: "default-browser-notification-button" },
            action: { type: "PIN_AND_DEFAULT" },
            primary: true,
            accessKey: "P",
          },
        ],
        category: "cfrFeatures",
        bucket_id: "INFOBAR_DEFAULT_AND_PIN_87",
      },
      trigger: { id: "defaultBrowserCheck" },
      template: "infobar",
      targeting:
        "!activeNotifications && !willShowDefaultPrompt && source == 'startup'",
      id: "INFOBAR_DEFAULT_AND_PIN_87",
    },
    ```
3. Launch firefox, it should show on startup

The [InfoBar](https://searchfox.org/mozilla-central/source/browser/components/asrouter/modules/InfoBar.sys.mjs) messaging surface is just a wrapper for [notificationbox](https://searchfox.org/mozilla-central/source/toolkit/content/widgets/notificationbox.js). So I think this could theoretically impact any notificationbox, as long as the notificationbox shows up after the window is already small, rather than trying to shrink the window while a notificationbox is already open.

I took this screenshot via some extra steps. After launching Firefox for the first time on a new profile, the infobar immediately showed (as the targeting here is more permissive). But that's fine since I removed the frequency caps from this version too, so it can show on every startup. So I dismissed the infobar and resized the window to the smallest dimensions possible. Then I restarted Firefox, with session restore enabled. On the next launch, the window started with the persisted tiny dimensions, and the infobar showed up like this.
I see. There is a similar infobar on Remote Settings, which we are also considering removing in bug 1825377. Firefox fetches some messages [from RS](https://firefox.settings.services.mozilla.com/v1/buckets/main/collections/cfr/records), and the relevant one is `INFOBAR_DEFAULT_AND_PIN_87`. Targeting is quite restrictive:

1. triggers on startup
2. Fx is not default browser
3. `browser.shell.checkDefaultBrowser` is set to false
4. OS is not linux
5. profile is between 5 and 15 weeks old

It's probably easier to just change the targeting. You can do that like this:

1. Open [OnboardingMessageProvider](https://searchfox.org/mozilla-central/source/browser/components/asrouter/modules/OnboardingMessageProvider.sys.mjs)
2. Add the following message (it has more permissive targeting) to the `BASE_MESSAGES` array (line 62):
    ```js
    {
      groups: ["cfr"],
      content: {
        text: { string_id: "default-browser-notification-message" },
        type: "global",
        buttons: [
          {
            label: { string_id: "default-browser-notification-button" },
            action: { type: "PIN_AND_DEFAULT" },
            primary: true,
            accessKey: "P",
          },
        ],
        category: "cfrFeatures",
        bucket_id: "INFOBAR_DEFAULT_AND_PIN_87",
      },
      trigger: { id: "defaultBrowserCheck" },
      template: "infobar",
      targeting:
        "!activeNotifications && !willShowDefaultPrompt && source == 'startup'",
      id: "INFOBAR_DEFAULT_AND_PIN_87",
    },
    ```
3. Launch firefox, it should show on startup

The [InfoBar](https://searchfox.org/mozilla-central/source/browser/components/asrouter/modules/InfoBar.sys.mjs) messaging surface is just a wrapper for [notificationbox](https://searchfox.org/mozilla-central/source/toolkit/content/widgets/notificationbox.js). So I think this could theoretically impact any notificationbox, as long as the notificationbox shows up after the window is already small, rather than trying to shrink the window while a notificationbox is already open. If you shrink the window while it's already open, the entire notificationbox ends up outside the window bounds. Whereas if you start with a tiny window, at least on Windows 10, the title is visible but not the buttons.

I took the attached screenshot via some extra steps. After launching Firefox for the first time on a new profile, the infobar immediately showed (as the targeting here is more permissive). But that's fine since I removed the frequency caps from this version too, so it can show on every startup. So I dismissed the infobar and resized the window to the smallest dimensions possible. Then I restarted Firefox, with session restore enabled. On the next launch, the window started with the persisted tiny dimensions, and the infobar showed up like this.

Back to Bug 1070922 Comment 6