Bug 2070978 - Remove newtab trainhop compatibility shim from browser_asrouter_newtab_messages. r=omc-reviewers,mimi

This shim is not required once Firefox 155 hits the release channel, which it has,
so we can remove it now.

Differential Revision: https://phabricator.services.mozilla.com/D325054
This commit is contained in:
Mike Conley
2026-09-11 18:52:32 +00:00
committed by mconley@mozilla.com
parent 8c7de1ce9e
commit 4f213efdc0
@@ -41,103 +41,10 @@ add_setup(async function () {
);
Assert.ok(gTestNewTabMessage, "Found a test fxa_cta message to use.");
/**
* @backward-compat { version 155 }
*
* This test message was added to PanelTestProvider in version 155. This test,
* however, runs in the newtab train-hop CI jobs, which means that we have
* to shim the test message until the PanelTestProvider change reaches 155.
*/
if (Services.vc.compare(AppConstants.MOZ_APP_VERSION, "155.0a1") < 0) {
gTestPollingNewTabMessage = {
id: "TEST_ASROUTER_NEWTAB_MESSAGE_POLL_DEFAULT",
template: "newtab_message",
content: {
messageType: "ASRouterNewTabMessage",
imageSrc:
// eslint-disable-next-line mozilla/no-newtab-refs-outside-newtab
"chrome://newtab/content/data/content/assets/kit-in-circle.svg",
heading: "Make Firefox your own",
body: "Set Firefox as your default browser and pin it so it's always a click away.",
hideDismissButton: false,
// Declarative variants: each entry's `targeting` is re-evaluated against
// the live ASRouter environment (the "uncached" attributes read live
// shell state), and the first match's content overlays the base content.
// A `final` entry stops the re-evaluation poll once reached. Here, each
// state drops whichever step is already satisfied, so only the still-
// relevant button(s) show: both when neither is done (base content), only
// "Pin to taskbar" once we're the default, only "Set as default" once
// we're pinned, and the completed state once both are true.
states: [
{
// Already the default but not pinned: drop the "Set as default" step
// and only ask to pin.
targeting: "isDefaultBrowserUncached && doesAppNeedPinUncached",
content: {
primaryButton: null,
},
},
{
// Already pinned but not the default: drop the "Pin to taskbar" step
// and only ask to set as default.
targeting: "!isDefaultBrowserUncached && !doesAppNeedPinUncached",
content: {
secondaryButton: null,
},
},
{
// Default and pinned: everything's done. Show the completed state
// and stop polling.
targeting: "isDefaultBrowserUncached && !doesAppNeedPinUncached",
final: true,
content: {
heading: "You're all set",
body: "Firefox is now your default browser and pinned. Thanks!",
// No `type`, so this renders in the primary style.
primaryButton: {
label: "Go to settings to try it out!",
action: {
type: "OPEN_ABOUT_PAGE",
data: { args: "settings#browserIcon", where: "tab" },
},
},
secondaryButton: null,
},
},
],
// The base content (neither step done) shows both steps, rendered non-
// primary (`type: "default"`) since neither is the single call-to-action.
// The states above swap in narrower content as each step is satisfied.
primaryButton: {
label: "Set as default",
type: "default",
action: {
type: "SET_DEFAULT_BROWSER",
},
},
secondaryButton: {
label: "Pin to taskbar",
type: "default",
action: {
type: "PIN_FIREFOX_TO_TASKBAR",
},
},
position: "ABOVE_TOPSITES",
},
frequency: {
lifetime: 3,
},
trigger: {
id: "newtabMessageCheck",
},
targeting: "true",
groups: ["cfr"],
};
} else {
gTestPollingNewTabMessage = await PanelTestProvider.getMessages().then(
msgs => msgs.find(msg => msg.id === TEST_POLLING_MESSAGE_ID)
);
}
gTestPollingNewTabMessage = await PanelTestProvider.getMessages().then(msgs =>
msgs.find(msg => msg.id === TEST_POLLING_MESSAGE_ID)
);
Assert.ok(
gTestPollingNewTabMessage,
"Found a test polling newtab message to use."