[tbb-commits] [tor-browser] 71/90: Bug 10760: Integrate TorButton to TorBrowser core

gitolite role git at cupani.torproject.org
Tue Nov 22 09:58:46 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch tor-browser-102.5.0esr-12.0-1
in repository tor-browser.

commit 5c870292de903b901cae9a370a17c1ce6d87fe95
Author: Alex Catarineu <acat at torproject.org>
AuthorDate: Wed Feb 19 23:05:08 2020 +0100

    Bug 10760: Integrate TorButton to TorBrowser core
    
    Because of the non-restartless nature of Torbutton, it required
    a two-stage installation process. On mobile, it was a problem,
    because it was not loading when the user opened the browser for
    the first time.
    
    Moving it to tor-browser and making it a system extension allows it
    to load when the user opens the browser for first time.
    
    Additionally, this patch also fixes Bug 27611.
    
    Bug 26321: New Circuit and New Identity menu items
    
    Bug 14392: Make about:tor behave like other initial pages.
    
    Bug 25013: Add torbutton as a tor-browser submodule
    
    Bug 31575: Replace Firefox Home (newtab) with about:tor
    
    Avoid loading AboutNewTab in BrowserGlue.jsm in order
    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.
---
 .gitmodules                                        |  3 ++
 browser/base/content/aboutDialog.xhtml             | 40 ++++++++++++++------
 browser/base/content/appmenu-viewcache.inc.xhtml   | 11 +++++-
 browser/base/content/browser-doctype.inc           |  8 ++++
 browser/base/content/browser-menubar.inc           | 44 +++++++++++++++-------
 browser/base/content/browser-sets.inc              |  1 +
 browser/base/content/browser.js                    |  1 +
 browser/base/content/browser.xhtml                 | 13 +++++++
 browser/base/content/hiddenWindowMac.xhtml         |  4 ++
 browser/base/content/navigator-toolbox.inc.xhtml   |  5 +++
 browser/base/content/pageinfo/pageInfo.xhtml       |  6 +++
 browser/components/BrowserGlue.jsm                 | 33 +---------------
 .../controlcenter/content/identityPanel.inc.xhtml  | 22 +++++++++++
 browser/components/newtab/AboutNewTabService.jsm   | 15 +-------
 browser/components/places/content/places.xhtml     |  3 ++
 browser/components/preferences/home.inc.xhtml      |  4 +-
 browser/components/preferences/preferences.xhtml   |  5 ++-
 .../shell/content/setDesktopBackground.xhtml       |  6 +++
 browser/installer/package-manifest.in              |  2 +
 browser/modules/HomePage.jsm                       |  2 +-
 browser/themes/shared/icons/new_circuit.svg        |  6 +++
 browser/themes/shared/jar.inc.mn                   |  2 +
 browser/themes/shared/toolbarbutton-icons.css      |  4 ++
 docshell/base/nsAboutRedirector.cpp                |  6 ++-
 docshell/build/components.conf                     |  1 +
 mobile/android/installer/package-manifest.in       |  4 ++
 toolkit/moz.build                                  |  1 +
 toolkit/torproject/torbutton                       |  1 +
 .../lib/environments/browser-window.js             |  6 ++-
 29 files changed, 181 insertions(+), 78 deletions(-)

diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 000000000000..2f03bd8e22df
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "toolkit/torproject/torbutton"]
+	path = toolkit/torproject/torbutton
+	url = https://git.torproject.org/torbutton.git
diff --git a/browser/base/content/aboutDialog.xhtml b/browser/base/content/aboutDialog.xhtml
index 90a568a17dd6..60b1e15b637c 100644
--- a/browser/base/content/aboutDialog.xhtml
+++ b/browser/base/content/aboutDialog.xhtml
@@ -7,6 +7,12 @@
 <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
 <?xml-stylesheet href="chrome://browser/content/aboutDialog.css" type="text/css"?>
 <?xml-stylesheet href="chrome://branding/content/aboutDialog.css" type="text/css"?>
+<?xml-stylesheet href="chrome://torbutton/skin/aboutDialog.css" type="text/css"?>
+
+<!-- We need to include the localization DTDs until we migrate to Fluent -->
+<!DOCTYPE window [
+#include browser-doctype.inc
+]>
 
 <window xmlns:html="http://www.w3.org/1999/xhtml"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
