henry pushed to branch tor-browser-140.0esr-15.0-1 at The Tor Project / Applications / Tor Browser
Commits:
- 
27defb0b
by Henry Wilkes at 2025-07-16T12:05:09+01:00
 - 
e6335a46
by Henry Wilkes at 2025-07-16T12:05:20+01:00
 - 
a4abc77c
by Henry Wilkes at 2025-07-16T12:05:21+01:00
 - 
dba06fad
by Henry Wilkes at 2025-07-16T12:05:22+01:00
 
10 changed files:
- browser/actors/moz.build
 - browser/components/BrowserComponents.manifest
 - browser/components/BrowserGlue.sys.mjs
 - browser/components/about/AboutRedirector.cpp
 - browser/components/about/components.conf
 - browser/components/moz.build
 - browser/components/newtab/AboutNewTabRedirector.sys.mjs
 - browser/modules/AboutNewTab.sys.mjs
 - docshell/base/nsAboutRedirector.cpp
 - docshell/build/components.conf
 
Changes:
| ... | ... | @@ -32,8 +32,7 @@ with Files("WebRTCChild.sys.mjs"): | 
| 32 | 32 |      BUG_COMPONENT = ("Firefox", "Site Permissions")
 | 
| 33 | 33 | |
| 34 | 34 |  FINAL_TARGET_FILES.actors += [
 | 
| 35 | -    "AboutNewTabChild.sys.mjs",
 | 
|
| 36 | -    "AboutNewTabParent.sys.mjs",
 | 
|
| 35 | +    # Remove newtab actors. tor-browser#43886.
 | 
|
| 37 | 36 |      "AboutPocketChild.sys.mjs",
 | 
| 38 | 37 |      "AboutPocketParent.sys.mjs",
 | 
| 39 | 38 |      "AboutPrivateBrowsingChild.sys.mjs",
 | 
| ... | ... | @@ -17,7 +17,7 @@ category browser-before-ui-startup resource://normandy/Normandy.sys.mjs Normandy | 
| 17 | 17 |  #endif
 | 
| 18 | 18 |  category browser-before-ui-startup resource:///modules/ResetPBMPanel.sys.mjs ResetPBMPanel.init
 | 
| 19 | 19 |  category browser-before-ui-startup resource:///modules/HomepageOverride.sys.mjs HomepageOverride.check
 | 
| 20 | -category browser-before-ui-startup resource:///modules/AboutHomeStartupCache.sys.mjs AboutHomeStartupCache.init
 | 
|
| 20 | +# newtab component is disabled. tor-browser#43886
 | 
|
| 21 | 21 |  category browser-before-ui-startup resource:///modules/AccountsGlue.sys.mjs AccountsGlue.init
 | 
| 22 | 22 | |
| 23 | 23 |  # Browser window lifecycle consumers
 | 
| ... | ... | @@ -8,7 +8,7 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | 
| 8 | 8 |  const lazy = {};
 | 
| 9 | 9 | |
| 10 | 10 |  ChromeUtils.defineESModuleGetters(lazy, {
 | 
| 11 | -  AboutHomeStartupCache: "resource:///modules/AboutHomeStartupCache.sys.mjs",
 | 
|
| 11 | +  // newtab component is disabled. tor-browser#43886
 | 
|
| 12 | 12 |    AWToolbarButton: "resource:///modules/aboutwelcome/AWToolbarUtils.sys.mjs",
 | 
| 13 | 13 |    ASRouter: "resource:///modules/asrouter/ASRouter.sys.mjs",
 | 
| 14 | 14 |    AddonManager: "resource://gre/modules/AddonManager.sys.mjs",
 | 
| ... | ... | @@ -569,10 +569,7 @@ BrowserGlue.prototype = { | 
| 569 | 569 | |
| 570 | 570 |    // cleanup (called on application shutdown)
 | 
| 571 | 571 |    _dispose: function BG__dispose() {
 | 
| 572 | -    // AboutHomeStartupCache might write to the cache during
 | 
|
| 573 | -    // quit-application-granted, so we defer uninitialization
 | 
|
| 574 | -    // until here.
 | 
|
| 575 | -    lazy.AboutHomeStartupCache.uninit();
 | 
|
| 572 | +    // newtab component is disabled. tor-browser#43886
 | 
|
| 576 | 573 | |
| 577 | 574 |      if (this._lateTasksIdleObserver) {
 | 
| 578 | 575 |        this._userIdleService.removeIdleObserver(
 | 
| ... | ... | @@ -26,6 +26,18 @@ | 
| 26 | 26 |  #define ABOUT_WELCOME_CHROME_URL \
 | 
| 27 | 27 |    "chrome://browser/content/aboutwelcome/aboutwelcome.html"
 | 
| 28 | 28 |  #define ABOUT_HOME_URL "about:home"
 | 
| 29 | +// NOTE: We return "about:tor" rather than the "chrome:" path
 | 
|
| 30 | +// "chrome://browser/content/abouttor/aboutTor.html"
 | 
|
| 31 | +// The result is that the channel created in NewChannel in will have its
 | 
|
| 32 | +// resultPrincipalURI set to "about:tor".
 | 
|
| 33 | +// What this means in practice is that the loaded document's documentURI and
 | 
|
| 34 | +// currentURI will be "about:tor" rather than "about:newtab", "about:home",
 | 
|
| 35 | +// "about:welcome" or "about:privatebrowsing".
 | 
|
| 36 | +// The disadvantage of this is that we often need to add "about:tor" to places
 | 
|
| 37 | +// where "about:newtab" or other URIs appear.
 | 
|
| 38 | +// The advantage is that we maintain more control against changes in
 | 
|
| 39 | +// mozilla-central.
 | 
|
| 40 | +#define BASE_BROWSER_HOME_PAGE_URL "about:tor"
 | 
|
| 29 | 41 | |
| 30 | 42 |  namespace mozilla {
 | 
| 31 | 43 |  namespace browser {
 | 
| ... | ... | @@ -38,6 +50,11 @@ struct RedirEntry { | 
| 38 | 50 |    uint32_t flags;
 | 
| 39 | 51 |  };
 | 
| 40 | 52 | |
| 53 | +static const uint32_t BASE_BROWSER_HOME_PAGE_FLAGS =
 | 
|
| 54 | +    nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
 | 
|
| 55 | +    nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
 | 
|
| 56 | +    nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI;
 | 
|
| 57 | +  | 
|
| 41 | 58 |  /*
 | 
| 42 | 59 |    Entries which do not have URI_SAFE_FOR_UNTRUSTED_CONTENT will run with chrome
 | 
| 43 | 60 |    privileges. This is potentially dangerous. Please use
 | 
| ... | ... | @@ -82,10 +99,7 @@ static const RedirEntry kRedirMap[] = { | 
| 82 | 99 |           nsIAboutModule::IS_SECURE_CHROME_UI},
 | 
| 83 | 100 |      {"policies", "chrome://browser/content/policies/aboutPolicies.html",
 | 
| 84 | 101 |       nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI},
 | 
| 85 | -    {"privatebrowsing", "about:blank",
 | 
|
| 86 | -     nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
 | 
|
| 87 | -         nsIAboutModule::URI_MUST_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT |
 | 
|
| 88 | -         nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS},
 | 
|
| 102 | +    {"privatebrowsing", "about:blank", BASE_BROWSER_HOME_PAGE_FLAGS},
 | 
|
| 89 | 103 |      {"profiling",
 | 
| 90 | 104 |       "chrome://devtools/content/performance-new/aboutprofiling/index.html",
 | 
| 91 | 105 |       nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI},
 | 
| ... | ... | @@ -111,11 +125,10 @@ static const RedirEntry kRedirMap[] = { | 
| 111 | 125 |      {"welcomeback", "chrome://browser/content/aboutWelcomeBack.xhtml",
 | 
| 112 | 126 |       nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::HIDE_FROM_ABOUTABOUT |
 | 
| 113 | 127 |           nsIAboutModule::IS_SECURE_CHROME_UI},
 | 
| 114 | -    {"welcome", "about:blank",
 | 
|
| 115 | -     nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
 | 
|
| 116 | -         nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS |
 | 
|
| 117 | -         nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
 | 
|
| 118 | -         nsIAboutModule::ALLOW_SCRIPT},
 | 
|
| 128 | +    {"welcome", "about:blank", BASE_BROWSER_HOME_PAGE_FLAGS},
 | 
|
| 129 | +    {"home", "about:blank", BASE_BROWSER_HOME_PAGE_FLAGS},
 | 
|
| 130 | +    {"newtab", "chrome://browser/content/blanktab.html",
 | 
|
| 131 | +     BASE_BROWSER_HOME_PAGE_FLAGS},
 | 
|
| 119 | 132 |      {"messagepreview",
 | 
| 120 | 133 |       "chrome://browser/content/messagepreview/messagepreview.html",
 | 
| 121 | 134 |       nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
 | 
| ... | ... | @@ -177,6 +190,8 @@ static const RedirEntry kRedirMap[] = { | 
| 177 | 190 |           nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
 | 
| 178 | 191 |           nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS},
 | 
| 179 | 192 |  #endif
 | 
| 193 | +    {"tor", "chrome://browser/content/abouttor/aboutTor.html",
 | 
|
| 194 | +     BASE_BROWSER_HOME_PAGE_FLAGS},
 | 
|
| 180 | 195 |      // The correct URI must be obtained by GetManualChromeURI
 | 
| 181 | 196 |      {"manual", "about:blank",
 | 
| 182 | 197 |       nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
 | 
| ... | ... | @@ -277,13 +292,11 @@ AboutRedirector::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo, | 
| 277 | 292 |      if (!strcmp(path.get(), redir.id)) {
 | 
| 278 | 293 |        nsAutoCString url;
 | 
| 279 | 294 | |
| 280 | -      if (path.EqualsLiteral("welcome")) {
 | 
|
| 281 | -        NimbusFeatures::RecordExposureEvent("aboutwelcome"_ns, true);
 | 
|
| 282 | -        if (NimbusFeatures::GetBool("aboutwelcome"_ns, "enabled"_ns, true)) {
 | 
|
| 283 | -          url.AssignASCII(ABOUT_WELCOME_CHROME_URL);
 | 
|
| 284 | -        } else {
 | 
|
| 285 | -          url.AssignASCII(ABOUT_HOME_URL);
 | 
|
| 286 | -        }
 | 
|
| 295 | +      if (path.EqualsLiteral("welcome") || path.EqualsLiteral("home") ||
 | 
|
| 296 | +          path.EqualsLiteral("privatebrowsing") ||
 | 
|
| 297 | +          (path.EqualsLiteral("newtab") &&
 | 
|
| 298 | +           StaticPrefs::browser_newtabpage_enabled())) {
 | 
|
| 299 | +        url.AssignASCII(BASE_BROWSER_HOME_PAGE_URL);
 | 
|
| 287 | 300 |        }
 | 
| 288 | 301 | |
| 289 | 302 |        if (path.EqualsLiteral("manual")) {
 | 
| ... | ... | @@ -10,8 +10,10 @@ pages = [ | 
| 10 | 10 |      'certerror',
 | 
| 11 | 11 |      'downloads',
 | 
| 12 | 12 |      'framecrashed',
 | 
| 13 | +    'home',
 | 
|
| 13 | 14 |      'logins',
 | 
| 14 | 15 |      'loginsimportreport',
 | 
| 16 | +    'newtab',
 | 
|
| 15 | 17 |      'manual',
 | 
| 16 | 18 |      'messagepreview',
 | 
| 17 | 19 |      'policies',
 | 
| ... | ... | @@ -26,6 +28,7 @@ pages = [ | 
| 26 | 28 |      'sessionrestore',
 | 
| 27 | 29 |      'settings',
 | 
| 28 | 30 |      'tabcrashed',
 | 
| 31 | +    'tor',
 | 
|
| 29 | 32 |      'unloads',
 | 
| 30 | 33 |      'welcome',
 | 
| 31 | 34 |      'welcomeback',
 | 
| ... | ... | @@ -44,7 +44,7 @@ DIRS += [ | 
| 44 | 44 |      "messagepreview",
 | 
| 45 | 45 |      "migration",
 | 
| 46 | 46 |      "newidentity",
 | 
| 47 | -    "newtab",
 | 
|
| 47 | +    # Exclude newtab component. tor-browser#43886.
 | 
|
| 48 | 48 |      "onionservices",
 | 
| 49 | 49 |      "originattributes",
 | 
| 50 | 50 |      "pagedata",
 | 
| ... | ... | @@ -416,19 +416,20 @@ class BaseAboutNewTabRedirector { | 
| 416 | 416 |     * the newtab page has no effect on the result of this function.
 | 
| 417 | 417 |     */
 | 
| 418 | 418 |    get defaultURL() {
 | 
| 419 | -    // NOTE: We return "about:tor" rather than the "chrome:" path
 | 
|
| 420 | -    // "chrome://browser/content/abouttor/aboutTor.html"
 | 
|
| 421 | -    // The result is that the channel created in NewChannel in
 | 
|
| 422 | -    // browser/components/about/AboutRedirector.cpp will have its
 | 
|
| 423 | -    // resultPrincipalURI set to "about:tor".
 | 
|
| 424 | -    // What this means in practice is that the loaded document's documentURI and
 | 
|
| 425 | -    // currentURI will be "about:tor" rather than "about:newtab", "about:home",
 | 
|
| 426 | -    // "about:welcome" or "about:privatebrowsing".
 | 
|
| 427 | -    // The disadvantage of this is that we often need to add "about:tor" to
 | 
|
| 428 | -    // places where "about:newtab" or other URIs appear.
 | 
|
| 429 | -    // The advantage is that we maintain more control against changes in
 | 
|
| 430 | -    // mozilla-central.
 | 
|
| 431 | -    return "about:tor";
 | 
|
| 419 | +    // Generate the desired activity stream resource depending on state, e.g.,
 | 
|
| 420 | +    // "resource://newtab/prerendered/activity-stream.html"
 | 
|
| 421 | +    // "resource://newtab/prerendered/activity-stream-debug.html"
 | 
|
| 422 | +    // "resource://newtab/prerendered/activity-stream-noscripts.html"
 | 
|
| 423 | +    return [
 | 
|
| 424 | +      "resource://newtab/prerendered/",
 | 
|
| 425 | +      "activity-stream",
 | 
|
| 426 | +      // Debug version loads dev scripts but noscripts separately loads scripts
 | 
|
| 427 | +      this.activityStreamDebug && !this.privilegedAboutProcessEnabled
 | 
|
| 428 | +        ? "-debug"
 | 
|
| 429 | +        : "",
 | 
|
| 430 | +      this.privilegedAboutProcessEnabled ? "-noscripts" : "",
 | 
|
| 431 | +      ".html",
 | 
|
| 432 | +    ].join("");
 | 
|
| 432 | 433 |    }
 | 
| 433 | 434 | |
| 434 | 435 |    newChannel() {
 | 
| ... | ... | @@ -154,6 +154,11 @@ export const AboutNewTab = { | 
| 154 | 154 |     * onBrowserReady - Continues the initialization of Activity Stream after browser is ready.
 | 
| 155 | 155 |     */
 | 
| 156 | 156 |    async onBrowserReady() {
 | 
| 157 | +    if (AppConstants.BASE_BROWSER_VERSION) {
 | 
|
| 158 | +      // Do not initialise ActivityStream, which we do not want and is not
 | 
|
| 159 | +      // available. tor-browser#43886.
 | 
|
| 160 | +      return;
 | 
|
| 161 | +    }
 | 
|
| 157 | 162 |      if (this.activityStream && this.activityStream.initialized) {
 | 
| 158 | 163 |        return;
 | 
| 159 | 164 |      }
 | 
| ... | ... | @@ -232,11 +232,7 @@ static const RedirEntry kRedirMap[] = { | 
| 232 | 232 |           nsIAboutModule::URI_CAN_LOAD_IN_CHILD |
 | 
| 233 | 233 |           nsIAboutModule::URI_MUST_LOAD_IN_CHILD},
 | 
| 234 | 234 |      {"crashgpu", "about:blank", nsIAboutModule::HIDE_FROM_ABOUTABOUT},
 | 
| 235 | -    {"crashextensions", "about:blank", nsIAboutModule::HIDE_FROM_ABOUTABOUT},
 | 
|
| 236 | -    {"tor", "chrome://browser/content/abouttor/aboutTor.html",
 | 
|
| 237 | -     nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
 | 
|
| 238 | -         nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
 | 
|
| 239 | -         nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI}};
 | 
|
| 235 | +    {"crashextensions", "about:blank", nsIAboutModule::HIDE_FROM_ABOUTABOUT}};
 | 
|
| 240 | 236 |  static const int kRedirTotal = std::size(kRedirMap);
 | 
| 241 | 237 | |
| 242 | 238 |  NS_IMETHODIMP
 | 
| ... | ... | @@ -31,7 +31,6 @@ about_pages = [ | 
| 31 | 31 |      'support',
 | 
| 32 | 32 |      'torconnect',
 | 
| 33 | 33 |      'translations',
 | 
| 34 | -    'tor',
 | 
|
| 35 | 34 |      # Removed 'url-classifier'. tor-browser#42831.
 | 
| 36 | 35 |  ]
 | 
| 37 | 36 |