commit 1aeb89553ad9edbe5e46d809a1a8817d205e2995 parent 68c8ca5d3bf3a07f7bab6da1a1ee3c53e70da27f Author: Chloe Zhou <chloezhouny@gmail.com> Date: Thu, 8 Jan 2026 21:39:16 +0000 Bug 2008654 - Enable transparency for firstrun.html in AI Window r=ai-frontend-reviewers,Gijs Differential Revision: https://phabricator.services.mozilla.com/D277965 Diffstat:
5 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/browser/base/content/test/static/browser_all_files_referenced.js b/browser/base/content/test/static/browser_all_files_referenced.js @@ -332,10 +332,6 @@ var allowlist = [ { file: "moz-src:///browser/components/aiwindow/models/IntentClassifier.sys.mjs", }, - // Bug 2004888 - [FirstRun] Create Firstrun.html opening firstrun welcome screen - { - file: "chrome://browser/content/aiwindow/firstrun.html", - }, // Bug 2005768 - Insights scheduler for generation from history // Bug 2007939 - Rename "insights" to "memories" { diff --git a/browser/components/aiwindow/ui/content/firstrun.js b/browser/components/aiwindow/ui/content/firstrun.js @@ -202,6 +202,14 @@ function renderFirstRun() { window.location.href = lazy.AIWindow.newTabURL; }; + window.addEventListener( + "unload", + () => { + AWParent.didDestroy(); + }, + { once: true } + ); + const script = document.createElement("script"); script.src = "chrome://browser/content/aboutwelcome/aboutwelcome.bundle.js"; document.body.appendChild(script); diff --git a/browser/components/aiwindow/ui/modules/AIWindow.sys.mjs b/browser/components/aiwindow/ui/modules/AIWindow.sys.mjs @@ -7,6 +7,8 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const AIWINDOW_URL = "chrome://browser/content/aiwindow/aiWindow.html"; const AIWINDOW_URI = Services.io.newURI(AIWINDOW_URL); +const FIRSTRUN_URL = "chrome://browser/content/aiwindow/firstrun.html"; +const FIRSTRUN_URI = Services.io.newURI(FIRSTRUN_URL); const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { @@ -229,7 +231,9 @@ export const AIWindow = { * @returns {boolean} whether AI Window content page is active */ isAIWindowContentPage(uri) { - return AIWINDOW_URI.equalsExceptRef(uri); + return ( + AIWINDOW_URI.equalsExceptRef(uri) || FIRSTRUN_URI.equalsExceptRef(uri) + ); }, /** diff --git a/browser/components/aiwindow/ui/test/browser/browser.toml b/browser/components/aiwindow/ui/test/browser/browser.toml @@ -1,4 +1,5 @@ [DEFAULT] +prefs = ["browser.newtab.preload=false"] support-files = [ "head.js", "test_chat_search_button.html", diff --git a/browser/components/aiwindow/ui/test/browser/browser_aiwindow_transparency.js b/browser/components/aiwindow/ui/test/browser/browser_aiwindow_transparency.js @@ -3,6 +3,8 @@ "use strict"; +const FIRSTRUN_URL = "chrome://browser/content/aiwindow/firstrun.html"; + /** * Checks if browser has transparent attribute * @@ -68,6 +70,27 @@ add_task(async function test_transparency_on_new_tab() { gAIWindow.gBrowser.removeTab(newTab); }); +add_task(async function test_transparency_on_firstrun_page() { + const newTab = await BrowserTestUtils.openNewForegroundTab( + gAIWindow.gBrowser, + FIRSTRUN_URL + ); + const newBrowser = gAIWindow.gBrowser.getBrowserForTab(newTab); + + Assert.ok( + isBrowserTransparent(newBrowser), + "Browser should be transparent on new firstrun page" + ); + + Assert.equal( + newBrowser.currentURI.spec, + FIRSTRUN_URL, + "New tab should be on firstrun URL" + ); + + gAIWindow.gBrowser.removeTab(newTab); +}); + add_task(async function test_transparency_removed_on_navigation() { gReusableTab = await BrowserTestUtils.openNewForegroundTab( gAIWindow.gBrowser,