@@ -22,7 +28,7 @@
         data-l10n-id="aboutDialog-title"
 #endif
         role="dialog"
-        aria-describedby="version distribution distributionId communityDesc contributeDesc trademark"
+        aria-describedby="version distribution distributionId projectDesc helpDesc trademark trademarkTor"
         >
 #ifdef XP_MACOSX
 #include macWindow.inc.xhtml
@@ -140,24 +146,36 @@
               <label is="text-link" useoriginprincipal="true" href="about:credits" data-l10n-name="community-exp-creditsLink"/>
             </description>
           </vbox>
-          <description class="text-blurb" id="communityDesc" data-l10n-id="community-2">
-            <label is="text-link" href="https://www.mozilla.org/?utm_source=firefox-browser&utm_medium=firefox-desktop&utm_campaign=about-dialog" data-l10n-name="community-mozillaLink"/>
-            <label is="text-link" useoriginprincipal="true" href="about:credits" data-l10n-name="community-creditsLink"/>
+          <!-- Keep communityDesc and contributeDesc to avoid JS errors trying to hide them -->
+          <description class="text-blurb" id="communityDesc" data-l10n-id="community-2" hidden="true"></description>
+          <description class="text-blurb" id="contributeDesc" data-l10n-id="helpus" hidden="true"></description>
+          <description class="text-blurb" id="projectDesc">
+            &project.start;
+            <label is="text-link" href="https://www.torproject.org/">
+              &project.tpoLink;
+            </label>&project.end;
           </description>
-          <description class="text-blurb" id="contributeDesc" data-l10n-id="helpus">
-            <label is="text-link" href="https://donate.mozilla.org/?utm_source=firefox&utm_medium=referral&utm_campaign=firefox_about&utm_content=firefox_about" data-l10n-name="helpus-donateLink"/>
-            <label is="text-link" href="https://www.mozilla.org/contribute/?utm_source=firefox-browser&utm_medium=firefox-desktop&utm_campaign=about-dialog" data-l10n-name="helpus-getInvolvedLink"/>
+          <description class="text-blurb" id="helpDesc">
+            &help.start;
+            <label is="text-link" href="https://donate.torproject.org/">
+              &help.donateLink;
+            </label>
+            &help.or;
+            <label is="text-link" href="https://community.torproject.org/">
+              &help.getInvolvedLink;
+            </label>&help.end;
           </description>
         </vbox>
       </vbox>
     </hbox>
     <vbox id="bottomBox">
-      <hbox pack="center">
-        <label is="text-link" class="bottom-link" useoriginprincipal="true" href="about:license" data-l10n-id="bottomLinks-license"/>
-        <label is="text-link" class="bottom-link" useoriginprincipal="true" href="about:rights" data-l10n-id="bottomLinks-rights"/>
-        <label is="text-link" class="bottom-link" href="https://www.mozilla.org/privacy/?utm_source=firefox-browser&utm_medium=firefox-desktop&utm_campaign=about-dialog" data-l10n-id="bottomLinks-privacy"/>
+      <hbox id="newBottom" pack="center" position="1">
+        <label is="text-link" class="bottom-link" href="https://support.torproject.org/">&bottomLinks.questions;</label>
+        <label is="text-link" class="bottom-link" href="https://community.torproject.org/relay/">&bottomLinks.grow;</label>
+        <label is="text-link" class="bottom-link" useoriginprincipal="true" href="about:license">&bottomLinks.license;</label>
       </hbox>
       <description id="trademark" data-l10n-id="trademarkInfo"></description>
+      <description id="trademarkTor">&tor.TrademarkStatement;</description>
     </vbox>
   </vbox>
 
diff --git a/browser/base/content/appmenu-viewcache.inc.xhtml b/browser/base/content/appmenu-viewcache.inc.xhtml
index c138be3ee86c..cb685a3d0f52 100644
--- a/browser/base/content/appmenu-viewcache.inc.xhtml
+++ b/browser/base/content/appmenu-viewcache.inc.xhtml
@@ -55,11 +55,17 @@
                      class="subviewbutton"
                      data-l10n-id="appmenuitem-new-private-window"
                      key="key_privatebrowsing"
-                     command="Tools:PrivateBrowsing"/>
+                     command="Tools:PrivateBrowsing"
+                     hidden="true"/>
       <toolbarseparator/>
       <toolbarbutton id="appMenu-new-identity"
                      class="subviewbutton"
                      key="new-identity-key"/>
