Verified Commit 18f025ad authored by henry's avatar henry Committed by Pier Angelo Vendrame
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 ec1ae883
Loading
Loading
Loading
Loading
+4 −0
Changes for browser/base/content/browser-places.js: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1427,6 +1427,10 @@ var BookmarkingUI = {
      newTabURL,
      "about:home",
      "chrome://browser/content/blanktab.html",
      // Add the "about:tor" uri. See tor-browser#41717.
      // NOTE: "about:newtab", "about:welcome", "about:home" and
      // "about:privatebrowsing" can also redirect to "about:tor".
      "about:tor",
    ];
    if (PrivateBrowsingUtils.isWindowPrivate(window)) {
      newTabURLs.push("about:privatebrowsing");
+2 −0
Changes for browser/base/content/browser.js: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -739,6 +739,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",
@@ -746,6 +747,7 @@ var gPageIcons = {
};

var gInitialPages = [
  "about:tor",
  "about:torconnect",
  "about:blank",
  "about:home",
+1 −0
Changes for browser/base/content/utilityOverlay.js: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -78,6 +78,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"
  );
+19 −0
Changes for browser/components/BrowserGlue.sys.mjs: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
  WindowsLaunchOnLogin: "resource://gre/modules/WindowsLaunchOnLogin.sys.mjs",
  WindowsRegistry: "resource://gre/modules/WindowsRegistry.sys.mjs",
  WindowsGPOParser: "resource://gre/modules/policies/WindowsGPOParser.sys.mjs",
  checkHomepageOverride: "resource:///modules/HomepageOverride.sys.mjs",
  clearTimeout: "resource://gre/modules/Timer.sys.mjs",
  setTimeout: "resource://gre/modules/Timer.sys.mjs",
});
@@ -502,6 +503,22 @@ 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 },
      },
    },

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

  // Removed AboutWelcomeShopping. tor-browser#42831.

  AboutWelcome: {
@@ -1572,6 +1589,8 @@ BrowserGlue.prototype = {

    lazy.ResetPBMPanel.init();

    lazy.checkHomepageOverride();

    AboutHomeStartupCache.init();

    Services.obs.notifyObservers(null, "browser-ui-startup-complete");
+34 −0
Changes for browser/components/abouttor/AboutTorChild.sys.mjs: 34 added lines, 0 removed lines.
Original line number Diff line number Diff line
/**
 * Actor child class for the about:tor page.
 */
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;
    }
  }
}
Loading