commit d0f3e2803ff78131b16a42d3b6edd6856a26ec04
parent cab2fcca42615a29c1504c065b7721d337b5d67b
Author: Henry Wilkes <henry@torproject.org>
Date: Fri, 3 Feb 2023 16:57:17 +0000
BB 31575: Disable Firefox Home (Activity Stream)
Treat about:blank as the default home page and new tab page.
BB 43886: Disable the newtab component/addon.
Bug 41624: Disable about:pocket-* pages.
Bug 40144: Redirect about:privatebrowsing to the user's home
Diffstat:
14 files changed, 39 insertions(+), 107 deletions(-)
diff --git a/browser/actors/moz.build b/browser/actors/moz.build
@@ -32,8 +32,7 @@ with Files("WebRTCChild.sys.mjs"):
BUG_COMPONENT = ("Firefox", "Site Permissions")
FINAL_TARGET_FILES.actors += [
- "AboutNewTabChild.sys.mjs",
- "AboutNewTabParent.sys.mjs",
+ # Remove newtab actors. tor-browser#43886.
"AboutPrivateBrowsingChild.sys.mjs",
"AboutPrivateBrowsingParent.sys.mjs",
"AboutProtectionsChild.sys.mjs",
diff --git a/browser/components/BrowserComponents.manifest b/browser/components/BrowserComponents.manifest
@@ -18,7 +18,7 @@ category browser-before-ui-startup resource:///modules/BuiltInThemes.sys.mjs Bui
category browser-before-ui-startup resource://normandy/Normandy.sys.mjs Normandy.init
#endif
category browser-before-ui-startup moz-src:///browser/components/privatebrowsing/ResetPBMPanel.sys.mjs ResetPBMPanel.init
-category browser-before-ui-startup resource:///modules/AboutHomeStartupCache.sys.mjs AboutHomeStartupCache.init
+# newtab component is disabled. tor-browser#43886
category browser-before-ui-startup resource:///modules/AccountsGlue.sys.mjs AccountsGlue.init
category browser-before-ui-startup moz-src:///browser/modules/ObserverForwarder.sys.mjs ObserverForwarder.init
category browser-before-ui-startup moz-src:///browser/components/ipprotection/IPProtectionService.sys.mjs IPProtectionService.maybeEarlyInit
@@ -41,7 +41,6 @@ category browser-window-unload moz-src:///browser/components/tabbrowser/NewTabPa
# App startup consumers
-category browser-first-window-ready resource:///modules/AboutNewTab.sys.mjs AboutNewTab.init
category browser-first-window-ready resource:///modules/ContentCrashHandlers.sys.mjs TabCrashHandler.init
category browser-first-window-ready resource:///modules/ProcessHangMonitor.sys.mjs ProcessHangMonitor.init
category browser-first-window-ready resource://gre/modules/PageThumbs.sys.mjs PageThumbs.init
@@ -99,7 +98,6 @@ category browser-quit-application-granted resource://gre/modules/NewTabUtils.sys
category browser-quit-application-granted resource://normandy/Normandy.sys.mjs Normandy.uninit
#endif
category browser-quit-application-granted resource://gre/modules/RFPHelper.sys.mjs RFPHelper.uninit
-category browser-quit-application-granted resource:///modules/asrouter/ASRouterNewTabHook.sys.mjs ASRouterNewTabHook.destroy
category browser-quit-application-granted moz-src:///browser/components/search/SERPCategorization.sys.mjs SERPCategorization.uninit
category browser-quit-application-granted moz-src:///browser/components/search/SearchSERPTelemetry.sys.mjs SearchSERPTelemetry.uninit
#ifdef MOZ_UPDATER
@@ -108,6 +106,4 @@ category browser-quit-application-granted resource://gre/modules/UpdateListener.
category browser-quit-application-granted moz-src:///browser/components/urlbar/UrlbarSearchTermsPersistence.sys.mjs UrlbarSearchTermsPersistence.uninit
category browser-quit-application-granted moz-src:///browser/components/ipprotection/IPProtectionService.sys.mjs IPProtectionService.uninit
-category search-service-notification moz-src:///browser/components/search/SearchUIUtils.sys.mjs SearchUIUtils.showSearchServiceNotification
-
category browser-newtab-external-component moz-src:///browser/components/search/SearchUIUtils.sys.mjs SearchNewTabComponentsRegistrant
diff --git a/browser/components/BrowserGlue.sys.mjs b/browser/components/BrowserGlue.sys.mjs
@@ -8,12 +8,9 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
- AboutHomeStartupCache: "resource:///modules/AboutHomeStartupCache.sys.mjs",
+ // newtab component is disabled. tor-browser#43886
AWToolbarButton: "resource:///modules/aboutwelcome/AWToolbarUtils.sys.mjs",
ASRouter: "resource:///modules/asrouter/ASRouter.sys.mjs",
- ASRouterDefaultConfig:
- "resource:///modules/asrouter/ASRouterDefaultConfig.sys.mjs",
- ASRouterNewTabHook: "resource:///modules/asrouter/ASRouterNewTabHook.sys.mjs",
AddonManager: "resource://gre/modules/AddonManager.sys.mjs",
BackupService: "resource:///modules/backup/BackupService.sys.mjs",
BrowserSearchTelemetry:
@@ -356,10 +353,7 @@ BrowserGlue.prototype = {
// cleanup (called on application shutdown)
_dispose: function BG__dispose() {
- // AboutHomeStartupCache might write to the cache during
- // quit-application-granted, so we defer uninitialization
- // until here.
- lazy.AboutHomeStartupCache.uninit();
+ // newtab component is disabled. tor-browser#43886
if (this._lateTasksIdleObserver) {
this._userIdleService.removeIdleObserver(
@@ -1197,13 +1191,6 @@ BrowserGlue.prototype = {
},
{
- name: "ASRouterNewTabHook.createInstance",
- task: () => {
- lazy.ASRouterNewTabHook.createInstance(lazy.ASRouterDefaultConfig());
- },
- },
-
- {
name: "BackgroundUpdate",
condition: AppConstants.MOZ_UPDATE_AGENT && AppConstants.MOZ_UPDATER,
task: async () => {
diff --git a/browser/components/DesktopActorRegistry.sys.mjs b/browser/components/DesktopActorRegistry.sys.mjs
@@ -708,22 +708,6 @@ let JSWINDOWACTORS = {
allFrames: true,
},
- ASRouter: {
- parent: {
- esModuleURI: "resource:///actors/ASRouterParent.sys.mjs",
- },
- child: {
- esModuleURI: "resource:///actors/ASRouterChild.sys.mjs",
- events: {
- // This is added so the actor instantiates immediately and makes
- // methods available to the page js on load.
- DOMDocElementInserted: {},
- },
- },
- matches: ["about:asrouter*", "about:welcome*", "about:privatebrowsing*"],
- remoteTypes: ["privilegedabout"],
- },
-
SwitchDocumentDirection: {
child: {
esModuleURI: "resource:///actors/SwitchDocumentDirectionChild.sys.mjs",
diff --git a/browser/components/about/AboutRedirector.cpp b/browser/components/about/AboutRedirector.cpp
@@ -21,6 +21,7 @@
#define ABOUT_WELCOME_CHROME_URL \
"chrome://browser/content/aboutwelcome/aboutwelcome.html"
#define ABOUT_HOME_URL "about:home"
+#define BASE_BROWSER_HOME_PAGE_URL "chrome://browser/content/blanktab.html"
namespace mozilla {
namespace browser {
@@ -33,6 +34,12 @@ struct RedirEntry {
uint32_t flags;
};
+static const uint32_t BASE_BROWSER_HOME_PAGE_FLAGS =
+ nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
+ nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS |
+ nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
+ nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI;
+
/*
Entries which do not have URI_SAFE_FOR_UNTRUSTED_CONTENT will run with chrome
privileges. This is potentially dangerous. Please use
@@ -84,10 +91,7 @@ static const RedirEntry kRedirMap[] = {
nsIAboutModule::HIDE_FROM_ABOUTABOUT},
{"policies", "chrome://browser/content/policies/aboutPolicies.html",
nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI},
- {"privatebrowsing", "chrome://browser/content/aboutPrivateBrowsing.html",
- nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
- nsIAboutModule::URI_MUST_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT |
- nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS},
+ {"privatebrowsing", "about:blank", BASE_BROWSER_HOME_PAGE_FLAGS},
{"profiling",
"chrome://devtools/content/performance-new/aboutprofiling/index.html",
nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI},
@@ -106,11 +110,10 @@ static const RedirEntry kRedirMap[] = {
{"welcomeback", "chrome://browser/content/aboutWelcomeBack.xhtml",
nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::HIDE_FROM_ABOUTABOUT |
nsIAboutModule::IS_SECURE_CHROME_UI},
- {"welcome", "about:blank",
- nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
- nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS |
- nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
- nsIAboutModule::ALLOW_SCRIPT},
+ {"welcome", "about:blank", BASE_BROWSER_HOME_PAGE_FLAGS},
+ {"home", "about:blank", BASE_BROWSER_HOME_PAGE_FLAGS},
+ {"newtab", "chrome://browser/content/blanktab.html",
+ BASE_BROWSER_HOME_PAGE_FLAGS},
{"messagepreview",
"chrome://browser/content/messagepreview/messagepreview.html",
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
@@ -204,13 +207,11 @@ AboutRedirector::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
if (!strcmp(path.get(), redir.id)) {
nsAutoCString url;
- if (path.EqualsLiteral("welcome")) {
- NimbusFeatures::RecordExposureEvent("aboutwelcome"_ns, true);
- if (NimbusFeatures::GetBool("aboutwelcome"_ns, "enabled"_ns, true)) {
- url.AssignASCII(ABOUT_WELCOME_CHROME_URL);
- } else {
- url.AssignASCII(ABOUT_HOME_URL);
- }
+ if (path.EqualsLiteral("welcome") || path.EqualsLiteral("home") ||
+ path.EqualsLiteral("privatebrowsing") ||
+ (path.EqualsLiteral("newtab") &&
+ StaticPrefs::browser_newtabpage_enabled())) {
+ url.AssignASCII(BASE_BROWSER_HOME_PAGE_URL);
}
// fall back to the specified url in the map
diff --git a/browser/components/about/components.conf b/browser/components/about/components.conf
@@ -11,10 +11,12 @@ pages = [
'certerror',
'downloads',
'framecrashed',
+ 'home',
'keyboard',
'logins',
'loginsimportreport',
'messagepreview',
+ 'newtab',
'opentabs',
'policies',
'preferences',
diff --git a/browser/components/moz.build b/browser/components/moz.build
@@ -47,7 +47,7 @@ DIRS += [
"migration",
"mozcachedohttp",
"multilineeditor",
- "newtab",
+ # Exclude newtab component. tor-browser#43886.
"originattributes",
"pagedata",
"permissions",
diff --git a/browser/components/newtab/AboutHomeStartupCache.sys.mjs b/browser/components/newtab/AboutHomeStartupCache.sys.mjs
@@ -4,7 +4,6 @@
let lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
- AboutNewTab: "resource:///modules/AboutNewTab.sys.mjs",
AsyncShutdown: "resource://gre/modules/AsyncShutdown.sys.mjs",
DeferredTask: "resource://gre/modules/DeferredTask.sys.mjs",
E10SUtils: "resource://gre/modules/E10SUtils.sys.mjs",
@@ -404,12 +403,8 @@ export var AboutHomeStartupCache = {
return { pageInputStream: null, scriptInputStream: null };
}
- let state = lazy.AboutNewTab.activityStream.store.getState();
- return new Promise(resolve => {
- this._cacheDeferred = resolve;
- this.log.trace("Parent is requesting cache streams.");
- this._procManager.sendAsyncMessage(this.CACHE_REQUEST_MESSAGE, { state });
- });
+ this.log.error("Activity Stream is disabled.");
+ return { pageInputStream: null, scriptInputStream: null };
},
/**
diff --git a/browser/components/preferences/home.inc.xhtml b/browser/components/preferences/home.inc.xhtml
@@ -35,7 +35,6 @@
class="check-home-page-controlled"
data-preference-related="browser.startup.homepage">
<menupopup>
- <menuitem value="0" data-l10n-id="home-mode-choice-default-fx" />
<menuitem value="2" data-l10n-id="home-mode-choice-custom" />
<menuitem value="1" data-l10n-id="home-mode-choice-blank" />
</menupopup>
@@ -84,7 +83,6 @@
Preferences so we need to handle setting the pref manually.-->
<menulist id="newTabMode" flex="1" data-preference-related="browser.newtabpage.enabled">
<menupopup>
- <menuitem value="0" data-l10n-id="home-mode-choice-default-fx" />
<menuitem value="1" data-l10n-id="home-mode-choice-blank" />
</menupopup>
</menulist>
@@ -95,6 +93,7 @@
data-category="paneHome"
data-subcategory="contents"
data-srd-groupid="home"
+ data-hidden-from-search="true"
hidden="true">
<label><html:h2 data-l10n-id="home-prefs-content-header2" /></label>
<description class="description-deemphasized" data-l10n-id="home-prefs-content-description2" />
diff --git a/browser/components/preferences/home.js b/browser/components/preferences/home.js
@@ -769,10 +769,14 @@ var gHomePane = {
if (controllingExtension && controllingExtension.id) {
newValue = controllingExtension.id;
- } else if (isDefault) {
- newValue = this.HOME_MODE_FIREFOX_HOME;
} else if (isBlank) {
+ // For base-browser, we want to check isBlank first since the default page
+ // is also the blank page, but we only have a menu option for
+ // HOME_MODE_BLANK, rather than HOME_MODE_FIREFOX_HOME.
+ // See tor-browser#41609.
newValue = this.HOME_MODE_BLANK;
+ } else if (isDefault) {
+ newValue = this.HOME_MODE_FIREFOX_HOME;
} else {
newValue = this.HOME_MODE_CUSTOM;
}
diff --git a/browser/components/search/SearchUIUtils.sys.mjs b/browser/components/search/SearchUIUtils.sys.mjs
@@ -12,10 +12,6 @@
*/
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
-import {
- AboutNewTabComponentRegistry,
- BaseAboutNewTabComponentRegistrant,
-} from "moz-src:///browser/components/newtab/AboutNewTabComponents.sys.mjs";
const lazy = XPCOMUtils.declareLazy({
BrowserSearchTelemetry:
@@ -527,27 +523,3 @@ export var SearchUIUtils = {
});
},
};
-
-/**
- * A registrant that adds the handoff search bar to about:newtab / about:home.
- */
-export class SearchNewTabComponentsRegistrant extends BaseAboutNewTabComponentRegistrant {
- getComponents() {
- const { caretBlinkCount, caretBlinkTime } = Services.appinfo;
-
- return [
- {
- type: AboutNewTabComponentRegistry.TYPES.SEARCH,
- l10nURLs: [],
- componentURL: "chrome://browser/content/contentSearchHandoffUI.mjs",
- tagName: "content-search-handoff-ui",
- cssVariables: {
- "--caret-blink-count":
- caretBlinkCount > -1 ? caretBlinkCount : "infinite",
- "--caret-blink-time":
- caretBlinkTime > 0 ? `${caretBlinkTime * 2}ms` : `${1134}ms`,
- },
- },
- ];
- }
-}
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
@@ -108,8 +108,6 @@
PictureInPicture: "resource://gre/modules/PictureInPicture.sys.mjs",
// SmartTabGrouping.sys.mjs is missing. tor-browser#44045.
// Unused in this context. See mozilla bug 1981785.
- SponsorProtection:
- "moz-src:///browser/components/newtab/SponsorProtection.sys.mjs",
TabMetrics:
"moz-src:///browser/components/tabbrowser/TabMetrics.sys.mjs",
TabStateFlusher:
@@ -7722,10 +7720,6 @@
debugStringArray.push("[A]");
}
- if (this.SponsorProtection.isProtectedBrowser(tab.linkedBrowser)) {
- debugStringArray.push("[S]");
- }
-
if (debugStringArray.length) {
labelArray.push(debugStringArray.join(" "));
}
@@ -9287,10 +9281,6 @@
{ loadFlags, globalHistoryOptions }
) {
if (globalHistoryOptions?.triggeringSponsoredURL) {
- if (globalHistoryOptions.triggeringSource == "newtab") {
- gBrowser.SponsorProtection.addProtectedBrowser(browser);
- }
-
try {
// Browser may access URL after fixing it up, then store the URL into DB.
// To match with it, fix the link up explicitly.
@@ -9311,8 +9301,6 @@
globalHistoryOptions.triggeringSource
);
} catch (e) {}
- } else {
- gBrowser.SponsorProtection.removeProtectedBrowser(browser);
}
if (globalHistoryOptions?.triggeringSearchEngine) {
diff --git a/browser/modules/AboutNewTab.sys.mjs b/browser/modules/AboutNewTab.sys.mjs
@@ -161,6 +161,11 @@ export const AboutNewTab = {
* onBrowserReady - Continues the initialization of Activity Stream after browser is ready.
*/
async onBrowserReady() {
+ if (AppConstants.BASE_BROWSER_VERSION) {
+ // Do not initialise ActivityStream, which we do not want and is not
+ // available. tor-browser#43886.
+ return;
+ }
if (this.activityStream && this.activityStream.initialized) {
return;
}
diff --git a/browser/modules/HomePage.sys.mjs b/browser/modules/HomePage.sys.mjs
@@ -15,7 +15,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
});
const kPrefName = "browser.startup.homepage";
-const kDefaultHomePage = "about:home";
+const kDefaultHomePage = "about:blank";
const kExtensionControllerPref =
"browser.startup.homepage_override.extensionControlled";
const kHomePageIgnoreListId = "homepage-urls";