Verified Commit e703cb3c authored by henry's avatar henry Committed by ma1
Browse files

Bug 7494: Create local home page for TBB.

Bug 41333: Update about:tor to new design. Including:
+ make the favicon match the branding icon.
+ make the location bar show a search icon.
parent 9143fe28
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1419,6 +1419,14 @@ var BookmarkingUI = {
  },

  isOnNewTabPage({ currentURI }) {
    // If uri is "about:tor" then we return true. See tor-browser#41717.
    // NOTE: "about:newtab", "about:welcome", "about:home" and
    // "about:privatebrowsing" can also redirect to "about:tor".
    // NOTE: We do not simply add "about:tor" to newTabURLs below because this
    // would also match "about:torconnect".
    if (currentURI?.scheme === "about" && currentURI?.filePath === "tor") {
      return true;
    }
    // Prevent loading AboutNewTab.jsm during startup path if it
    // is only the newTabURL getter we are interested in.
    let newTabURL = Cu.isModuleLoaded("resource:///modules/AboutNewTab.jsm")
+2 −0
Original line number Diff line number Diff line
@@ -718,6 +718,7 @@ async function gLazyFindCommand(cmd, ...args) {
}

var gPageIcons = {
  "about:tor": "chrome://branding/content/icon32.png",
  "about:home": "chrome://branding/content/icon32.png",
  "about:newtab": "chrome://branding/content/icon32.png",
  "about:welcome": "chrome://branding/content/icon32.png",
@@ -725,6 +726,7 @@ var gPageIcons = {
};

var gInitialPages = [
  "about:tor",
  "about:torconnect",
  "about:blank",
  "about:home",
+1 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ function isBlankPageURL(aURL) {
  return (
    aURL == "about:blank" ||
    aURL == "about:home" ||
    aURL == "about:tor" ||
    aURL == BROWSER_NEW_TAB_URL ||
    aURL == "chrome://browser/content/blanktab.html"
  );
+20 −0
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
  UrlbarPrefs: "resource:///modules/UrlbarPrefs.sys.mjs",
  WebChannel: "resource://gre/modules/WebChannel.sys.mjs",
  WindowsRegistry: "resource://gre/modules/WindowsRegistry.sys.mjs",
  checkHomepageOverride: "resource:///modules/HomepageOverride.sys.mjs",
  clearTimeout: "resource://gre/modules/Timer.sys.mjs",
  setTimeout: "resource://gre/modules/Timer.sys.mjs",
});
@@ -492,6 +493,23 @@ let JSWINDOWACTORS = {
    matches: ["about:tabcrashed*"],
  },

  AboutTor: {
    parent: {
      esModuleURI: "resource:///actors/AboutTorParent.sys.mjs",
    },
    child: {
      esModuleURI: "resource:///actors/AboutTorChild.sys.mjs",

      events: {
        DOMContentLoaded: {},
        SubmitSearchOnionize: { wantUntrusted: true },
        SurveyDismissed: { wantUntrusted: true },
      },
    },

    matches: ["about:tor"],
  },

  AboutWelcome: {
    parent: {
      moduleURI: "resource:///actors/AboutWelcomeParent.jsm",
@@ -1424,6 +1442,8 @@ BrowserGlue.prototype = {
      lazy.Normandy.init();
    }

    lazy.checkHomepageOverride();

    AboutHomeStartupCache.init();

    Services.obs.notifyObservers(null, "browser-ui-startup-complete");
+35 −0
Original line number Diff line number Diff line
export class AboutTorChild extends JSWindowActorChild {
  actorCreated() {
    if (this.contentWindow.matchMedia("not (prefers-contrast)").matches) {
      // When prefers-contrast is not set, the page only has one style because
      // we always set a dark background and a light <form>.
      // We force prefers-color-scheme to be light, regardless of the user's
      // settings so that we inherit the "light" theme styling from
      // in-content/common.css for the <form> element. In particular, we want
      // the light styling for the <input> and <moz-toggle> elements, which are
      // on a light background.
      this.browsingContext.prefersColorSchemeOverride = "light";
    }
  }

  handleEvent(event) {
    switch (event.type) {
      case "DOMContentLoaded":
        this.sendQuery("AboutTor:GetInitialData").then(data => {
          const initialDataEvent = new this.contentWindow.CustomEvent(
            "InitialData",
            { detail: Cu.cloneInto(data, this.contentWindow) }
          );
          this.contentWindow.dispatchEvent(initialDataEvent);
        });
        break;
      case "SubmitSearchOnionize":
        this.sendAsyncMessage("AboutTor:SetSearchOnionize", !!event.detail);
        break;
      case "SurveyDismissed":
        // event.detail is the survey version.
        this.sendAsyncMessage("AboutTor:SurveyDismissed", event.detail);
        break;
    }
  }
}
Loading