tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit c07b2c3e73bd72d57b991d8acb6d6d743cedd7ee
parent 62ef1c5e829cd259fa8b5bcdffbd64986c12dcba
Author: Chloe Zhou <chloezhouny@gmail.com>
Date:   Thu, 11 Dec 2025 17:30:18 +0000

Bug 2004888 - Create Firstrun.html opening firstrun welcome screen r=pdahiya,fluent-reviewers,ai-frontend-reviewers,flod

Differential Revision: https://phabricator.services.mozilla.com/D275578

Diffstat:
Mbrowser/base/content/test/static/browser_all_files_referenced.js | 12++++++++++++
Abrowser/components/aiwindow/ui/content/firstrun.css | 42++++++++++++++++++++++++++++++++++++++++++
Abrowser/components/aiwindow/ui/content/firstrun.html | 42++++++++++++++++++++++++++++++++++++++++++
Abrowser/components/aiwindow/ui/content/firstrun.js | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mbrowser/components/aiwindow/ui/jar.mn | 3+++
Mbrowser/components/aiwindow/ui/test/browser/browser.toml | 2++
Abrowser/components/aiwindow/ui/test/browser/browser_aiwindow_firstrun.js | 36++++++++++++++++++++++++++++++++++++
Mbrowser/locales-preview/aiWindow.ftl | 4++++
8 files changed, 206 insertions(+), 0 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 @@ -331,6 +331,10 @@ var allowlist = [ { file: "resource://app/modules/backup/CookiesBackupResource.sys.mjs", }, + // Bug 2000725 importer lands (backed out due to unused file) + { + file: "moz-src:///browser/components/aiwindow/models/InsightsHistorySource.sys.mjs", + }, // Bug 2000945 - Move query intent detection to AI-window r?mardak (backed out due to unused file) { file: "moz-src:///browser/components/aiwindow/models/IntentClassifier.sys.mjs", @@ -348,6 +352,10 @@ var allowlist = [ { file: "moz-src:///browser/components/aiwindow/models/Utils.sys.mjs", }, + // Bug 2002906 - Add insights storage + { + file: "moz-src:///browser/components/aiwindow/services/InsightStore.sys.mjs", + }, // Bug 2003623 - Add assistant system prompt { file: "moz-src:///browser/components/aiwindow/models/prompts/AssistantPrompts.sys.mjs", @@ -360,6 +368,10 @@ var allowlist = [ { file: "moz-src:///browser/components/aiwindow/models/InsightsManager.sys.mjs", }, + // Bug 2004888 - [FirstRun] Create Firstrun.html opening firstrun welcome screen + { file: "chrome://browser/content/aiwindow/ui/content/firstrun.html" }, + { file: "chrome://browser/content/aiwindow/ui/content/firstrun.css" }, + { file: "chrome://browser/content/aiwindow/ui/content/firstrun.js" }, ]; if (AppConstants.NIGHTLY_BUILD) { diff --git a/browser/components/aiwindow/ui/content/firstrun.css b/browser/components/aiwindow/ui/content/firstrun.css @@ -0,0 +1,42 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +@keyframes springUp { + from { + opacity: 0; + transform: translateY(40px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +#multi-stage-message-root { + #mainContentHeader { + opacity: 0; + animation: springUp 0.5s ease-out forwards; + animation-delay: 0.3s; + background: linear-gradient(91deg, #7630c0 22.04%, #5c66ee 78.7%); + -webkit-background-clip: text; + background-clip: text; + -webkit-text-fill-color: transparent; + } + + .main-content, + .section-main, + .screen, + .dialog-initial, + .onboardingContainer { + box-shadow: none; + } + + .onboardingContainer .screen[pos="center"] { + background-color: transparent; + } + + button.primary { + display: none; + } +} diff --git a/browser/components/aiwindow/ui/content/firstrun.html b/browser/components/aiwindow/ui/content/firstrun.html @@ -0,0 +1,42 @@ +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this file, + - You can obtain one at http://mozilla.org/MPL/2.0/. --> + +<!doctype html> +<html> + <head> + <meta charset="utf-8" /> + <meta name="color-scheme" content="light dark" /> + <meta + http-equiv="Content-Security-Policy" + content="default-src 'none'; object-src 'none'; script-src resource: chrome:; img-src https: data: blob: chrome:; style-src resource: chrome:;" + /> + <title data-l10n-id="aiwindow-firstrun-title"></title> + <link + rel="icon" + type="image/png" + href="chrome://branding/content/icon32.png" + /> + <link rel="stylesheet" href="chrome://global/skin/in-content/common.css" /> + <link + rel="stylesheet" + href="chrome://browser/content/aboutwelcome/aboutwelcome.css" + /> + <link + rel="stylesheet" + href="chrome://browser/content/aiwindow/ui/content/firstrun.css" + /> + <link rel="localization" href="preview/aiWindow.ftl" /> + </head> + <body> + <div + id="multi-stage-message-root" + class="welcome-container" + role="presentation" + ></div> + <script src="chrome://global/content/vendor/react.js"></script> + <script src="chrome://global/content/vendor/react-dom.js"></script> + <script src="chrome://browser/content/contentTheme.js"></script> + <script src="chrome://browser/content/aiwindow/ui/content/firstrun.js"></script> + </body> +</html> diff --git a/browser/components/aiwindow/ui/content/firstrun.js b/browser/components/aiwindow/ui/content/firstrun.js @@ -0,0 +1,65 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const SMART_ASSIST_URL = "chrome://browser/content/genai/smartAssist.html"; + +const AI_WINDOW_CONFIG = { + id: "AI_WINDOW_WELCOME", + template: "spotlight", + transitions: true, + modal: "tab", + backdrop: + "radial-gradient(circle at 50% 90%, rgba(253, 244, 243, 1) 0%, rgba(253, 244, 243, 1) 30%, rgba(216, 202, 247, 1) 100%)", + screens: [ + { + id: "AW_AI_WINDOW_WELCOME", + auto_advance: "primary_button", + content: { + fullscreen: true, + hide_secondary_section: "responsive", + position: "center", + paddingBottom: "0px", + background: "transparent", + screen_style: { + overflow: "hidden", + }, + title: { + fontWeight: 400, + fontSize: "39px", + lineHeight: "56px", + textAlign: "center", + string_id: "aiwindow-firstrun-title", + color: "transparent", + letterSpacing: "0px", + }, + primary_button: { + label: "", + action: { + navigate: true, + }, + }, + }, + }, + ], +}; + +function renderFirstRun() { + window.AWGetFeatureConfig = () => AI_WINDOW_CONFIG; + window.AWEvaluateScreenTargeting = screens => screens; + window.AWGetSelectedTheme = () => ({}); + window.AWGetInstalledAddons = () => []; + window.AWFinish = () => { + window.location.href = SMART_ASSIST_URL; + }; + + const script = document.createElement("script"); + script.src = "chrome://browser/content/aboutwelcome/aboutwelcome.bundle.js"; + document.body.appendChild(script); +} + +if (document.readyState === "loading") { + document.addEventListener("DOMContentLoaded", renderFirstRun, { once: true }); +} else { + renderFirstRun(); +} diff --git a/browser/components/aiwindow/ui/jar.mn b/browser/components/aiwindow/ui/jar.mn @@ -11,3 +11,6 @@ browser.jar: content/browser/aiwindow/components/ai-window.css (components/ai-window/ai-window.css) content/browser/aiwindow/components/input-cta.css (components/input-cta/input-cta.css) content/browser/aiwindow/components/input-cta.mjs (components/input-cta/input-cta.mjs) + content/browser/aiwindow/ui/content/firstrun.html (content/firstrun.html) + content/browser/aiwindow/ui/content/firstrun.css (content/firstrun.css) + content/browser/aiwindow/ui/content/firstrun.js (content/firstrun.js) diff --git a/browser/components/aiwindow/ui/test/browser/browser.toml b/browser/components/aiwindow/ui/test/browser/browser.toml @@ -2,4 +2,6 @@ ["browser_aichat_content_actors.js"] +["browser_aiwindow_firstrun.js"] + ["browser_open_aiwindow.js"] diff --git a/browser/components/aiwindow/ui/test/browser/browser_aiwindow_firstrun.js b/browser/components/aiwindow/ui/test/browser/browser_aiwindow_firstrun.js @@ -0,0 +1,36 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const FIRSTRUN_URL = + "chrome://browser/content/aiwindow/ui/content/firstrun.html"; + +async function openFirstrunPage() { + const tab = await BrowserTestUtils.openNewForegroundTab( + gBrowser, + FIRSTRUN_URL + ); + return tab; +} + +add_task(async function test_firstrun_welcome_screen_renders() { + const tab = await openFirstrunPage(); + + await SpecialPowers.spawn(tab.linkedBrowser, [], async () => { + await ContentTaskUtils.waitForCondition( + () => content.document.querySelector(".screen.AW_AI_WINDOW_WELCOME"), + "Wait for the AI Window welcome screen to be rendered" + ); + + const welcomeScreen = content.document.querySelector( + ".screen.AW_AI_WINDOW_WELCOME" + ); + Assert.ok( + welcomeScreen, + "The welcome screen with class 'screen AW_AI_WINDOW_WELCOME' should be present" + ); + }); + + BrowserTestUtils.removeTab(tab); +}); diff --git a/browser/locales-preview/aiWindow.ftl b/browser/locales-preview/aiWindow.ftl @@ -21,3 +21,7 @@ menu-file-new-classic-window = aiwindow-input-cta-label-chat = Chat aiwindow-input-cta-label-search = Search aiwindow-input-cta-label-navigate = Navigate + +## Firstrun onboarding + +aiwindow-firstrun-title = Welcome to Smart Window