summaryrefslogtreecommitdiffstats
path: root/browser/components/asrouter/modules
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
commit59203c63bb777a3bacec32fb8830fba33540e809 (patch)
tree58298e711c0ff0575818c30485b44a2f21bf28a0 /browser/components/asrouter/modules
parentAdding upstream version 126.0.1. (diff)
downloadfirefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz
firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/asrouter/modules')
-rw-r--r--browser/components/asrouter/modules/ASRouterTargeting.sys.mjs23
-rw-r--r--browser/components/asrouter/modules/CFRMessageProvider.sys.mjs68
-rw-r--r--browser/components/asrouter/modules/FeatureCallout.sys.mjs54
-rw-r--r--browser/components/asrouter/modules/FeatureCalloutMessages.sys.mjs6
-rw-r--r--browser/components/asrouter/modules/OnboardingMessageProvider.sys.mjs13
-rw-r--r--browser/components/asrouter/modules/PanelTestProvider.sys.mjs2
-rw-r--r--browser/components/asrouter/modules/RemoteL10n.sys.mjs1
7 files changed, 114 insertions, 53 deletions
diff --git a/browser/components/asrouter/modules/ASRouterTargeting.sys.mjs b/browser/components/asrouter/modules/ASRouterTargeting.sys.mjs
index 9773eda270..2761481ceb 100644
--- a/browser/components/asrouter/modules/ASRouterTargeting.sys.mjs
+++ b/browser/components/asrouter/modules/ASRouterTargeting.sys.mjs
@@ -45,7 +45,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
ClientEnvironment: "resource://normandy/lib/ClientEnvironment.sys.mjs",
CustomizableUI: "resource:///modules/CustomizableUI.sys.mjs",
HomePage: "resource:///modules/HomePage.sys.mjs",
- NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
ProfileAge: "resource://gre/modules/ProfileAge.sys.mjs",
Region: "resource://gre/modules/Region.sys.mjs",
TargetingContext: "resource://messaging-system/targeting/Targeting.sys.mjs",
@@ -847,6 +846,19 @@ const TargetingGetters = {
return lazy.WindowsLaunchOnLogin.getLaunchOnLoginEnabled();
},
+ get isMSIX() {
+ if (AppConstants.platform !== "win") {
+ return false;
+ }
+ // While we can write registry keys using external programs, we have no
+ // way of cleanup on uninstall. If we are on an MSIX build
+ // launch on login should never be enabled.
+ // Default to false so that the feature isn't unnecessarily
+ // disabled.
+ // See Bug 1888263.
+ return Services.sysinfo.getProperty("hasWinPackageId", false);
+ },
+
/**
* Is this invocation running in background task mode?
*
@@ -879,15 +891,6 @@ const TargetingGetters = {
},
/**
- * Whether or not the user is in the Major Release 2022 holdback study.
- */
- get inMr2022Holdback() {
- return (
- lazy.NimbusFeatures.majorRelease2022.getVariable("onboarding") === false
- );
- },
-
- /**
* The distribution id, if any.
* @return {string}
*/
diff --git a/browser/components/asrouter/modules/CFRMessageProvider.sys.mjs b/browser/components/asrouter/modules/CFRMessageProvider.sys.mjs
index e0aa49ad49..c80ae323ab 100644
--- a/browser/components/asrouter/modules/CFRMessageProvider.sys.mjs
+++ b/browser/components/asrouter/modules/CFRMessageProvider.sys.mjs
@@ -811,6 +811,74 @@ const CFR_MESSAGES = [
},
trigger: { id: "preferenceObserver", params: ["foo.bar"] },
},
+ {
+ id: "FACEBOOK_CONTAINER_ADDON_A",
+ template: "cfr_doorhanger",
+ groups: ["cfr"],
+ content: {
+ layout: "addon_recommendation",
+ category: "cfrAddons",
+ bucket_id: "CFR",
+ anchor_id: "PanelUI-menu-button",
+ skip_address_bar_notifier: true,
+ icon_class: "cfr-doorhanger-medium-icon",
+ notification_text: {
+ string_id: "cfr-doorhanger-extension-notification2",
+ },
+ heading_text: {
+ string_id: "cfr-doorhanger-extension-heading",
+ },
+ info_icon: {
+ label: {
+ string_id: "cfr-doorhanger-extension-sumo-link",
+ },
+ sumo_path: "extensionrecommendations",
+ },
+ addon: {
+ id: "954390",
+ title: "Facebook Container",
+ icon: "https://firefox-settings-attachments.cdn.mozilla.net/main-workspace/ms-images/03c866df-82ea-489c-83c7-df6d0662d893.svg",
+ rating: "4.5",
+ users: "1.1M",
+ author: "Mozilla",
+ amo_url: "https://addons.mozilla.org/firefox/addon/facebook-container/",
+ },
+ text: "Make it harder for Facebook to track your browsing activity, including info from medical and financial sites.",
+ buttons: {
+ primary: {
+ label: {
+ string_id: "firefoxview-cfr-primarybutton",
+ },
+ action: {
+ type: "INSTALL_ADDON_FROM_URL",
+ data: {
+ url: "https://example.com",
+ telemetrySource: "amo",
+ },
+ },
+ },
+ secondary: [
+ {
+ label: {
+ string_id: "firefoxview-cfr-secondarybutton",
+ },
+ action: {
+ type: "CANCEL",
+ },
+ },
+ ],
+ },
+ },
+ frequency: {
+ lifetime: 1,
+ },
+ targeting:
+ "!('@contain-facebook' in addonsInfo.addons|keys) && !('@testpilot-containers' in addonsInfo.addons|keys) && ('browser.discovery.enabled'|preferenceValue)",
+ trigger: {
+ id: "openURL",
+ params: ["www.facebook.com", "facebook.com"],
+ },
+ },
];
export const CFRMessageProvider = {
diff --git a/browser/components/asrouter/modules/FeatureCallout.sys.mjs b/browser/components/asrouter/modules/FeatureCallout.sys.mjs
index 5f0e266a4e..e8732b213d 100644
--- a/browser/components/asrouter/modules/FeatureCallout.sys.mjs
+++ b/browser/components/asrouter/modules/FeatureCallout.sys.mjs
@@ -462,6 +462,10 @@ export class FeatureCallout {
* the callout should be aligned with which point on the anchor element.
* @property {PopupAttachmentPoint} anchor_attachment
* @property {PopupAttachmentPoint} callout_attachment
+ * @property {String} [panel_position_string] The attachments joined into a
+ * string, e.g. "bottomleft topright". Passed to XULPopupElement::openPopup.
+ * This is not provided by JSON, but generated from anchor_attachment and
+ * callout_attachment.
* @property {Number} [offset_x] Offset in pixels to apply to the callout
* position in the horizontal direction.
* @property {Number} [offset_y] The same in the vertical direction.
@@ -514,8 +518,10 @@ export class FeatureCallout {
*/
/**
- * @typedef {Object} AnchorConfig
+ * @typedef {Object} Anchor
* @property {String} selector CSS selector for the anchor node.
+ * @property {Element} [element] The anchor node resolved from the selector.
+ * Not provided by JSON, but generated dynamically.
* @property {PanelPosition} [panel_position] Used to show the callout in a
* XUL panel. Only works in chrome documents, like the main browser window.
* @property {HTMLArrowPosition} [arrow_position] Used to show the callout in
@@ -533,27 +539,13 @@ export class FeatureCallout {
*/
/**
- * @typedef {Object} Anchor
- * @property {String} selector
- * @property {PanelPosition} [panel_position]
- * @property {HTMLArrowPosition} [arrow_position]
- * @property {PositionOverride} [absolute_position]
- * @property {Boolean} [hide_arrow]
- * @property {Boolean} [no_open_on_anchor]
- * @property {Number} [arrow_width]
- * @property {Element} element The anchor node resolved from the selector.
- * @property {String} [panel_position_string] The panel_position joined into a
- * string, e.g. "bottomleft topright". Passed to XULPopupElement::openPopup.
- */
-
- /**
* Return the first visible anchor element for the current screen. Screens can
* specify multiple anchors in an array, and the first one that is visible
* will be used. If none are visible, return null.
* @returns {Anchor|null}
*/
_getAnchor() {
- /** @type {AnchorConfig[]} */
+ /** @type {Anchor[]} */
const anchors = Array.isArray(this.currentScreen?.anchors)
? this.currentScreen.anchors
: [];
@@ -565,9 +557,9 @@ export class FeatureCallout {
continue;
}
const { selector, arrow_position, panel_position } = anchor;
- let panel_position_string;
if (panel_position) {
- panel_position_string = this._getPanelPositionString(panel_position);
+ let panel_position_string =
+ this._getPanelPositionString(panel_position);
// if the positionString doesn't match the format we expect, don't
// render the callout.
if (!panel_position_string && !arrow_position) {
@@ -580,6 +572,7 @@ export class FeatureCallout {
);
continue;
}
+ panel_position.panel_position_string = panel_position_string;
}
if (
arrow_position &&
@@ -637,7 +630,7 @@ export class FeatureCallout {
continue;
}
}
- return { ...anchor, panel_position_string, element };
+ return { ...anchor, element };
}
return null;
}
@@ -752,13 +745,10 @@ export class FeatureCallout {
}
const { autohide, padding } = this.currentScreen.content;
- const {
- panel_position_string,
- hide_arrow,
- no_open_on_anchor,
- arrow_width,
- } = anchor;
- const needsPanel = "MozXULElement" in this.win && !!panel_position_string;
+ const { panel_position, hide_arrow, no_open_on_anchor, arrow_width } =
+ anchor;
+ const needsPanel =
+ "MozXULElement" in this.win && !!panel_position?.panel_position_string;
if (this._container) {
if (needsPanel ^ (this._container?.localName === "panel")) {
@@ -775,7 +765,7 @@ export class FeatureCallout {
noautofocus="true"
flip="slide"
type="arrow"
- position="${panel_position_string}"
+ position="${panel_position.panel_position_string}"
${hide_arrow ? "" : 'show-arrow=""'}
${autohide ? "" : 'noautohide="true"'}
${no_open_on_anchor ? 'no-open-on-anchor=""' : ""}
@@ -1742,17 +1732,21 @@ export class FeatureCallout {
});
} else if (this._container.localName === "panel") {
const anchor = this._getAnchor();
- if (!anchor) {
+ if (!anchor?.panel_position) {
this.endTour();
return;
}
- const position = anchor.panel_position_string;
+ const {
+ panel_position_string: position,
+ offset_x: x,
+ offset_y: y,
+ } = anchor.panel_position;
this._container.addEventListener("popupshown", onRender, {
once: true,
});
this._container.addEventListener("popuphiding", this);
this._addPanelConflictListeners();
- this._container.openPopup(anchor.element, { position });
+ this._container.openPopup(anchor.element, { position, x, y });
}
}
});
diff --git a/browser/components/asrouter/modules/FeatureCalloutMessages.sys.mjs b/browser/components/asrouter/modules/FeatureCalloutMessages.sys.mjs
index 38c9a8d848..4fda4355bf 100644
--- a/browser/components/asrouter/modules/FeatureCalloutMessages.sys.mjs
+++ b/browser/components/asrouter/modules/FeatureCalloutMessages.sys.mjs
@@ -157,7 +157,7 @@ const MESSAGES = () => {
// Add the highest possible cap to ensure impressions are recorded while allowing the Spotlight to sync across windows/tabs with Firefox View open
lifetime: 100,
},
- targeting: `!inMr2022Holdback && source == "about:firefoxview" &&
+ targeting: `source == "about:firefoxview" &&
!'browser.newtabpage.activity-stream.asrouter.providers.cfr'|preferenceIsUserSet &&
'browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features'|preferenceValue &&
${matchCurrentScreenTargeting(
@@ -303,7 +303,7 @@ const MESSAGES = () => {
],
},
priority: 3,
- targeting: `!inMr2022Holdback && source == "about:firefoxview" && ${matchCurrentScreenTargeting(
+ targeting: `source == "about:firefoxview" && ${matchCurrentScreenTargeting(
FIREFOX_VIEW_PREF,
"FEATURE_CALLOUT_[0-9]"
)} && ${matchIncompleteTargeting(FIREFOX_VIEW_PREF)}`,
@@ -376,7 +376,7 @@ const MESSAGES = () => {
],
},
priority: 2,
- targeting: `!inMr2022Holdback && source == "about:firefoxview" && "browser.firefox-view.view-count" | preferenceValue > 2
+ targeting: `source == "about:firefoxview" && "browser.firefox-view.view-count" | preferenceValue > 2
&& (("identity.fxaccounts.enabled" | preferenceValue == false) || !(("services.sync.engine.tabs" | preferenceValue == true) && ("services.sync.username" | preferenceValue))) && (!messageImpressions.FIREFOX_VIEW_SPOTLIGHT[messageImpressions.FIREFOX_VIEW_SPOTLIGHT | length - 1] || messageImpressions.FIREFOX_VIEW_SPOTLIGHT[messageImpressions.FIREFOX_VIEW_SPOTLIGHT | length - 1] < currentDate|date - ${ONE_DAY_IN_MS})`,
frequency: {
lifetime: 1,
diff --git a/browser/components/asrouter/modules/OnboardingMessageProvider.sys.mjs b/browser/components/asrouter/modules/OnboardingMessageProvider.sys.mjs
index 3cfbbb3f34..298599e42b 100644
--- a/browser/components/asrouter/modules/OnboardingMessageProvider.sys.mjs
+++ b/browser/components/asrouter/modules/OnboardingMessageProvider.sys.mjs
@@ -24,7 +24,6 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
- NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
ShellService: "resource:///modules/ShellService.sys.mjs",
});
@@ -52,7 +51,6 @@ const L10N = new Localization([
"branding/brand.ftl",
"browser/newtab/onboarding.ftl",
"toolkit/branding/brandings.ftl",
- "toolkit/branding/accounts.ftl",
]);
const HOMEPAGE_PREF = "browser.startup.homepage";
@@ -872,7 +870,7 @@ const BASE_MESSAGES = () => [
],
lifetime: 12,
},
- targeting: "!inMr2022Holdback && doesAppNeedPrivatePin",
+ targeting: "doesAppNeedPrivatePin",
},
{
id: "PB_NEWTAB_COOKIE_BANNERS_PROMO",
@@ -988,7 +986,7 @@ const BASE_MESSAGES = () => [
targeting: `source == 'newtab'
&& 'browser.startup.windowsLaunchOnLogin.disableLaunchOnLoginPrompt'|preferenceValue == false
&& 'browser.startup.windowsLaunchOnLogin.enabled'|preferenceValue == true && isDefaultBrowser && !activeNotifications
- && !launchOnLoginEnabled`,
+ && !launchOnLoginEnabled && !isMSIX`,
},
{
id: "INFOBAR_LAUNCH_ON_LOGIN_FINAL",
@@ -1056,7 +1054,7 @@ const BASE_MESSAGES = () => [
&& messageImpressions.INFOBAR_LAUNCH_ON_LOGIN[messageImpressions.INFOBAR_LAUNCH_ON_LOGIN | length - 1]
&& messageImpressions.INFOBAR_LAUNCH_ON_LOGIN[messageImpressions.INFOBAR_LAUNCH_ON_LOGIN | length - 1] <
currentDate|date - ${FOURTEEN_DAYS_IN_MS}
- && !launchOnLoginEnabled`,
+ && !launchOnLoginEnabled && !isMSIX`,
},
{
id: "FOX_DOODLE_SET_DEFAULT",
@@ -1375,9 +1373,8 @@ export const OnboardingMessageProvider = {
return checkDefault && !isDefault;
},
_shouldShowPrivacySegmentationScreen() {
- // Fall back to pref: browser.privacySegmentation.preferences.show
- return lazy.NimbusFeatures.majorRelease2022.getVariable(
- "feltPrivacyShowPreferencesSection"
+ return Services.prefs.getBoolPref(
+ "browser.privacySegmentation.preferences.show"
);
},
_doesHomepageNeedReset() {
diff --git a/browser/components/asrouter/modules/PanelTestProvider.sys.mjs b/browser/components/asrouter/modules/PanelTestProvider.sys.mjs
index 5180e2e6a2..8dbb718bfd 100644
--- a/browser/components/asrouter/modules/PanelTestProvider.sys.mjs
+++ b/browser/components/asrouter/modules/PanelTestProvider.sys.mjs
@@ -37,7 +37,7 @@ const MESSAGES = () => [
},
sumo_path: "https://example.com",
},
- text: { string_id: "cfr-doorhanger-bookmark-fxa-body" },
+ text: { string_id: "cfr-doorhanger-bookmark-fxa-body-2" },
icon: "chrome://branding/content/icon64.png",
icon_class: "cfr-doorhanger-large-icon",
persistent_doorhanger: true,
diff --git a/browser/components/asrouter/modules/RemoteL10n.sys.mjs b/browser/components/asrouter/modules/RemoteL10n.sys.mjs
index 1df10fbd72..4135d77191 100644
--- a/browser/components/asrouter/modules/RemoteL10n.sys.mjs
+++ b/browser/components/asrouter/modules/RemoteL10n.sys.mjs
@@ -204,7 +204,6 @@ export class _RemoteL10n {
"branding/brand.ftl",
"browser/defaultBrowserNotification.ftl",
"browser/newtab/asrouter.ftl",
- "toolkit/branding/accounts.ftl",
"toolkit/branding/brandings.ftl",
],
false