From 8b9d9205511e8ec1c28a3890b9a3a59d85627730 Mon Sep 17 00:00:00 2001 From: Alex Catarineu Date: Mon, 9 Sep 2019 13:04:34 +0200 Subject: [PATCH] Bug 31575: Replace Firefox Home (newtab) with about:tor Patching AboutNewTabService so that AboutNewTab is not loaded to avoid several network requests that we do not need. Besides, about:newtab will now point to about:blank or about:tor (depending on browser.newtabpage.enabled) and about:home will point to about:tor. --- .../components/newtab/AboutNewTabService.jsm | 29 +------------------ .../preferences/in-content/home.xul | 4 +-- .../preferences/in-content/preferences.xul | 5 +++- browser/modules/HomePage.jsm | 2 +- 4 files changed, 8 insertions(+), 32 deletions(-) diff --git a/browser/components/newtab/AboutNewTabService.jsm b/browser/components/newtab/AboutNewTabService.jsm index 8995d82d543bf..117b9d6347cdc 100644 --- a/browser/components/newtab/AboutNewTabService.jsm +++ b/browser/components/newtab/AboutNewTabService.jsm @@ -10,9 +10,6 @@ const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); const {E10SUtils} = ChromeUtils.import("resource://gre/modules/E10SUtils.jsm"); -ChromeUtils.defineModuleGetter(this, "AboutNewTab", - "resource:///modules/AboutNewTab.jsm"); - const TOPIC_APP_QUIT = "quit-application-granted"; const TOPIC_LOCALES_CHANGE = "intl:app-locales-changed"; const TOPIC_CONTENT_DOCUMENT_INTERACTIVE = "content-document-interactive"; @@ -47,12 +44,6 @@ function AboutNewTabService() { this.toggleActivityStream(true); this.initialized = true; this.alreadyRecordedTopsitesPainted = false; - - if (IS_MAIN_PROCESS) { - AboutNewTab.init(); - } else if (IS_PRIVILEGED_PROCESS) { - Services.obs.addObserver(this, TOPIC_CONTENT_DOCUMENT_INTERACTIVE); - } } /* @@ -179,11 +170,6 @@ AboutNewTabService.prototype = { } case TOPIC_APP_QUIT: this.uninit(); - if (IS_MAIN_PROCESS) { - AboutNewTab.uninit(); - } else if (IS_PRIVILEGED_PROCESS) { - Services.obs.removeObserver(this, TOPIC_CONTENT_DOCUMENT_INTERACTIVE); - } break; case TOPIC_LOCALES_CHANGE: this.updatePrerenderedPath(); @@ -243,20 +229,7 @@ AboutNewTabService.prototype = { * the newtab page has no effect on the result of this function. */ get defaultURL() { - // Generate the desired activity stream resource depending on state, e.g., - // resource://activity-stream/prerendered/ar/activity-stream.html - // resource://activity-stream/prerendered/en-US/activity-stream-prerendered.html - // resource://activity-stream/prerendered/static/activity-stream-debug.html - return [ - "resource://activity-stream/prerendered/", - this._activityStreamPath, - "activity-stream", - this._activityStreamPrerender ? "-prerendered" : "", - // Debug version loads dev scripts but noscripts separately loads scripts - this._activityStreamDebug && !this._privilegedContentProcess ? "-debug" : "", - this._privilegedContentProcess ? "-noscripts" : "", - ".html", - ].join(""); + return "about:tor"; }, /* diff --git a/browser/components/preferences/in-content/home.xul b/browser/components/preferences/in-content/home.xul index 8c38ba68c2af9..fc555a2f56afe 100644 --- a/browser/components/preferences/in-content/home.xul +++ b/browser/components/preferences/in-content/home.xul @@ -37,7 +37,7 @@ class="check-home-page-controlled" data-preference-related="browser.startup.homepage"> - + @@ -79,7 +79,7 @@ onsyncfrompreference="return gHomePane.syncFromNewTabPref();" onsynctopreference="return gHomePane.syncToNewTabPref(this.value);"> - + diff --git a/browser/components/preferences/in-content/preferences.xul b/browser/components/preferences/in-content/preferences.xul index 13c7bcc74ad8f..3b07e4596907f 100644 --- a/browser/components/preferences/in-content/preferences.xul +++ b/browser/components/preferences/in-content/preferences.xul @@ -17,7 +17,10 @@ - + + %aboutTorDTD; +]>