+      <toolbarbutton id="appMenuNewCircuit"
+                     class="subviewbutton"
+                     key="torbutton-new-circuit-key"
+                     label="&torbutton.context_menu.new_circuit_sentence_case;"
+                     oncommand="torbutton_new_circuit();"/>
       <toolbarseparator/>
       <toolbarbutton id="appMenu-bookmarks-button"
                      class="subviewbutton subviewbutton-nav"
@@ -179,7 +185,8 @@
       <toolbarbutton id="appMenu-restoreSession"
                      data-l10n-id="appmenu-restore-session"
                      class="subviewbutton"
-                     command="Browser:RestoreLastSession"/>
+                     command="Browser:RestoreLastSession"
+                     hidden="true"/>
       <toolbarseparator/>
       <toolbarbutton id="appMenuClearRecentHistory"
                      data-l10n-id="appmenu-clear-history"
diff --git a/browser/base/content/browser-doctype.inc b/browser/base/content/browser-doctype.inc
new file mode 100644
index 000000000000..fdc302e79de3
--- /dev/null
+++ b/browser/base/content/browser-doctype.inc
@@ -0,0 +1,8 @@
+<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
+%brandDTD;
+<!ENTITY % torbuttonDTD SYSTEM "chrome://torbutton/locale/torbutton.dtd">
+%torbuttonDTD;
+<!ENTITY % aboutTorDTD SYSTEM "chrome://torbutton/locale/aboutTor.dtd">
+%aboutTorDTD;
+<!ENTITY % aboutDialogDTD SYSTEM "chrome://torbutton/locale/aboutDialog.dtd">
+%aboutDialogDTD;
diff --git a/browser/base/content/browser-menubar.inc b/browser/base/content/browser-menubar.inc
index 7c3dd4fe6d25..dad713362661 100644
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
@@ -31,6 +31,11 @@
                 <menuseparator/>
                 <menuitem id="menu_newIdentity"
                           key="new-identity-key"/>
+                <menuitem id="menu_newCircuit"
+                          accesskey="&torbutton.context_menu.new_circuit_key;"
+                          key="torbutton-new-circuit-key"
+                          label="&torbutton.context_menu.new_circuit;"
+                          oncommand="torbutton_new_circuit();"/>
                 <menuseparator/>
                 <menuitem id="menu_openLocation"
                           hidden="true"
@@ -456,44 +461,55 @@
               <menupopup id="menu_HelpPopup" onpopupshowing="buildHelpMenu();">
 <!-- Note: Items under here are cloned to the AppMenu Help submenu. The cloned items
      have their strings defined by appmenu-data-l10n-id. -->
-                <menuitem id="menu_openHelp"
+                <!-- dummy elements to avoid 'getElementById' errors -->
+                <box id="feedbackPage"/>
+                <box id="helpSafeMode"/>
+                <box id="menu_HelpPopup_reportPhishingtoolmenu"/>
+                <box id="menu_HelpPopup_reportPhishingErrortoolmenu"/>
+                <!-- Add Tor Browser manual link -->
+                <menuitem id="torBrowserUserManual"
+                          oncommand="gBrowser.selectedTab = gBrowser.addTab('about:manual', {triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal()});"
+                          label="&aboutTor.torbrowser_user_manual.label;"
+                          accesskey="&aboutTor.torbrowser_user_manual.accesskey;"/>
+                <!-- Bug 18905: Hide unused help menu items -->
+                <!-- <menuitem id="menu_openHelp"
                           oncommand="openHelpLink('firefox-help')"
                           data-l10n-id="menu-get-help"
                           appmenu-data-l10n-id="appmenu-get-help"
 #ifdef XP_MACOSX
-                          key="key_openHelpMac"/>
+                          key="key_openHelpMac"/> -->
 #else
-                          />
+                          /> -->
 #endif
-                <menuitem id="feedbackPage"
+                <!-- <menuitem id="feedbackPage"
                           oncommand="openFeedbackPage()"
-                          data-l10n-id="menu-help-share-ideas"
-                          appmenu-data-l10n-id="appmenu-help-share-ideas"/>
-                <menuitem id="helpSafeMode"
+                          data-l10n-id="menu-help-feedback-page"
+                          appmenu-data-l10n-id="appmenu-help-feedback-page"/> -->
+                <!-- <menuitem id="helpSafeMode"
                           oncommand="safeModeRestart();"
                           data-l10n-id="menu-help-enter-troubleshoot-mode2"
