From 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:33 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../components/asrouter/modules/ASRouter.sys.mjs | 22 +++++++++------------- .../asrouter/modules/ASRouterPreferences.sys.mjs | 2 +- .../asrouter/modules/ASRouterTargeting.sys.mjs | 2 +- .../modules/ASRouterTriggerListeners.sys.mjs | 8 ++++---- .../asrouter/modules/CFRPageActions.sys.mjs | 2 +- .../asrouter/modules/FeatureCalloutBroker.sys.mjs | 2 +- .../modules/MessagingExperimentConstants.sys.mjs | 4 ++++ .../modules/OnboardingMessageProvider.sys.mjs | 4 ++-- .../asrouter/modules/ToastNotification.sys.mjs | 2 +- .../asrouter/modules/ToolbarBadgeHub.sys.mjs | 2 +- 10 files changed, 25 insertions(+), 25 deletions(-) (limited to 'browser/components/asrouter/modules') diff --git a/browser/components/asrouter/modules/ASRouter.sys.mjs b/browser/components/asrouter/modules/ASRouter.sys.mjs index f6657a39b9..e46c57f685 100644 --- a/browser/components/asrouter/modules/ASRouter.sys.mjs +++ b/browser/components/asrouter/modules/ASRouter.sys.mjs @@ -106,18 +106,10 @@ const TOPIC_EXPERIMENT_ENROLLMENT_CHANGED = "nimbus:enrollments-updated"; const USE_REMOTE_L10N_PREF = "browser.newtabpage.activity-stream.asrouter.useRemoteL10n"; -// Experiment groups that need to report the reach event in Messaging-Experiments. -// If you're adding new groups to it, make sure they're also added in the -// `messaging_experiments.reach.objects` defined in "toolkit/components/telemetry/Events.yaml" -const REACH_EVENT_GROUPS = [ - "cfr", - "moments-page", - "infobar", - "spotlight", - "featureCallout", -]; const REACH_EVENT_CATEGORY = "messaging_experiments"; const REACH_EVENT_METHOD = "reach"; +// Reach for the pbNewtab feature will be added in bug 1755401 +const NO_REACH_EVENT_GROUPS = ["pbNewtab"]; export const MessageLoaderUtils = { STARTPAGE_VERSION, @@ -405,7 +397,11 @@ export const MessageLoaderUtils = { // Add Reach messages from unenrolled sibling branches, provided we are // recording Reach events for this feature. If we are in a rollout, we do // not have sibling branches. - if (!REACH_EVENT_GROUPS.includes(featureId) || !experimentData) { + if ( + NO_REACH_EVENT_GROUPS.includes(featureId) || + !MESSAGING_EXPERIMENTS_DEFAULT_FEATURES.includes(featureId) || + !experimentData + ) { continue; } @@ -947,7 +943,7 @@ export class _ASRouter { return this.state; } - async _onLocaleChanged(subject, topic, data) { + async _onLocaleChanged() { await this._maybeUpdateL10nAttachment(); } @@ -1743,7 +1739,7 @@ export class _ASRouter { } // Update storage this._storage.set("groupImpressions", newGroupImpressions); - return this.setState(({ groups }) => ({ + return this.setState(() => ({ groupImpressions: newGroupImpressions, })); } diff --git a/browser/components/asrouter/modules/ASRouterPreferences.sys.mjs b/browser/components/asrouter/modules/ASRouterPreferences.sys.mjs index c7617d80c0..e9a08fe259 100644 --- a/browser/components/asrouter/modules/ASRouterPreferences.sys.mjs +++ b/browser/components/asrouter/modules/ASRouterPreferences.sys.mjs @@ -9,7 +9,7 @@ const DEVTOOLS_PREF = /** * Use `ASRouterPreferences.console.debug()` and friends from ASRouter files to - * log messages during development. See LOG_LEVELS in ConsoleAPI.jsm for the + * log messages during development. See LOG_LEVELS in Console.sys.mjs for the * available methods as well as the available values for this pref. */ const DEBUG_PREF = "browser.newtabpage.activity-stream.asrouter.debugLogLevel"; diff --git a/browser/components/asrouter/modules/ASRouterTargeting.sys.mjs b/browser/components/asrouter/modules/ASRouterTargeting.sys.mjs index a262f8911e..d76b303fc6 100644 --- a/browser/components/asrouter/modules/ASRouterTargeting.sys.mjs +++ b/browser/components/asrouter/modules/ASRouterTargeting.sys.mjs @@ -576,7 +576,7 @@ const TargetingGetters = { lazy.fxAccounts .getSignedInUser() .then(data => resolve(!!data)) - .catch(e => resolve(false)); + .catch(() => resolve(false)); }); }, get sync() { diff --git a/browser/components/asrouter/modules/ASRouterTriggerListeners.sys.mjs b/browser/components/asrouter/modules/ASRouterTriggerListeners.sys.mjs index d8eaa3994d..fb4680085c 100644 --- a/browser/components/asrouter/modules/ASRouterTriggerListeners.sys.mjs +++ b/browser/components/asrouter/modules/ASRouterTriggerListeners.sys.mjs @@ -446,7 +446,7 @@ export const ASRouterTriggerListeners = new Map([ } }, - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { if (aSubject.currentURI.asciiHost === "accounts.firefox.com") { // Don't notify about saved logins on the FxA login origin since this // trigger is used to promote login Sync and getting a recommendation @@ -562,7 +562,7 @@ export const ASRouterTriggerListeners = new Map([ _sessionPageLoad: 0, onLocationChange: null, - init(triggerHandler, params, patterns) { + init(triggerHandler, params) { params.forEach(p => this._events.push(p)); if (!this._initialized) { @@ -610,7 +610,7 @@ export const ASRouterTriggerListeners = new Map([ this._sessionPageLoad = 0; }, - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { switch (aTopic) { case "SiteProtection:ContentBlockingEvent": const { browser, host, event } = aSubject.wrappedJSObject; @@ -690,7 +690,7 @@ export const ASRouterTriggerListeners = new Map([ this._triggerHandler = triggerHandler; }, - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { switch (aTopic) { case "captive-portal-login-success": const browser = Services.wm.getMostRecentBrowserWindow(); diff --git a/browser/components/asrouter/modules/CFRPageActions.sys.mjs b/browser/components/asrouter/modules/CFRPageActions.sys.mjs index cf7719d9eb..392173f754 100644 --- a/browser/components/asrouter/modules/CFRPageActions.sys.mjs +++ b/browser/components/asrouter/modules/CFRPageActions.sys.mjs @@ -792,7 +792,7 @@ export class PageAction { * Respond to a user click on the recommendation by showing a doorhanger/ * popup notification or running the action defined in the message */ - async _cfrUrlbarButtonClick(event) { + async _cfrUrlbarButtonClick() { const browser = this.window.gBrowser.selectedBrowser; if (!RecommendationMap.has(browser)) { // There's no recommendation for this browser, so the user shouldn't have diff --git a/browser/components/asrouter/modules/FeatureCalloutBroker.sys.mjs b/browser/components/asrouter/modules/FeatureCalloutBroker.sys.mjs index 7ede6c9bf8..3f5ed713f1 100644 --- a/browser/components/asrouter/modules/FeatureCalloutBroker.sys.mjs +++ b/browser/components/asrouter/modules/FeatureCalloutBroker.sys.mjs @@ -192,7 +192,7 @@ export class _FeatureCalloutBroker { return item; } - handleFeatureCalloutCallback(win, event, data) { + handleFeatureCalloutCallback(win, event) { switch (event) { case "end": const item = this.#calloutMap.get(win); diff --git a/browser/components/asrouter/modules/MessagingExperimentConstants.sys.mjs b/browser/components/asrouter/modules/MessagingExperimentConstants.sys.mjs index 5960ab92cc..5a07efb687 100644 --- a/browser/components/asrouter/modules/MessagingExperimentConstants.sys.mjs +++ b/browser/components/asrouter/modules/MessagingExperimentConstants.sys.mjs @@ -15,6 +15,10 @@ * FeatureManifest.yaml. Conversely, messaging experiment features contain * actual messages, with the usual message keys like `template` and `targeting`. * @see FeatureManifest.yaml + * Messages delivered through these feature IDs record reach events, with the + * exception of "pbNewtab". If you're adding new features to this list, make + * sure they're also added in the `messaging_experiments.reach.objects` defined + * in "toolkit/components/telemetry/Events.yaml" */ export const MESSAGING_EXPERIMENTS_DEFAULT_FEATURES = [ "cfr", diff --git a/browser/components/asrouter/modules/OnboardingMessageProvider.sys.mjs b/browser/components/asrouter/modules/OnboardingMessageProvider.sys.mjs index 6164e3e72a..ceded6b755 100644 --- a/browser/components/asrouter/modules/OnboardingMessageProvider.sys.mjs +++ b/browser/components/asrouter/modules/OnboardingMessageProvider.sys.mjs @@ -1129,7 +1129,7 @@ const BASE_MESSAGES = () => [ lifetime: 2, }, targeting: - "source == 'startup' && !isMajorUpgrade && !activeNotifications && !isDefaultBrowser && !willShowDefaultPrompt && (currentDate|date - profileAgeCreated|date) / 86400000 >= 28 && userPrefs.cfrFeatures == true", + "source == 'startup' && !isMajorUpgrade && !activeNotifications && !isDefaultBrowser && !willShowDefaultPrompt && 'browser.shell.checkDefaultBrowser'|preferenceValue && (currentDate|date - profileAgeCreated|date) / 86400000 >= 28 && userPrefs.cfrFeatures == true", trigger: { id: "defaultBrowserCheck", }, @@ -1205,7 +1205,7 @@ const BASE_MESSAGES = () => [ lifetime: 1, }, targeting: - "source == 'startup' && !isMajorUpgrade && !activeNotifications && !isDefaultBrowser && !willShowDefaultPrompt && (currentDate|date - profileAgeCreated|date) / 86400000 <= 28 && (currentDate|date - profileAgeCreated|date) / 86400000 >= 7 && userPrefs.cfrFeatures == true", + "source == 'startup' && !isMajorUpgrade && !activeNotifications && !isDefaultBrowser && !willShowDefaultPrompt && 'browser.shell.checkDefaultBrowser'|preferenceValue && (currentDate|date - profileAgeCreated|date) / 86400000 <= 28 && (currentDate|date - profileAgeCreated|date) / 86400000 >= 7 && userPrefs.cfrFeatures == true", trigger: { id: "defaultBrowserCheck", }, diff --git a/browser/components/asrouter/modules/ToastNotification.sys.mjs b/browser/components/asrouter/modules/ToastNotification.sys.mjs index 136225cf61..fa30002daa 100644 --- a/browser/components/asrouter/modules/ToastNotification.sys.mjs +++ b/browser/components/asrouter/modules/ToastNotification.sys.mjs @@ -123,7 +123,7 @@ export const ToastNotification = { } let shownPromise = Promise.withResolvers(); - let obs = (subject, topic, data) => { + let obs = (subject, topic) => { if (topic === "alertshow") { shownPromise.resolve(); } diff --git a/browser/components/asrouter/modules/ToolbarBadgeHub.sys.mjs b/browser/components/asrouter/modules/ToolbarBadgeHub.sys.mjs index 7832ae9456..57fd104f19 100644 --- a/browser/components/asrouter/modules/ToolbarBadgeHub.sys.mjs +++ b/browser/components/asrouter/modules/ToolbarBadgeHub.sys.mjs @@ -81,7 +81,7 @@ export class _ToolbarBadgeHub { win.MozXULElement.insertFTLIfNeeded("browser/newtab/asrouter.ftl"); } - executeAction({ id, data, message_id }) { + executeAction({ id }) { switch (id) { case "show-whatsnew-button": lazy.ToolbarPanelHub.enableToolbarButton(); -- cgit v1.2.3