Verified Commit 4aa1f346 authored by henry's avatar henry Committed by Pier Angelo Vendrame
Browse files

Bug 31575: Disable Firefox Home (Activity Stream)

Treat about:blank as the default home page and new tab page.

Avoid loading AboutNewTab in BrowserGlue.jsm in order
to avoid several network requests that we do not need.

Bug 41624: Disable about:pocket-* pages and about:firefoxview.

Bug 40144: Redirect about:privatebrowsing to the user's home
parent 61e43055
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -67,7 +67,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
  RFPHelper: "resource://gre/modules/RFPHelper.jsm",
  SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
  Sanitizer: "resource:///modules/Sanitizer.jsm",
  SaveToPocket: "chrome://pocket/content/SaveToPocket.jsm",
  ScreenshotsUtils: "resource:///modules/ScreenshotsUtils.jsm",
  SessionStartup: "resource:///modules/sessionstore/SessionStartup.jsm",
  SessionStore: "resource:///modules/sessionstore/SessionStore.jsm",
@@ -5422,8 +5421,6 @@ var XULBrowserWindow = {

    SafeBrowsingNotificationBox.onLocationChange(aLocationURI);

    SaveToPocket.onLocationChange(window);

    UrlbarProviderSearchTips.onLocationChange(
      window,
      aLocationURI,
+2 −85
Original line number Diff line number Diff line
@@ -18,13 +18,9 @@ const { AppConstants } = ChromeUtils.import(
);

XPCOMUtils.defineLazyModuleGetters(this, {
  AboutNewTab: "resource:///modules/AboutNewTab.jsm",
  ActorManagerParent: "resource://gre/modules/ActorManagerParent.jsm",
  AddonManager: "resource://gre/modules/AddonManager.jsm",
  AppMenuNotifications: "resource://gre/modules/AppMenuNotifications.jsm",
  ASRouterDefaultConfig:
    "resource://activity-stream/lib/ASRouterDefaultConfig.jsm",
  ASRouterNewTabHook: "resource://activity-stream/lib/ASRouterNewTabHook.jsm",
  ASRouter: "resource://activity-stream/lib/ASRouter.jsm",
  AsyncShutdown: "resource://gre/modules/AsyncShutdown.jsm",
  BackgroundUpdate: "resource://gre/modules/BackgroundUpdate.jsm",
@@ -79,7 +75,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
  RFPHelper: "resource://gre/modules/RFPHelper.jsm",
  SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
  Sanitizer: "resource:///modules/Sanitizer.jsm",
  SaveToPocket: "chrome://pocket/content/SaveToPocket.jsm",
  ScreenshotsUtils: "resource:///modules/ScreenshotsUtils.jsm",
  SearchSERPTelemetry: "resource:///modules/SearchSERPTelemetry.jsm",
  SessionStartup: "resource:///modules/sessionstore/SessionStartup.jsm",
@@ -226,28 +221,6 @@ let JSWINDOWACTORS = {
    remoteTypes: ["privilegedabout"],
  },

  AboutNewTab: {
    parent: {
      moduleURI: "resource:///actors/AboutNewTabParent.jsm",
    },
    child: {
      moduleURI: "resource:///actors/AboutNewTabChild.jsm",
      events: {
        DOMContentLoaded: {},
        pageshow: {},
        visibilitychange: {},
      },
    },
    // The wildcard on about:newtab is for the ?endpoint query parameter
    // that is used for snippets debugging. The wildcard for about:home
    // is similar, and also allows for falling back to loading the
    // about:home document dynamically if an attempt is made to load
    // about:home?jscache from the AboutHomeStartupCache as a top-level
    // load.
    matches: ["about:home*", "about:welcome", "about:newtab*"],
    remoteTypes: ["privilegedabout"],
  },

  AboutPlugins: {
    parent: {
      moduleURI: "resource:///actors/AboutPluginsParent.jsm",
@@ -263,26 +236,6 @@ let JSWINDOWACTORS = {
    matches: ["about:plugins"],
  },

  AboutPocket: {
    parent: {
      moduleURI: "resource:///actors/AboutPocketParent.jsm",
    },
    child: {
      moduleURI: "resource:///actors/AboutPocketChild.jsm",

      events: {
        DOMDocElementInserted: { capture: true },
      },
    },

    matches: [
      "about:pocket-saved*",
      "about:pocket-signup*",
      "about:pocket-home*",
      "about:pocket-style-guide*",
    ],
  },

  AboutPrivateBrowsing: {
    parent: {
      moduleURI: "resource:///actors/AboutPrivateBrowsingParent.jsm",
@@ -717,27 +670,6 @@ let JSWINDOWACTORS = {
    matches: ["about:studies*"],
  },

  ASRouter: {
    parent: {
      moduleURI: "resource:///actors/ASRouterParent.jsm",
    },
    child: {
      moduleURI: "resource:///actors/ASRouterChild.jsm",
      events: {
        // This is added so the actor instantiates immediately and makes
        // methods available to the page js on load.
        DOMDocElementInserted: {},
      },
    },
    matches: [
      "about:home*",
      "about:newtab*",
      "about:welcome*",
      "about:privatebrowsing",
    ],
    remoteTypes: ["privilegedabout"],
  },

  SwitchDocumentDirection: {
    child: {
      moduleURI: "resource:///actors/SwitchDocumentDirectionChild.jsm",
@@ -1276,8 +1208,6 @@ BrowserGlue.prototype = {
      Normandy.init();
    }

    SaveToPocket.init();

    AboutHomeStartupCache.init();

    Services.obs.notifyObservers(null, "browser-ui-startup-complete");
@@ -1600,8 +1530,6 @@ BrowserGlue.prototype = {

  // the first browser window has finished initializing
  _onFirstWindowLoaded: function BG__onFirstWindowLoaded(aWindow) {
    AboutNewTab.init();

    TabCrashHandler.init();

    ProcessHangMonitor.init();
@@ -2014,7 +1942,6 @@ BrowserGlue.prototype = {
      },

      () => RFPHelper.uninit(),
      () => ASRouterNewTabHook.destroy(),
      () => UpdateListener.reset(),
    ];

@@ -2735,12 +2662,6 @@ BrowserGlue.prototype = {
        },
      },

      {
        task: () => {
          ASRouterNewTabHook.createInstance(ASRouterDefaultConfig());
        },
      },

      {
        condition: AppConstants.MOZ_UPDATE_AGENT,
        task: () => {
@@ -5834,12 +5755,8 @@ var AboutHomeStartupCache = {
      return { pageInputStream: null, scriptInputStream: null };
    }

    let state = 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 };
  },

  /**
+7 −2
Original line number Diff line number Diff line
@@ -70,12 +70,14 @@ static const RedirEntry kRedirMap[] = {
         nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS |
         nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
         nsIAboutModule::IS_SECURE_CHROME_UI},
#ifndef BASE_BROWSER
    {"firefoxview", "chrome://browser/content/firefoxview.html",
     nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI |
         nsIAboutModule::HIDE_FROM_ABOUTABOUT},
#endif
    {"policies", "chrome://browser/content/policies/aboutPolicies.html",
     nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI},
    {"privatebrowsing", "chrome://browser/content/aboutPrivateBrowsing.html",
    {"privatebrowsing", "about:blank",
     nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
         nsIAboutModule::URI_MUST_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT |
         nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS},
@@ -106,6 +108,7 @@ static const RedirEntry kRedirMap[] = {
         nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS |
         nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
         nsIAboutModule::ALLOW_SCRIPT},
#ifndef BASE_BROWSER
    {"pocket-saved", "chrome://pocket/content/panels/saved.html",
     nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
         nsIAboutModule::URI_CAN_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT |
@@ -122,6 +125,7 @@ static const RedirEntry kRedirMap[] = {
     nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
         nsIAboutModule::URI_CAN_LOAD_IN_CHILD | nsIAboutModule::ALLOW_SCRIPT |
         nsIAboutModule::HIDE_FROM_ABOUTABOUT},
#endif
    {"preferences", "chrome://browser/content/preferences/preferences.xhtml",
     nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI},
    {"downloads",
@@ -186,7 +190,8 @@ AboutRedirector::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
      // enabled about:newtab. Disabled about:newtab page uses fallback.
      if (path.EqualsLiteral("home") ||
          (StaticPrefs::browser_newtabpage_enabled() &&
           path.EqualsLiteral("newtab"))) {
           path.EqualsLiteral("newtab")) ||
          path.EqualsLiteral("privatebrowsing")) {
        nsCOMPtr<nsIAboutNewTabService> aboutNewTabService =
            do_GetService("@mozilla.org/browser/aboutnewtab-service;1", &rv);
        NS_ENSURE_SUCCESS(rv, rv);
+0 −5
Original line number Diff line number Diff line
@@ -12,12 +12,7 @@ pages = [
    'home',
    'logins',
    'loginsimportreport',
    'firefoxview',
    'newtab',
    'pocket-home',
    'pocket-saved',
    'pocket-signup',
    'pocket-style-guide',
    'policies',
    'preferences',
    'privatebrowsing',
+0 −2
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ DIRS += [
    "newtab",
    "originattributes",
    "places",
    "pocket",
    "preferences",
    "privatebrowsing",
    "prompts",
@@ -63,7 +62,6 @@ DIRS += ["build"]
if CONFIG["NIGHTLY_BUILD"]:
    DIRS += [
        "colorways",
        "firefoxview",
    ]


Loading