-                          appmenu-data-l10n-id="appmenu-help-enter-troubleshoot-mode2"/>
-                <menuitem id="troubleShooting"
+                          appmenu-data-l10n-id="appmenu-help-enter-troubleshoot-mode2"/> -->
+                <!-- <menuitem id="troubleShooting"
                           oncommand="openTroubleshootingPage()"
                           data-l10n-id="menu-help-more-troubleshooting-info"
-                          appmenu-data-l10n-id="appmenu-help-more-troubleshooting-info"/>
+                          appmenu-data-l10n-id="appmenu-help-more-troubleshooting-info"/> -->
                 <menuitem id="help_reportSiteIssue"
                           oncommand="ReportSiteIssue();"
                           data-l10n-id="menu-help-report-site-issue"
                           appmenu-data-l10n-id="appmenu-help-report-site-issue"
                           hidden="true"/>
-                <menuitem id="menu_HelpPopup_reportPhishingtoolmenu"
+                <!-- <menuitem id="menu_HelpPopup_reportPhishingtoolmenu"
                           disabled="true"
                           oncommand="openUILink(gSafeBrowsing.getReportURL('Phish'), event, {triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({})});"
                           hidden="true"
                           data-l10n-id="menu-help-report-deceptive-site"
-                          appmenu-data-l10n-id="appmenu-help-report-deceptive-site"/>
-                <menuitem id="menu_HelpPopup_reportPhishingErrortoolmenu"
+                          appmenu-data-l10n-id="appmenu-help-report-deceptive-site"/> -->
+                <!-- <menuitem id="menu_HelpPopup_reportPhishingErrortoolmenu"
                           disabled="true"
                           oncommand="ReportFalseDeceptiveSite();"
                           data-l10n-id="menu-help-not-deceptive"
                           appmenu-data-l10n-id="appmenu-help-not-deceptive"
-                          hidden="true"/>
+                          hidden="true"/> -->
                 <menuseparator id="aboutSeparator"/>
                 <menuitem id="aboutName"
                           oncommand="openAboutDialog();"
diff --git a/browser/base/content/browser-sets.inc b/browser/base/content/browser-sets.inc
index 17edb35baf6a..dc5d93978950 100644
--- a/browser/base/content/browser-sets.inc
+++ b/browser/base/content/browser-sets.inc
@@ -389,4 +389,5 @@
          internal="true"/>
 #endif
     <key id="new-identity-key" modifiers="accel shift" key="U" oncommand="NewIdentityButton.onCommand(event)"/>
