commit aa721d24cfcbcb870249c636e1ff2284c6a6d4f9
parent 3b71b187df97540f5fce156888f7c97a23835870
Author: Henry Wilkes <henry@torproject.org>
Date: Mon, 4 Aug 2025 16:12:52 +0100
BB 43864: Modify the urlbar for Base Browser.
Diffstat:
2 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/browser/components/urlbar/QuickActionsLoaderDefault.sys.mjs b/browser/components/urlbar/QuickActionsLoaderDefault.sys.mjs
@@ -15,6 +15,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
ScreenshotsUtils: "resource:///modules/ScreenshotsUtils.sys.mjs",
TranslationsParent: "resource://gre/actors/TranslationsParent.sys.mjs",
UrlbarUtils: "moz-src:///browser/components/urlbar/UrlbarUtils.sys.mjs",
+ PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
});
ChromeUtils.defineLazyGetter(lazy, "logger", () =>
@@ -90,6 +91,9 @@ const DEFAULT_ACTIONS = {
icon: "chrome://mozapps/skin/extensions/category-extensions.svg",
label: "quickactions-addons",
onPick: openAddonsUrl("addons://discover/"),
+ // Hide in base-browser, since we don't want to open extensions
+ // "recommendations" tab. tor-browser#43864.
+ disabled: () => true,
},
bookmarks: {
l10nCommands: ["quickactions-cmd-bookmarks", "quickactions-bookmarks2"],
@@ -114,6 +118,12 @@ const DEFAULT_ACTIONS = {
.document.getElementById("Tools:Sanitize")
.doCommand();
},
+ // Disable in permanent private browsing. tor-browser#43864.
+ // NOTE: This should also be disabled in private windows, but we don't have
+ // access to a Window element to check. See mozilla bug 1980912.
+ disabled: () => {
+ return lazy.PrivateBrowsingUtils.permanentPrivateBrowsing;
+ },
},
downloads: {
l10nCommands: ["quickactions-cmd-downloads"],
@@ -126,13 +136,18 @@ const DEFAULT_ACTIONS = {
icon: "chrome://mozapps/skin/extensions/category-extensions.svg",
label: "quickactions-extensions",
onPick: openAddonsUrl("addons://list/extension"),
+ // Hide in base-browser since we do not want to encourage users to change
+ // their extensions/addons. tor-browser#43864.
+ disabled: () => true,
},
help: {
l10nCommands: ["quickactions-cmd-help"],
icon: "chrome://global/skin/icons/help.svg",
label: "quickactions-help",
+ // Open the base-browser support/help page, rather than Firefox's.
+ // tor-browser#43864.
onPick: openUrlFun(
- "https://support.mozilla.org/products/firefox?as=u&utm_source=inproduct"
+ Services.prefs.getStringPref("browser.base-browser-support-url", "")
),
},
firefoxview: {
@@ -144,6 +159,9 @@ const DEFAULT_ACTIONS = {
allowFromInactiveWorkspace: true,
}).FirefoxViewHandler.openTab();
},
+ // Hide in base-browser since firefoxview is disabled.
+ // tor-browser#43864 and tor-browser#42037.
+ disabled: () => true,
},
inspect: {
l10nCommands: ["quickactions-cmd-inspector2"],
@@ -170,6 +188,10 @@ const DEFAULT_ACTIONS = {
l10nCommands: ["quickactions-cmd-logins"],
label: "quickactions-logins2",
onPick: openUrlFun("about:logins"),
+ // Disabled in base browser since saved passwords is not well supported in
+ // Tor Browser, and should be disabled in Mullvad Browser.
+ // tor-browser#44177.
+ disabled: () => true,
},
print: {
l10nCommands: ["quickactions-cmd-print"],
@@ -197,6 +219,10 @@ const DEFAULT_ACTIONS = {
private: true,
});
},
+ // Disable in permanent private browsing. tor-browser#44177.
+ disabled: () => {
+ return lazy.PrivateBrowsingUtils.permanentPrivateBrowsing;
+ },
},
refresh: {
l10nCommands: ["quickactions-cmd-refresh"],
@@ -369,6 +395,9 @@ export class QuickActionsLoaderDefault {
let keys = Object.keys(DEFAULT_ACTIONS);
for (const key of keys) {
let actionData = DEFAULT_ACTIONS[key];
+ if (actionData.disabled?.()) {
+ continue;
+ }
let messages = await lazy.gFluentStrings.formatMessages(
actionData.l10nCommands.map(id => ({ id }))
);
diff --git a/browser/components/urlbar/SearchModeSwitcher.sys.mjs b/browser/components/urlbar/SearchModeSwitcher.sys.mjs
@@ -463,6 +463,15 @@ export class SearchModeSwitcher {
if (!lazy.UrlbarPrefs.get(pref)) {
continue;
}
+ if (
+ source === lazy.UrlbarUtils.RESULT_SOURCE.HISTORY &&
+ lazy.PrivateBrowsingUtils.permanentPrivateBrowsing
+ ) {
+ // Do not show the search history option in PBM. tor-browser#43864.
+ // Although, it can still be triggered with "^" restrict keyword or
+ // through an app menu item. See also mozilla bug 1980928.
+ continue;
+ }
let name = lazy.UrlbarUtils.getResultSourceName(source);
let { icon } = await this.#getDisplayedEngineDetails({
source,