tor-browser

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

commit 6a5b5a00d99b8e64cba930150906e0f4cc279032
parent 4873b3661d6c3ce38eb23078a05fa162a8e4aa57
Author: Serban Stanca <sstanca@mozilla.com>
Date:   Fri,  9 Jan 2026 03:14:39 +0200

Revert "Bug 2008872 - Create flag for sidebar vs fullpage UX in AI window r=Mardak,ai-frontend-reviewers" as requested by @ngrato for pushing wrong patch on the bug.

This reverts commit 4bcd0de36d96bcfb977505cb0c430e9eea58dc94.

Diffstat:
Mbrowser/components/aiwindow/ui/components/ai-window/ai-window.mjs | 16----------------
Mbrowser/components/aiwindow/ui/modules/AIWindow.sys.mjs | 2+-
Mbrowser/components/aiwindow/ui/modules/AIWindowUI.sys.mjs | 5+++--
Mbrowser/components/aiwindow/ui/test/browser/browser_open_aiwindow.js | 32--------------------------------
Mdom/security/DOMSecurityMonitor.cpp | 1-
5 files changed, 4 insertions(+), 52 deletions(-)

diff --git a/browser/components/aiwindow/ui/components/ai-window/ai-window.mjs b/browser/components/aiwindow/ui/components/ai-window/ai-window.mjs @@ -29,34 +29,23 @@ ChromeUtils.defineLazyGetter(lazy, "log", function () { }); }); -const FULLPAGE = "fullpage"; -const SIDEBAR = "sidebar"; - /** * A custom element for managing AI Window */ export class AIWindow extends MozLitElement { static properties = { userPrompt: { type: String }, - mode: { type: String }, // sidebar | fullpage }; #browser; #conversation; - #detectModeFromContext() { - return window.browsingContext?.embedderElement?.id === "ai-window-browser" - ? SIDEBAR - : FULLPAGE; - } - constructor() { super(); this.userPrompt = ""; this.#browser = null; this.#conversation = new lazy.ChatConversation({}); - this.mode = this.#detectModeFromContext(); } connectedCallback() { @@ -262,11 +251,6 @@ export class AIWindow extends MozLitElement { <moz-button type="primary" size="small" @click=${this.#handleSubmit}> Submit mock prompt </moz-button> - - <!-- TODO : Example of mode-based rendering --> - ${this.mode === FULLPAGE - ? html`<div>Fullpage Footer Content</div>` - : ""} </div> `; } diff --git a/browser/components/aiwindow/ui/modules/AIWindow.sys.mjs b/browser/components/aiwindow/ui/modules/AIWindow.sys.mjs @@ -5,7 +5,7 @@ */ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; -export const AIWINDOW_URL = "chrome://browser/content/aiwindow/aiWindow.html"; +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); diff --git a/browser/components/aiwindow/ui/modules/AIWindowUI.sys.mjs b/browser/components/aiwindow/ui/modules/AIWindowUI.sys.mjs @@ -4,7 +4,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -import { AIWINDOW_URL } from "moz-src:///browser/components/aiwindow/ui/modules/AIWindow.sys.mjs"; +const AIWINDOW_SIDEBAR_URL = + "chrome://browser/content/aiwindow/aiWindow.html#mode=sidebar"; export const AIWindowUI = { BOX_ID: "ai-window-box", @@ -59,7 +60,7 @@ export const AIWindowUI = { browser.setAttribute("disablehistory", "true"); browser.setAttribute("disablefullscreen", "true"); browser.setAttribute("tooltip", "aHTMLTooltip"); - browser.setAttribute("src", AIWINDOW_URL); + browser.setAttribute("src", AIWINDOW_SIDEBAR_URL); stack.appendChild(browser); return browser; }, diff --git a/browser/components/aiwindow/ui/test/browser/browser_open_aiwindow.js b/browser/components/aiwindow/ui/test/browser/browser_open_aiwindow.js @@ -190,38 +190,6 @@ add_task(async function test_openNewBrowserWindow_and_ai_inherit() { await SpecialPowers.popPrefEnv(); }); -/** - * Test AI window mode detection in aiWindow.html - */ -add_task(async function test_aiwindow_html_mode_detection() { - await SpecialPowers.pushPrefEnv({ - set: [["browser.aiwindow.enabled", true]], - }); - - // Open aiWindow.html directly - await BrowserTestUtils.withNewTab( - "chrome://browser/content/aiwindow/aiWindow.html", - async browser => { - await SpecialPowers.spawn(browser, [], async () => { - await content.customElements.whenDefined("ai-window"); - - const aiWindowElement = content.document.querySelector("ai-window"); - Assert.ok(aiWindowElement, "ai-window element should exist"); - - // Check that mode is detected (should be FULLPAGE when loaded directly) - info(`aiWindowElement.mode: ${aiWindowElement.mode}`); - Assert.strictEqual( - aiWindowElement.mode, - "fullpage", - `Mode should be detected as fullpage, got: ${aiWindowElement.mode}` - ); - }); - } - ); - - await SpecialPowers.popPrefEnv(); -}); - function checkMenuItemVisibility( aiWindowEnabled, aiOpenerButton, diff --git a/dom/security/DOMSecurityMonitor.cpp b/dom/security/DOMSecurityMonitor.cpp @@ -70,7 +70,6 @@ void DOMSecurityMonitor::AuditParsingOfHTMLXMLFragments( "resource://devtools/client/shared/widgets/Spectrum.js"_ns, "resource://gre/modules/narrate/VoiceSelect.sys.mjs"_ns, "chrome://global/content/vendor/react-dom.js"_ns, - "chrome://browser/content/aiwindow/aiwindow.html"_ns, // ------------------------------------------------------------------ // test pages // ------------------------------------------------------------------