From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../aboutwelcome/actors/AboutWelcomeChild.sys.mjs | 28 +++++++++++++++++++++- .../aboutwelcome/actors/AboutWelcomeParent.sys.mjs | 6 +++-- 2 files changed, 31 insertions(+), 3 deletions(-) (limited to 'browser/components/aboutwelcome/actors') diff --git a/browser/components/aboutwelcome/actors/AboutWelcomeChild.sys.mjs b/browser/components/aboutwelcome/actors/AboutWelcomeChild.sys.mjs index 24bf73c80a..7c61c13a92 100644 --- a/browser/components/aboutwelcome/actors/AboutWelcomeChild.sys.mjs +++ b/browser/components/aboutwelcome/actors/AboutWelcomeChild.sys.mjs @@ -20,6 +20,15 @@ ChromeUtils.defineLazyGetter(lazy, "log", () => { return new Logger("AboutWelcomeChild"); }); +const DID_SEE_FINAL_SCREEN_PREF = "browser.aboutwelcome.didSeeFinalScreen"; + +XPCOMUtils.defineLazyPreferenceGetter( + lazy, + "toolbarEntrypoint", + "browser.aboutwelcome.entrypoint", + "" +); + export class AboutWelcomeChild extends JSWindowActorChild { // Can be used to avoid accesses to the document/contentWindow after it's // destroyed, which may throw unhandled exceptions. @@ -233,6 +242,9 @@ export class AboutWelcomeChild extends JSWindowActorChild { * @param {object} eventData */ AWSendEventTelemetry(eventData) { + if (lazy.toolbarEntrypoint) { + eventData.event_context.entrypoint = lazy.toolbarEntrypoint; + } this.AWSendToParent("TELEMETRY_EVENT", { ...eventData, event_context: { @@ -242,7 +254,7 @@ export class AboutWelcomeChild extends JSWindowActorChild { } /** - * Send message that can be handled by AboutWelcomeParent.jsm + * Send message that can be handled by AboutWelcomeParent.sys.mjs * * @param {string} type * @param {any=} data @@ -256,10 +268,24 @@ export class AboutWelcomeChild extends JSWindowActorChild { return this.wrapPromise(this.sendQuery("AWPage:WAIT_FOR_MIGRATION_CLOSE")); } + setDidSeeFinalScreen() { + this.AWSendToParent("SPECIAL_ACTION", { + type: "SET_PREF", + data: { + pref: { + name: DID_SEE_FINAL_SCREEN_PREF, + value: true, + }, + }, + }); + } + AWFinish() { const shouldFocusNewtabUrlBar = lazy.NimbusFeatures.aboutwelcome.getVariable("newtabUrlBarFocus"); + this.setDidSeeFinalScreen(); + this.contentWindow.location.href = "about:home"; if (shouldFocusNewtabUrlBar) { this.AWSendToParent("SPECIAL_ACTION", { diff --git a/browser/components/aboutwelcome/actors/AboutWelcomeParent.sys.mjs b/browser/components/aboutwelcome/actors/AboutWelcomeParent.sys.mjs index 1eb77da0d8..7b32161e3b 100644 --- a/browser/components/aboutwelcome/actors/AboutWelcomeParent.sys.mjs +++ b/browser/components/aboutwelcome/actors/AboutWelcomeParent.sys.mjs @@ -85,6 +85,8 @@ class AboutWelcomeObserver { stop() { lazy.log.debug(`Terminate reason is ${this.terminateReason}`); + // Clear the entrypoint pref + Services.prefs.clearUserPref("browser.aboutwelcome.entrypoint"); Services.obs.removeObserver(this, "quit-application"); if (!this.win) { return; @@ -132,7 +134,7 @@ export class AboutWelcomeParent extends JSWindowActorParent { } /** - * Handle messages from AboutWelcomeChild.jsm + * Handle messages from AboutWelcomeChild.sys.mjs * * @param {string} type * @param {any=} data @@ -273,7 +275,7 @@ export class AboutWelcomeParent extends JSWindowActorParent { export class AboutWelcomeShoppingParent extends AboutWelcomeParent { /** - * Handle messages from AboutWelcomeChild.jsm + * Handle messages from AboutWelcomeChild.sys.mjs * * @param {string} type * @param {any=} data -- cgit v1.2.3