+    <key id="torbutton-new-circuit-key" modifiers="accel shift" key="L" oncommand="torbutton_new_circuit()"/>
   </keyset>
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index ee392d55b572..597bff687349 100644
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -645,6 +645,7 @@ var gPageIcons = {
 };
 
 var gInitialPages = [
+  "about:tor",
   "about:blank",
   "about:home",
   ...(AppConstants.NIGHTLY_BUILD ? ["about:firefoxview"] : []),
diff --git a/browser/base/content/browser.xhtml b/browser/base/content/browser.xhtml
index df33143a7365..5959615f9dc1 100644
--- a/browser/base/content/browser.xhtml
+++ b/browser/base/content/browser.xhtml
@@ -35,6 +35,12 @@
 <?xml-stylesheet href="chrome://browser/skin/searchbar.css" type="text/css"?>
 <?xml-stylesheet href="chrome://browser/skin/places/tree-icons.css" type="text/css"?>
 <?xml-stylesheet href="chrome://browser/skin/places/editBookmark.css" type="text/css"?>
+<?xml-stylesheet href="chrome://torbutton/skin/tor-circuit-display.css" type="text/css"?>
+<?xml-stylesheet href="chrome://torbutton/skin/torbutton.css" type="text/css"?>
+
+<!DOCTYPE window [
+#include browser-doctype.inc
+]>
 
 <html id="main-window"
         xmlns:html="http://www.w3.org/1999/xhtml"
@@ -116,11 +122,18 @@
   Services.scriptloader.loadSubScript("chrome://browser/content/search/autocomplete-popup.js", this);
   Services.scriptloader.loadSubScript("chrome://browser/content/search/searchbar.js", this);
   Services.scriptloader.loadSubScript("chrome://browser/content/languageNotification.js", this);
+  Services.scriptloader.loadSubScript("chrome://torbutton/content/tor-circuit-display.js", this);
+  Services.scriptloader.loadSubScript("chrome://torbutton/content/torbutton.js", this);
 
   window.onload = gBrowserInit.onLoad.bind(gBrowserInit);
   window.onunload = gBrowserInit.onUnload.bind(gBrowserInit);
   window.onclose = WindowIsClosing;
 
+  //onLoad Handler
+  try {
+    window.addEventListener("load", torbutton_init, false);
+  } catch (e) {}
+
   window.addEventListener("MozBeforeInitialXULLayout",
     gBrowserInit.onBeforeInitialXULLayout.bind(gBrowserInit), { once: true });
 
diff --git a/browser/base/content/hiddenWindowMac.xhtml b/browser/base/content/hiddenWindowMac.xhtml
index c27d394d3707..b272a076bb30 100644
--- a/browser/base/content/hiddenWindowMac.xhtml
+++ b/browser/base/content/hiddenWindowMac.xhtml
@@ -8,6 +8,10 @@
 
 <?xml-stylesheet href="chrome://browser/skin/webRTC-menubar-indicator.css" type="text/css"?>
 
+<!DOCTYPE window [
+#include browser-doctype.inc
+]>
+
 <window id="main-window"
         xmlns:html="http://www.w3.org/1999/xhtml"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
diff --git a/browser/base/content/navigator-toolbox.inc.xhtml b/browser/base/content/navigator-toolbox.inc.xhtml
index cadf68c91679..6123e1336aed 100644
--- a/browser/base/content/navigator-toolbox.inc.xhtml
+++ b/browser/base/content/navigator-toolbox.inc.xhtml
@@ -539,6 +539,11 @@
 
     <toolbarbutton id="new-identity-button" class="toolbarbutton-1 chromeclass-toolbar-additional"/>
 
+    <toolbarbutton id="new-circuit-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
+                   label="&torbutton.context_menu.new_circuit;"
+                   oncommand="torbutton_new_circuit();"
+                   tooltiptext="&torbutton.context_menu.new_circuit;"/>
+
     <toolbarbutton id="fullscreen-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
                    observes="View:FullScreen"
                    type="checkbox"
diff --git a/browser/base/content/pageinfo/pageInfo.xhtml b/browser/base/content/pageinfo/pageInfo.xhtml
index 4fe7f4909180..b2b09f753902 100644
--- a/browser/base/content/pageinfo/pageInfo.xhtml
+++ b/browser/base/content/pageinfo/pageInfo.xhtml
@@ -6,6 +6,12 @@
 <?xml-stylesheet href="chrome://browser/content/pageinfo/pageInfo.css" type="text/css"?>
 <?xml-stylesheet href="chrome://browser/skin/pageInfo.css" type="text/css"?>
 
+<!DOCTYPE window [
+#ifdef XP_MACOSX
+#include ../browser-doctype.inc
+#endif
+]>
+
 <window id="main-window"
   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
   xmlns:html="http://www.w3.org/1999/xhtml"
diff --git a/browser/components/BrowserGlue.jsm b/browser/components/BrowserGlue.jsm
index 99b289bd934a..6d0947a464ba 100644
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -18,7 +18,6 @@ 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",
@@ -225,28 +224,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",
@@ -1599,8 +1576,6 @@ BrowserGlue.prototype = {
 
   // the first browser window has finished initializing
   _onFirstWindowLoaded: function BG__onFirstWindowLoaded(aWindow) {
-    AboutNewTab.init();
-
     TabCrashHandler.init();
 
     ProcessHangMonitor.init();
@@ -5792,12 +5767,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 in Tor Browser.");
+    return { pageInputStream: null, scriptInputStream: null };
   },
 
   /**
diff --git a/browser/components/controlcenter/content/identityPanel.inc.xhtml b/browser/components/controlcenter/content/identityPanel.inc.xhtml
index ad6f9db340ef..498f374ffde8 100644
--- a/browser/components/controlcenter/content/identityPanel.inc.xhtml
+++ b/browser/components/controlcenter/content/identityPanel.inc.xhtml
@@ -92,6 +92,28 @@
         </vbox>
       </hbox>
 
+      <!-- Circuit display section -->
+
+      <vbox id="circuit-display-container" class="identity-popup-section">
+        <toolbarseparator/>
+        <vbox id="circuit-display-header" flex="1" role="group"
+              aria-labelledby="circuit-display-headline">
+          <hbox flex="1">
+            <label id="circuit-display-headline"
+                   role="heading" aria-level="2">&torbutton.circuit_display.title;</label>
+          </hbox>
+        </vbox>
+        <vbox id="circuit-display-content">
+          <html:ul id="circuit-display-nodes" dir="auto"/>
+          <hbox id="circuit-guard-note-container"/>
+          <hbox id="circuit-reload-button-container">
+            <html:button id="circuit-reload-button"
+                    onclick="torbutton_new_circuit()"
+                    default="true">&torbutton.circuit_display.new_circuit;</html:button>
+          </hbox>
+        </vbox>
+      </vbox>
+
       <!-- Clear Site Data Button -->
       <vbox hidden="true"
             id="identity-popup-clear-sitedata-footer">
diff --git a/browser/components/newtab/AboutNewTabService.jsm b/browser/components/newtab/AboutNewTabService.jsm
index f3bc40019f8f..471a3139baa7 100644
--- a/browser/components/newtab/AboutNewTabService.jsm
+++ b/browser/components/newtab/AboutNewTabService.jsm
@@ -420,20 +420,7 @@ class BaseAboutNewTabService {
    * 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/activity-stream.html"
-    // "resource://activity-stream/prerendered/activity-stream-debug.html"
-    // "resource://activity-stream/prerendered/activity-stream-noscripts.html"
-    return [
-      "resource://activity-stream/prerendered/",
-      "activity-stream",
-      // Debug version loads dev scripts but noscripts separately loads scripts
-      this.activityStreamDebug && !this.privilegedAboutProcessEnabled
-        ? "-debug"
-        : "",
-      this.privilegedAboutProcessEnabled ? "-noscripts" : "",
-      ".html",
-    ].join("");
+    return "about:tor";
   }
 
   get welcomeURL() {
diff --git a/browser/components/places/content/places.xhtml b/browser/components/places/content/places.xhtml
index e19a58029828..f55d813664f6 100644
--- a/browser/components/places/content/places.xhtml
+++ b/browser/components/places/content/places.xhtml
@@ -18,6 +18,9 @@
 <!DOCTYPE window [
 <!ENTITY % editMenuOverlayDTD SYSTEM "chrome://global/locale/editMenuOverlay.dtd">
 %editMenuOverlayDTD;
+#ifdef XP_MACOSX
+#include ../../../base/content/browser-doctype.inc
+#endif
 ]>
 
 <window id="places"
diff --git a/browser/components/preferences/home.inc.xhtml b/browser/components/preferences/home.inc.xhtml
index 5bb936782ed9..e812d969837e 100644
--- a/browser/components/preferences/home.inc.xhtml
+++ b/browser/components/preferences/home.inc.xhtml
@@ -33,7 +33,7 @@
                 class="check-home-page-controlled"
                 data-preference-related="browser.startup.homepage">
         <menupopup>
-          <menuitem value="0" data-l10n-id="home-mode-choice-default" />
+          <menuitem value="0" label="&aboutTor.title;" />
           <menuitem value="2" data-l10n-id="home-mode-choice-custom" />
           <menuitem value="1" data-l10n-id="home-mode-choice-blank" />
         </menupopup>
@@ -84,7 +84,7 @@
         Preferences so we need to handle setting the pref manually.-->
       <menulist id="newTabMode" flex="1" data-preference-related="browser.newtabpage.enabled">
         <menupopup>
-          <menuitem value="0" data-l10n-id="home-mode-choice-default" />
+          <menuitem value="0" label="&aboutTor.title;" />
           <menuitem value="1" data-l10n-id="home-mode-choice-blank" />
         </menupopup>
       </menulist>
diff --git a/browser/components/preferences/preferences.xhtml b/browser/components/preferences/preferences.xhtml
index 8706870466fa..f1a8115843a3 100644
--- a/browser/components/preferences/preferences.xhtml
+++ b/browser/components/preferences/preferences.xhtml
@@ -15,7 +15,10 @@
 <?xml-stylesheet href="chrome://browser/skin/preferences/privacy.css"?>
 <?xml-stylesheet href="chrome://browser/content/securitylevel/securityLevelPreferences.css"?>
 
-<!DOCTYPE html>
+<!DOCTYPE html [
+<!ENTITY % aboutTorDTD SYSTEM "chrome://torbutton/locale/aboutTor.dtd">
+  %aboutTorDTD;
+]>
 
 <html xmlns="http://www.w3.org/1999/xhtml"
         xmlns:html="http://www.w3.org/1999/xhtml"
diff --git a/browser/components/shell/content/setDesktopBackground.xhtml b/browser/components/shell/content/setDesktopBackground.xhtml
index a7d4ced792b6..ef102450ff2c 100644
--- a/browser/components/shell/content/setDesktopBackground.xhtml
+++ b/browser/components/shell/content/setDesktopBackground.xhtml
@@ -7,6 +7,12 @@
 <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
 <?xml-stylesheet href="chrome://browser/skin/setDesktopBackground.css" type="text/css"?>
 
+<!DOCTYPE window [
+#ifdef XP_MACOSX
+#include ../../../base/content/browser-doctype.inc
+#endif
+]>
+
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         windowtype="Shell:SetDesktopBackground"
diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in
index cb7891d5b43e..04acc38fa5cf 100644
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -235,6 +235,8 @@
 @RESPATH@/chrome/pdfjs.manifest
 @RESPATH@/chrome/pdfjs/*
 @RESPATH@/components/tor-launcher.manifest
+ at RESPATH@/chrome/torbutton.manifest
+ at RESPATH@/chrome/torbutton/*
 @RESPATH@/chrome/toolkit at JAREXT@
 @RESPATH@/chrome/toolkit.manifest
 #ifdef MOZ_GTK
diff --git a/browser/modules/HomePage.jsm b/browser/modules/HomePage.jsm
index f73b0f3e6c8c..26618374df3a 100644
--- a/browser/modules/HomePage.jsm
+++ b/browser/modules/HomePage.jsm
@@ -21,7 +21,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
 });
 
 const kPrefName = "browser.startup.homepage";
-const kDefaultHomePage = "about:home";
+const kDefaultHomePage = "about:tor";
 const kExtensionControllerPref =
   "browser.startup.homepage_override.extensionControlled";
 const kHomePageIgnoreListId = "homepage-urls";
diff --git a/browser/themes/shared/icons/new_circuit.svg b/browser/themes/shared/icons/new_circuit.svg
new file mode 100644
index 000000000000..ddc819946818
--- /dev/null
+++ b/browser/themes/shared/icons/new_circuit.svg
@@ -0,0 +1,6 @@
+<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <g stroke="none" stroke-width="1" fill="context-fill" fill-rule="evenodd" opacity="context-fill-opacity">
+        <path d="m10.707 6h3.993l.3-.3v-3.993c.0002-.09902-.0291-.19586-.084-.27825s-.1331-.14661-.2245-.18453c-.0915-.03792-.1922-.04782-.2893-.02845-.0971.01936-.1863.06713-.2562.13723l-1.459 1.459c-1.2817-1.16743-2.95335-1.813714-4.687-1.812-3.859 0-7 3.141-7 7s3.141 7 7 7c1.74123.007 3.422-.6379 4.7116-1.8079 1.2896-1.1701 2.0945-2.7804 2.2564-4.5141.0156-.1649-.0348-.32927-.1401-.4571s-.2571-.2087-.4219-.2249c-.1644-.01324-.3275.03801-.4548.1429s-.2088.2552-.2272.4191c-.1334 1.42392 [...]
+        <path d="m8 12.5c-2.48528 0-4.5-2.0147-4.5-4.5 0-2.48528 2.01472-4.5 4.5-4.5z"/>
+    </g>
+</svg>
diff --git a/browser/themes/shared/jar.inc.mn b/browser/themes/shared/jar.inc.mn
index d04f95e59ea0..95fe3fdbe299 100644
--- a/browser/themes/shared/jar.inc.mn
+++ b/browser/themes/shared/jar.inc.mn
@@ -266,3 +266,5 @@
   skin/classic/browser/syncedtabs/sidebar.css                  (../shared/syncedtabs/sidebar.css)
 
   skin/classic/browser/new_identity.svg                        (../shared/icons/new_identity.svg)
+
+  skin/classic/browser/new_circuit.svg                         (../shared/icons/new_circuit.svg)
diff --git a/browser/themes/shared/toolbarbutton-icons.css b/browser/themes/shared/toolbarbutton-icons.css
index 8e285fdfd7c2..b2cb4d277e1e 100644
--- a/browser/themes/shared/toolbarbutton-icons.css
+++ b/browser/themes/shared/toolbarbutton-icons.css
@@ -267,6 +267,10 @@ toolbar {
   list-style-image: url("chrome://browser/skin/new_identity.svg");
 }
 
+#new-circuit-button {
+  list-style-image: url("chrome://browser/skin/new_circuit.svg");
+}
+
 #privatebrowsing-button {
   list-style-image: url("chrome://browser/skin/privateBrowsing.svg");
 }
diff --git a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp
index e28bec9bd2c2..232104214844 100644
--- a/docshell/base/nsAboutRedirector.cpp
+++ b/docshell/base/nsAboutRedirector.cpp
@@ -174,7 +174,11 @@ static const RedirEntry kRedirMap[] = {
      nsIAboutModule::HIDE_FROM_ABOUTABOUT |
          nsIAboutModule::URI_CAN_LOAD_IN_CHILD |
          nsIAboutModule::URI_MUST_LOAD_IN_CHILD},
-    {"crashgpu", "about:blank", nsIAboutModule::HIDE_FROM_ABOUTABOUT}};
+    {"crashgpu", "about:blank", nsIAboutModule::HIDE_FROM_ABOUTABOUT},
+    {"tor", "chrome://torbutton/content/aboutTor/aboutTor.xhtml",
+     nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
+         nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
+         nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::IS_SECURE_CHROME_UI}};
 static const int kRedirTotal = mozilla::ArrayLength(kRedirMap);
 
 NS_IMETHODIMP
diff --git a/docshell/build/components.conf b/docshell/build/components.conf
index 5f11df641e37..6bc8617c8f0a 100644
--- a/docshell/build/components.conf
+++ b/docshell/build/components.conf
@@ -29,6 +29,7 @@ about_pages = [
     'srcdoc',
     'support',
     'telemetry',
+    'tor',
     'url-classifier',
     'webrtc',
 ]
diff --git a/mobile/android/installer/package-manifest.in b/mobile/android/installer/package-manifest.in
index d9e8407ade7a..ead4a138d927 100644
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -137,6 +137,10 @@
 ; Base Browser
 @BINPATH@/components/SecurityLevel.manifest
 
+; Torbutton
+ at BINPATH@/chrome/torbutton at JAREXT@
+ at BINPATH@/chrome/torbutton.manifest
+
 ; [Default Preferences]
 ; All the pref files must be part of base to prevent migration bugs
 #ifndef MOZ_ANDROID_FAT_AAR_ARCHITECTURES
diff --git a/toolkit/moz.build b/toolkit/moz.build
index d464f7eb8092..a791014ce2d5 100644
--- a/toolkit/moz.build
+++ b/toolkit/moz.build
@@ -22,6 +22,7 @@ DIRS += [
     "mozapps/preferences",
     "profile",
     "themes",
+    "torproject/torbutton",
 ]
 
 if CONFIG["OS_ARCH"] == "WINNT" and CONFIG["MOZ_DEFAULT_BROWSER_AGENT"]:
diff --git a/toolkit/torproject/torbutton b/toolkit/torproject/torbutton
new file mode 160000
index 000000000000..aadb30c6bcfc
--- /dev/null
+++ b/toolkit/torproject/torbutton
@@ -0,0 +1 @@
+Subproject commit aadb30c6bcfcc1ff0b9dd31fc9f514f06b757fe3
diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js b/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
index c24943e9dee3..de0091ae8d4d 100644
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
@@ -83,7 +83,11 @@ function getGlobalScriptIncludes(scriptPath) {
           "browser/components/screenshots/content/"
         )
         .replace("chrome://browser/content/", "browser/base/content/")
-        .replace("chrome://global/content/", "toolkit/content/");
+        .replace("chrome://global/content/", "toolkit/content/")
+        .replace(
+          "chrome://torbutton/content/",
+          "toolkit/torproject/torbutton/chrome/content/"
+        );
 
       for (let mapping of Object.getOwnPropertyNames(MAPPINGS)) {
         if (sourceFile.includes(mapping)) {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list