diff --git a/browser/components/aboutwelcome/actors/AboutWelcomeChild.sys.mjs b/browser/components/aboutwelcome/actors/AboutWelcomeChild.sys.mjs
index db156388b98e..4c3d34ba6787 100644
--- a/browser/components/aboutwelcome/actors/AboutWelcomeChild.sys.mjs
+++ b/browser/components/aboutwelcome/actors/AboutWelcomeChild.sys.mjs
@@ -137,9 +137,6 @@ export class AboutWelcomeChild extends JSWindowActorChild {
Cu.exportFunction(this.AWNewScreen.bind(this), window, {
defineAs: "AWNewScreen",
});
- Cu.exportFunction(this.AWGetUnhandledCampaignAction.bind(this), window, {
- defineAs: "AWGetUnhandledCampaignAction",
- });
}
/**
@@ -392,12 +389,6 @@ export class AboutWelcomeChild extends JSWindowActorChild {
return this.wrapPromise(this.sendQuery("AWPage:NEW_SCREEN", screenId));
}
- AWGetUnhandledCampaignAction() {
- return this.sendQueryAndCloneForContent(
- "AWPage:GET_UNHANDLED_CAMPAIGN_ACTION"
- );
- }
-
/**
* @param {{type: string, detail?: any}} event
* @override
diff --git a/browser/components/aboutwelcome/actors/AboutWelcomeParent.sys.mjs b/browser/components/aboutwelcome/actors/AboutWelcomeParent.sys.mjs
index 09592a1e9fb4..a452d51d4aa8 100644
--- a/browser/components/aboutwelcome/actors/AboutWelcomeParent.sys.mjs
+++ b/browser/components/aboutwelcome/actors/AboutWelcomeParent.sys.mjs
@@ -34,8 +34,6 @@ ChromeUtils.defineLazyGetter(
);
const DID_SEE_ABOUT_WELCOME_PREF = "trailhead.firstrun.didSeeAboutWelcome";
-const DID_HANDLE_CAMAPAIGN_ACTION_PREF =
- "trailhead.firstrun.didHandleCampaignAction";
const AWTerminate = {
WINDOW_CLOSED: "welcome-window-closed",
TAB_CLOSED: "welcome-tab-closed",
@@ -262,28 +260,6 @@ export class AboutWelcomeParent extends JSWindowActorParent {
case "AWPage:SEND_TO_DEVICE_EMAILS_SUPPORTED": {
return lazy.BrowserUtils.sendToDeviceEmailsSupported();
}
- case "AWPage:GET_UNHANDLED_CAMPAIGN_ACTION": {
- if (
- !Services.prefs.getBoolPref(DID_HANDLE_CAMAPAIGN_ACTION_PREF, false)
- ) {
- return lazy.AWScreenUtils.getUnhandledCampaignAction();
- }
- break;
- }
- case "AWPage:HANDLE_CAMPAIGN_ACTION": {
- if (
- !Services.prefs.getBoolPref(DID_HANDLE_CAMAPAIGN_ACTION_PREF, false)
- ) {
- lazy.SpecialMessageActions.handleAction({ type: data }, browser);
- try {
- Services.prefs.setBoolPref(DID_HANDLE_CAMAPAIGN_ACTION_PREF, true);
- } catch (e) {
- lazy.log.debug(`Fails to set ${DID_HANDLE_CAMAPAIGN_ACTION_PREF}.`);
- }
- return true;
- }
- break;
- }
default:
lazy.log.debug(`Unexpected event ${type} was not handled.`);
}
diff --git a/browser/components/aboutwelcome/content-src/components/MultiStageAboutWelcome.jsx b/browser/components/aboutwelcome/content-src/components/MultiStageAboutWelcome.jsx
index 72d844a44a7f..f403f3077649 100644
--- a/browser/components/aboutwelcome/content-src/components/MultiStageAboutWelcome.jsx
+++ b/browser/components/aboutwelcome/content-src/components/MultiStageAboutWelcome.jsx
@@ -59,23 +59,6 @@ export const MultiStageAboutWelcome = props => {
didFilter.current = true;
- // After completing screen filtering, trigger any unhandled campaign
- // action present in the attribution campaign data. This updates the
- // "trailhead.firstrun.didHandleCampaignAction" preference, marking the
- // actions as complete to prevent them from being handled on subsequent
- // visits to about:welcome. Do not await getting the action to avoid
- // blocking the thread.
- window
- .AWGetUnhandledCampaignAction?.()
- .then(action => {
- if (typeof action === "string") {
- AboutWelcomeUtils.handleCampaignAction(action, props.message_id);
- }
- })
- .catch(error => {
- console.error("Failed to get unhandled campaign action:", error);
- });
-
const screenInitials = filteredScreens
.map(({ id }) => id?.split("_")[1]?.[0])
.join("");
diff --git a/browser/components/aboutwelcome/content-src/lib/aboutwelcome-utils.mjs b/browser/components/aboutwelcome/content-src/lib/aboutwelcome-utils.mjs
index 6c72beb24ee0..4cbb888e28a9 100644
--- a/browser/components/aboutwelcome/content-src/lib/aboutwelcome-utils.mjs
+++ b/browser/components/aboutwelcome/content-src/lib/aboutwelcome-utils.mjs
@@ -70,13 +70,6 @@ export const AboutWelcomeUtils = {
getLoadingStrategyFor(url) {
return url?.startsWith("http") ? "lazy" : "eager";
},
- handleCampaignAction(action, messageId) {
- window.AWSendToParent("HANDLE_CAMPAIGN_ACTION", action).then(handled => {
- if (handled) {
- this.sendActionTelemetry(messageId, "CAMPAIGN_ACTION");
- }
- });
- },
};
export const DEFAULT_RTAMO_CONTENT = {
diff --git a/browser/components/aboutwelcome/content/aboutwelcome.bundle.js b/browser/components/aboutwelcome/content/aboutwelcome.bundle.js
index 30600c1276c9..f00bb40b7f96 100644
--- a/browser/components/aboutwelcome/content/aboutwelcome.bundle.js
+++ b/browser/components/aboutwelcome/content/aboutwelcome.bundle.js
@@ -100,13 +100,6 @@ const AboutWelcomeUtils = {
getLoadingStrategyFor(url) {
return url?.startsWith("http") ? "lazy" : "eager";
},
- handleCampaignAction(action, messageId) {
- window.AWSendToParent("HANDLE_CAMPAIGN_ACTION", action).then(handled => {
- if (handled) {
- this.sendActionTelemetry(messageId, "CAMPAIGN_ACTION");
- }
- });
- },
};
const DEFAULT_RTAMO_CONTENT = {
@@ -222,20 +215,6 @@ const MultiStageAboutWelcome = props => {
// e.g. if AW_LANGUAGE_MISMATCH exists, use it from existing screens
setScreens(filteredScreens.map(filtered => screens.find(s => s.id === filtered.id) ?? filtered));
didFilter.current = true;
-
- // After completing screen filtering, trigger any unhandled campaign
- // action present in the attribution campaign data. This updates the
- // "trailhead.firstrun.didHandleCampaignAction" preference, marking the
- // actions as complete to prevent them from being handled on subsequent
- // visits to about:welcome. Do not await getting the action to avoid
- // blocking the thread.
- window.AWGetUnhandledCampaignAction?.().then(action => {
- if (typeof action === "string") {
- _lib_aboutwelcome_utils_mjs__WEBPACK_IMPORTED_MODULE_2__.AboutWelcomeUtils.handleCampaignAction(action, props.message_id);
- }
- }).catch(error => {
- console.error("Failed to get unhandled campaign action:", error);
- });
const screenInitials = filteredScreens.map(({
id
}) => id?.split("_")[1]?.[0]).join("");
diff --git a/browser/components/aboutwelcome/modules/AWScreenUtils.sys.mjs b/browser/components/aboutwelcome/modules/AWScreenUtils.sys.mjs
index 0774543a7ed5..48da44b3e86e 100644
--- a/browser/components/aboutwelcome/modules/AWScreenUtils.sys.mjs
+++ b/browser/components/aboutwelcome/modules/AWScreenUtils.sys.mjs
@@ -42,20 +42,6 @@ export const AWScreenUtils = {
return true;
},
- /**
- * Returns the string identifier of an unhandled campaign action, if
- * applicable otherwise false.
- *
- * @returns {string|boolean}
- */
- async getUnhandledCampaignAction() {
- const UNHANDLED_CAMPAIGN_ACTION_TARGETING = "unhandledCampaignAction";
- let result = await lazy.ASRouter.evaluateExpression({
- expression: UNHANDLED_CAMPAIGN_ACTION_TARGETING,
- context: lazy.ASRouterTargeting.Environment,
- });
- return result?.evaluationStatus?.result || false;
- },
/**
* Filter out screens whose targeting do not match.
*
diff --git a/browser/components/aboutwelcome/modules/AboutWelcomeDefaults.sys.mjs b/browser/components/aboutwelcome/modules/AboutWelcomeDefaults.sys.mjs
index eac7fa6b7db8..ed02f31660cd 100644
--- a/browser/components/aboutwelcome/modules/AboutWelcomeDefaults.sys.mjs
+++ b/browser/components/aboutwelcome/modules/AboutWelcomeDefaults.sys.mjs
@@ -90,7 +90,7 @@ const MR_ABOUT_WELCOME_DEFAULT = {
{
id: "AW_EASY_SETUP_NEEDS_DEFAULT_AND_PIN",
targeting:
- "doesAppNeedPin && (unhandledCampaignAction != 'SET_DEFAULT_BROWSER') && 'browser.shell.checkDefaultBrowser'|preferenceValue && !isDefaultBrowser",
+ "doesAppNeedPin && 'browser.shell.checkDefaultBrowser'|preferenceValue && !isDefaultBrowser",
content: {
position: "split",
split_narrow_bkg_position: "-60px",
@@ -224,7 +224,7 @@ const MR_ABOUT_WELCOME_DEFAULT = {
{
id: "AW_EASY_SETUP_NEEDS_DEFAULT",
targeting:
- "!doesAppNeedPin && (unhandledCampaignAction != 'SET_DEFAULT_BROWSER') && 'browser.shell.checkDefaultBrowser'|preferenceValue && !isDefaultBrowser",
+ "!doesAppNeedPin && 'browser.shell.checkDefaultBrowser'|preferenceValue && !isDefaultBrowser",
content: {
position: "split",
split_narrow_bkg_position: "-60px",
@@ -335,7 +335,7 @@ const MR_ABOUT_WELCOME_DEFAULT = {
{
id: "AW_EASY_SETUP_NEEDS_PIN",
targeting:
- "doesAppNeedPin && (!'browser.shell.checkDefaultBrowser'|preferenceValue || isDefaultBrowser || (unhandledCampaignAction == 'SET_DEFAULT_BROWSER'))",
+ "doesAppNeedPin && (!'browser.shell.checkDefaultBrowser'|preferenceValue || isDefaultBrowser)",
content: {
position: "split",
split_narrow_bkg_position: "-60px",
@@ -457,7 +457,7 @@ const MR_ABOUT_WELCOME_DEFAULT = {
{
id: "AW_EASY_SETUP_ONLY_IMPORT",
targeting:
- "!doesAppNeedPin && (!'browser.shell.checkDefaultBrowser'|preferenceValue || isDefaultBrowser || (unhandledCampaignAction == 'SET_DEFAULT_BROWSER'))",
+ "!doesAppNeedPin && (!'browser.shell.checkDefaultBrowser'|preferenceValue || isDefaultBrowser)",
content: {
position: "split",
split_narrow_bkg_position: "-60px",
diff --git a/browser/components/aboutwelcome/tests/browser/browser.toml b/browser/components/aboutwelcome/tests/browser/browser.toml
index 8ec96b39cee9..afab37b415e4 100644
--- a/browser/components/aboutwelcome/tests/browser/browser.toml
+++ b/browser/components/aboutwelcome/tests/browser/browser.toml
@@ -14,13 +14,6 @@ run-if = [
]
skip-if = ["os == 'win' && msix"] # These tests rely on the ability to write postSigningData, which we can't do in MSIX builds. https://bugzilla.mozilla.org/show_bug.cgi?id=1805911
-["browser_aboutwelcome_campaign_actions.js"]
-run-if = [
- "os == 'win'", # installation attribution is only available on Windows and macOS
- "os == 'mac'", # installation attribution is only available on Windows and macOS
-]
-skip-if = ["os == 'win' && msix"] # Attribution code cannot be written for MSIX builds
-
["browser_aboutwelcome_configurable_ui.js"]
["browser_aboutwelcome_fxa_signin_flow.js"]
diff --git a/browser/components/aboutwelcome/tests/browser/browser_aboutwelcome_campaign_actions.js b/browser/components/aboutwelcome/tests/browser/browser_aboutwelcome_campaign_actions.js
deleted file mode 100644
index 6ad9d075ac56..000000000000
--- a/browser/components/aboutwelcome/tests/browser/browser_aboutwelcome_campaign_actions.js
+++ /dev/null
@@ -1,96 +0,0 @@
-"use strict";
-
-const { ASRouter } = ChromeUtils.importESModule(
- "resource:///modules/asrouter/ASRouter.sys.mjs"
-);
-const { AttributionCode } = ChromeUtils.importESModule(
- "resource:///modules/AttributionCode.sys.mjs"
-);
-const { SpecialMessageActions } = ChromeUtils.importESModule(
- "resource://messaging-system/lib/SpecialMessageActions.sys.mjs"
-);
-
-const TEST_ATTRIBUTION_DATA = {
- campaign: "set_default_browser",
-};
-
-const DID_HANDLE_CAMAPAIGN_ACTION_PREF =
- "trailhead.firstrun.didHandleCampaignAction";
-
-const TEST_PROTON_CONTENT = [
- {
- id: "AW_STEP1",
- content: {
- title: "Step 1",
- primary_button: {
- label: "Next",
- action: {
- navigate: true,
- },
- },
- },
- },
-];
-
-add_task(async function test_unhandled_campaign_action() {
- const sandbox = sinon.createSandbox();
- const handleActionStub = sandbox
- .stub(SpecialMessageActions, "handleAction")
- .resolves();
-
- await AttributionCode.deleteFileAsync();
- await ASRouter.forceAttribution(TEST_ATTRIBUTION_DATA);
- const TEST_PROTON_JSON = JSON.stringify(TEST_PROTON_CONTENT);
-
- await setAboutWelcomePref(true);
- await pushPrefs(["browser.aboutwelcome.screens", TEST_PROTON_JSON]);
-
- AttributionCode._clearCache();
- const data = await AttributionCode.getAttrDataAsync();
-
- Assert.equal(
- data.campaign,
- "set_default_browser",
- "Attribution campaign should be set"
- );
-
- let tab = await BrowserTestUtils.openNewForegroundTab(
- gBrowser,
- "about:welcome",
- true
- );
-
- await TestUtils.waitForCondition(() => handleActionStub.called);
-
- Assert.equal(
- handleActionStub.firstCall.args[0].type,
- "SET_DEFAULT_BROWSER",
- "Set default special message action is called"
- );
-
- Assert.equal(
- Services.prefs.getBoolPref(DID_HANDLE_CAMAPAIGN_ACTION_PREF, false),
- true,
- "Set default campaign action handled pref is set to true"
- );
-
- handleActionStub.reset();
- // Open a new about:welcome tab to ensure the action does not run again
- let tab2 = await BrowserTestUtils.openNewForegroundTab(
- gBrowser,
- "about:welcome",
- true
- );
-
- sinon.assert.notCalled(handleActionStub);
-
- registerCleanupFunction(async () => {
- BrowserTestUtils.removeTab(tab);
- BrowserTestUtils.removeTab(tab2);
- await ASRouter.forceAttribution("");
- Services.prefs.clearUserPref(DID_HANDLE_CAMAPAIGN_ACTION_PREF);
- Services.prefs.clearUserPref("browser.aboutwelcome.screens");
-
- sandbox.restore();
- });
-});
diff --git a/browser/components/aboutwelcome/tests/browser/browser_aboutwelcome_multistage_mr.js b/browser/components/aboutwelcome/tests/browser/browser_aboutwelcome_multistage_mr.js
index a4a0f1bf3866..99bebae81423 100644
--- a/browser/components/aboutwelcome/tests/browser/browser_aboutwelcome_multistage_mr.js
+++ b/browser/components/aboutwelcome/tests/browser/browser_aboutwelcome_multistage_mr.js
@@ -86,7 +86,7 @@ add_task(async function test_aboutwelcome_easy_setup_screen_impression() {
.stub(AWScreenUtils, "evaluateScreenTargeting")
.resolves(false)
.withArgs(
- "doesAppNeedPin && (unhandledCampaignAction != 'SET_DEFAULT_BROWSER') && 'browser.shell.checkDefaultBrowser'|preferenceValue && !isDefaultBrowser"
+ "doesAppNeedPin && 'browser.shell.checkDefaultBrowser'|preferenceValue && !isDefaultBrowser"
)
.resolves(true)
.withArgs("isDeviceMigration")
diff --git a/browser/components/aboutwelcome/tests/unit/AWScreenUtils.test.jsx b/browser/components/aboutwelcome/tests/unit/AWScreenUtils.test.jsx
index 489956e02598..b6e9489ef940 100644
--- a/browser/components/aboutwelcome/tests/unit/AWScreenUtils.test.jsx
+++ b/browser/components/aboutwelcome/tests/unit/AWScreenUtils.test.jsx
@@ -137,19 +137,4 @@ describe("AWScreenUtils", () => {
assert.equal(addScreenImpressionStub.firstCall.args[0].id, testScreen.id);
});
});
- describe("getUnhandledCampaignAction", () => {
- it("Should call evaluateExpression", () => {
- const evaluateExpressionStub = sandbox.stub(
- ASRouter,
- "evaluateExpression"
- );
- AWScreenUtils.getUnhandledCampaignAction();
-
- assert.calledOnce(evaluateExpressionStub);
- assert.equal(
- evaluateExpressionStub.firstCall.args[0].expression,
- "unhandledCampaignAction"
- );
- });
- });
});
diff --git a/browser/components/aboutwelcome/tests/unit/MultiStageAboutWelcome.test.jsx b/browser/components/aboutwelcome/tests/unit/MultiStageAboutWelcome.test.jsx
index 7b5409bec2b5..1075e23e6fb5 100644
--- a/browser/components/aboutwelcome/tests/unit/MultiStageAboutWelcome.test.jsx
+++ b/browser/components/aboutwelcome/tests/unit/MultiStageAboutWelcome.test.jsx
@@ -12,13 +12,6 @@ import { shallow, mount } from "enzyme";
import { AboutWelcomeDefaults } from "modules/AboutWelcomeDefaults.sys.mjs";
import { AboutWelcomeUtils } from "content-src/lib/aboutwelcome-utils.mjs";
-const spinEventLoop = async () => {
- // Spin the event loop to allow the useEffect hooks to execute,
- // any promises to resolve, and re-rendering to happen after the
- // promises have updated the state/props
- await new Promise(resolve => setTimeout(resolve, 0));
-};
-
describe("MultiStageAboutWelcome module", () => {
let globals;
let sandbox;
@@ -37,7 +30,6 @@ describe("MultiStageAboutWelcome module", () => {
AWEvaluateScreenTargeting: () => {},
AWGetSelectedTheme: () => Promise.resolve("automatic"),
AWGetInstalledAddons: () => Promise.resolve(["test-addon-id"]),
- AWGetUnhandledCampaignAction: () => Promise.resolve(false),
AWSendEventTelemetry: () => {},
AWSendToParent: () => {},
AWWaitForMigrationClose: () => Promise.resolve(),
@@ -61,7 +53,10 @@ describe("MultiStageAboutWelcome module", () => {
it("should pass activeTheme and initialTheme props to WelcomeScreen", async () => {
let wrapper = mount();
- await spinEventLoop();
+ // Spin the event loop to allow the useEffect hooks to execute,
+ // any promises to resolve, and re-rendering to happen after the
+ // promises have updated the state/props
+ await new Promise(resolve => setTimeout(resolve, 0));
// sync up enzyme's representation with the real DOM
wrapper.update();
@@ -75,7 +70,10 @@ describe("MultiStageAboutWelcome module", () => {
it("should fetch a list of installed Addons", async () => {
let wrapper = mount();
- await spinEventLoop();
+ // Spin the event loop to allow the useEffect hooks to execute,
+ // any promises to resolve, and re-rendering to happen after the
+ // promises have updated the state/props
+ await new Promise(resolve => setTimeout(resolve, 0));
// sync up enzyme's representation with the real DOM
wrapper.update();
@@ -1134,103 +1132,6 @@ describe("MultiStageAboutWelcome module", () => {
AboutWelcomeUtils.handleUserAction.resetHistory();
}
});
- it("Should handle a campaign action when applicable", async () => {
- let actionSpy = sandbox.spy(AboutWelcomeUtils, "handleCampaignAction");
- let telemetrySpy = sandbox.spy(
- AboutWelcomeUtils,
- "sendActionTelemetry"
- );
-
- globals.set("AWGetUnhandledCampaignAction", () =>
- Promise.resolve("SET_DEFAULT_BROWSER")
- );
- // Return true when "HANDLE_CAMPAIGN_ACTION" is sent to parent
- globals.set("AWSendToParent", () => Promise.resolve(true));
- const screens = [
- {
- content: {
- title: "test title",
- },
- },
- ];
- const TEST_PROPS = {
- defaultScreens: screens,
- message_id: "DEFAULT_ABOUTWELCOME",
- startScreen: 0,
- };
- let wrapper = mount();
- await spinEventLoop();
- wrapper.update();
- assert.calledOnce(actionSpy);
- // If campaign is handled, we should send telemetry
- assert.calledOnce(telemetrySpy);
- assert.equal(telemetrySpy.firstCall.args[1], "CAMPAIGN_ACTION");
- globals.restore();
- });
- it("Should not handle a campaign action when the action has already been handled", async () => {
- let actionSpy = sandbox.spy(AboutWelcomeUtils, "handleCampaignAction");
- let telemetrySpy = sandbox.spy(
- AboutWelcomeUtils,
- "sendActionTelemetry"
- );
-
- globals.set("AWGetUnhandledCampaignAction", () =>
- Promise.resolve(false)
- );
- const screens = [
- {
- content: {
- title: "test title",
- },
- },
- ];
- const TEST_PROPS = {
- defaultScreens: screens,
- message_id: "DEFAULT_ABOUTWELCOME",
- startScreen: 0,
- };
- let wrapper = mount();
- await spinEventLoop();
- wrapper.update();
- assert.notCalled(actionSpy);
- assert.notCalled(telemetrySpy);
- globals.restore();
- });
- it("Should not send telemetrty when campaign action handling fails", async () => {
- let actionSpy = sandbox.spy(AboutWelcomeUtils, "handleCampaignAction");
- let telemetrySpy = sandbox.spy(
- AboutWelcomeUtils,
- "sendActionTelemetry"
- );
-
- globals.set("AWGetUnhandledCampaignAction", () =>
- Promise.resolve("SET_DEFAULT_BROWSER")
- );
-
- // Return undefined when "HANDLE_CAMPAIGN_ACTION" is sent to parent as
- // though "AWPage:HANDLE_CAMPAIGN_ACTION" case did not return true due
- // to failure executing action or the campaign handled pref being true
- globals.set("AWSendToParent", () => Promise.resolve(undefined));
- const screens = [
- {
- content: {
- title: "test title",
- },
- },
- ];
- const TEST_PROPS = {
- defaultScreens: screens,
- message_id: "DEFAULT_ABOUTWELCOME",
- startScreen: 0,
- };
- let wrapper = mount();
- await spinEventLoop();
- wrapper.update();
- assert.calledOnce(actionSpy);
- // If campaign handling fails, we should not send telemetry
- assert.notCalled(telemetrySpy);
- globals.restore();
- });
});
describe("#handleUserAction", () => {
diff --git a/browser/components/asrouter/docs/targeting-attributes.md b/browser/components/asrouter/docs/targeting-attributes.md
index d0e649ac0527..e5931755288e 100644
--- a/browser/components/asrouter/docs/targeting-attributes.md
+++ b/browser/components/asrouter/docs/targeting-attributes.md
@@ -49,7 +49,6 @@ Please note that some targeting attributes require stricter controls on the tele
* [isMajorUpgrade](#ismajorupgrade)
* [isMSIX](#ismsix)
* [isRTAMO](#isrtamo)
-* [unhandledCampaignAction](#unhandledCampaignAction)
* [launchOnLoginEnabled](#launchonloginenabled)
* [locale](#locale)
* [localeLanguageCode](#localelanguagecode)
@@ -1042,10 +1041,6 @@ A boolean. `true` when both the current install and current profile support crea
A boolean. `true` when the `toolkit.profiles.storeID` pref has a value. Indicates that the profile is part of a profile group managed by the `SelectableProfileService`, and the user has used the multiple profiles feature. `false` otherwise.
-### `unhandledCampaignAction`
-
-A string. A special message action to be executed on first-run. For example, `"SET_DEFAULT_BROWSER"` when the user selected to set as default via the [install marketing page](https://www.mozilla.org/firefox/new/) and set default has not yet been automatically triggered, `null` otherwise.
-
### `isMSIX`
A boolean. `true` when hasPackageId is `true` on Windows, `false` otherwise.
diff --git a/browser/components/asrouter/modules/ASRouterTargeting.sys.mjs b/browser/components/asrouter/modules/ASRouterTargeting.sys.mjs
index 8726c99b6811..39e98059916c 100644
--- a/browser/components/asrouter/modules/ASRouterTargeting.sys.mjs
+++ b/browser/components/asrouter/modules/ASRouterTargeting.sys.mjs
@@ -176,12 +176,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
"toolkit.profiles.storeID",
null
);
-XPCOMUtils.defineLazyPreferenceGetter(
- lazy,
- "didHandleCampaignAction",
- "trailhead.firstrun.didHandleCampaignAction",
- false
-);
XPCOMUtils.defineLazyServiceGetters(lazy, {
AUS: ["@mozilla.org/updates/update-service;1", "nsIApplicationUpdateService"],
@@ -264,39 +258,6 @@ function CacheListAttachedOAuthClients() {
};
}
-function CacheUnhandledCampaignAction() {
- return {
- _lastUpdated: 0,
- _value: null,
- expire() {
- this._lastUpdated = 0;
- this._value = null;
- },
- get() {
- const now = Date.now();
- // Don't get cached value until the action has been handled to ensure
- // proper screen targeting in about:welcome
- if (
- now - this._lastUpdated >= FRECENT_SITES_UPDATE_INTERVAL ||
- !lazy.didHandleCampaignAction
- ) {
- this._value = null;
- if (!lazy.didHandleCampaignAction) {
- const attributionData =
- lazy.AttributionCode.getCachedAttributionData();
- const ALLOWED_CAMPAIGN_ACTIONS = ["SET_DEFAULT_BROWSER"];
- const campaign = attributionData?.campaign?.toUpperCase();
- if (campaign && ALLOWED_CAMPAIGN_ACTIONS.includes(campaign)) {
- this._value = campaign;
- }
- }
- this._lastUpdated = now;
- }
- return this._value;
- },
- };
-}
-
function CheckBrowserNeedsUpdate(
updateInterval = FRECENT_SITES_UPDATE_INTERVAL
) {
@@ -365,7 +326,6 @@ export const QueryCache = {
RecentBookmarks: new CachedTargetingGetter("getRecentBookmarks"),
ListAttachedOAuthClients: new CacheListAttachedOAuthClients(),
UserMonthlyActivity: new CachedTargetingGetter("getUserMonthlyActivity"),
- UnhandledCampaignAction: new CacheUnhandledCampaignAction(),
},
getters: {
doesAppNeedPin: new CachedTargetingGetter(
@@ -1106,17 +1066,6 @@ const TargetingGetters = {
return attributionData?.campaign === "migration";
},
- /**
- * Whether the user opted into a special message action represented by an
- * installer attribution campaign and this choice still needs to be honored.
- * @return {string} A special message action to be executed on first-run. For
- * example, `"SET_DEFAULT_BROWSER"` when the user selected to set as default
- * via the install marketing page and set default has not yet been
- * automatically triggered, 'null' otherwise.
- */
- get unhandledCampaignAction() {
- return QueryCache.queries.UnhandledCampaignAction.get();
- },
/**
* The values of the height and width available to the browser to display
* web content. The available height and width are each calculated taking
diff --git a/browser/components/asrouter/tests/browser/browser_asrouter_targeting.js b/browser/components/asrouter/tests/browser/browser_asrouter_targeting.js
index 041c85276307..b31d3cf5e99e 100644
--- a/browser/components/asrouter/tests/browser/browser_asrouter_targeting.js
+++ b/browser/components/asrouter/tests/browser/browser_asrouter_targeting.js
@@ -1859,79 +1859,3 @@ add_task(
);
}
);
-
-add_task(async function check_unhandledCampaignAction() {
- is(
- typeof ASRouterTargeting.Environment.unhandledCampaignAction,
- "object",
- "Should return an object" // is null unless an unhandled action is present
- );
-
- const DID_HANDLE_CAMAPAIGN_ACTION_PREF =
- "trailhead.firstrun.didHandleCampaignAction";
-
- const TEST_CASES = [
- {
- title: "unsupported open_url campaign action",
- attributionData: {
- campaign: "open_url",
- },
- expected: null,
- after: () => {
- QueryCache.queries.UnhandledCampaignAction.expire();
- },
- },
- {
- title: "supported and unhandled set default browser campaign action",
- attributionData: {
- campaign: "set_default_browser",
- },
- expected: "SET_DEFAULT_BROWSER",
- after: () => {
- QueryCache.queries.UnhandledCampaignAction.expire();
- },
- },
- {
- title: "supported and handled set default browser campaign action",
- attributionData: {
- campaign: "set_default_browser",
- },
- expected: null,
- before: async () => {
- await pushPrefs([DID_HANDLE_CAMAPAIGN_ACTION_PREF, true]);
- },
- after: () => {
- Services.prefs.clearUserPref(DID_HANDLE_CAMAPAIGN_ACTION_PREF);
- QueryCache.queries.UnhandledCampaignAction.expire();
- },
- },
- ];
-
- const sandbox = sinon.createSandbox();
- registerCleanupFunction(async () => {
- sandbox.restore();
- });
-
- const stub = sandbox.stub(AttributionCode, "getCachedAttributionData");
-
- for (const {
- title,
- attributionData,
- expected,
- before,
- after,
- } of TEST_CASES) {
- if (before) {
- await before();
- }
- stub.returns(attributionData);
- is(
- ASRouterTargeting.Environment.unhandledCampaignAction,
- expected,
- `${title} - Expected unhandledCampaignAction to have the expected value`
- );
- if (after) {
- after();
- }
- }
-});