tor-browser

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

commit 5d0d15f127cf986001b3336b826ba5765ea0ed58
parent 17e020a269a7f04a8616cfc8b0245f3750348665
Author: Nick Grato <ngrato@gmail.com>
Date:   Mon, 24 Nov 2025 20:07:12 +0000

Bug 2000885 - create an ai window singleton registered with BrowserComponents.manifest r=ai-frontend-reviewers,pdahiya

instead of https://github.com/Firefox-AI/firefox-prototypes/blob/smart-window/browser/base/content/browser-smart-window.js loaded to every browser window, we can have a singleton manage per-window state and provide helpers like if the feature is enabled bug 2000882 likely also checking browser.ml.enable as a global disable

here's an example of LinkPreview initializing for each window https://searchfox.org/firefox-main/search?q=LinkPreview.init

just a basic skeleton module to start is fine

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

Diffstat:
Mbrowser/components/BrowserComponents.manifest | 1+
Abrowser/components/aiwindow/ui/modules/AIWindow.sys.mjs | 37+++++++++++++++++++++++++++++++++++++
Mbrowser/components/aiwindow/ui/moz.build | 4++++
3 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/browser/components/BrowserComponents.manifest b/browser/components/BrowserComponents.manifest @@ -29,6 +29,7 @@ category browser-window-domcontentloaded moz-src:///browser/components/customiza category browser-window-delayed-startup moz-src:///browser/components/contentanalysis/content/ContentAnalysis.sys.mjs ContentAnalysis.initialize category browser-window-delayed-startup resource:///modules/HomePage.sys.mjs HomePage.delayedStartup category browser-window-delayed-startup moz-src:///browser/components/genai/LinkPreview.sys.mjs LinkPreview.init +category browser-window-delayed-startup moz-src:///browser/components/aiwindow/ui/modules/AIWindow.sys.mjs AIWindow.init category browser-window-delayed-startup moz-src:///browser/components/reportbrokensite/ReportBrokenSite.sys.mjs ReportBrokenSite.init category browser-window-delayed-startup moz-src:///browser/components/search/SearchUIUtils.sys.mjs SearchUIUtils.init category browser-window-delayed-startup resource:///modules/taskbartabs/TaskbarTabsPageAction.sys.mjs TaskbarTabsPageAction.init diff --git a/browser/components/aiwindow/ui/modules/AIWindow.sys.mjs b/browser/components/aiwindow/ui/modules/AIWindow.sys.mjs @@ -0,0 +1,37 @@ +/** + * 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/. + */ + +/** + * AI Window Service + */ + +export const AIWindow = { + _initialized: false, + _windowStates: new Map(), + + /** + * Handles startup tasks + */ + + init(win) { + if (this._initialized) { + return; + } + this._initialized = true; + this._windowStates.set(win, {}); + }, + + /** + * Is AI Window enabled + * + * @returns {boolean} whether AI Window is enabled + */ + + isAIWindowEnabled() { + // TODO - Placeholder for actual implementation + return true; + }, +}; diff --git a/browser/components/aiwindow/ui/moz.build b/browser/components/aiwindow/ui/moz.build @@ -4,3 +4,7 @@ with Files("**"): BUG_COMPONENT = ("Core", "Machine Learning: Frontend") + +MOZ_SRC_FILES += [ + "modules/AIWindow.sys.mjs", +]