Commit 3b5f3dbd authored by Richard Pospesel's avatar Richard Pospesel Committed by Georg Koppen
Browse files

Bug 25658: Replace security slider with security level UI

This patch adds a new 'securitylevel' component to Tor Browser intended
to replace the torbutton 'Security Slider'.

This component adds a new Security Level toolbar button which visually
indicates the current global security level via icon (as defined by the
extensions.torbutton.security_slider pref), a drop-down hanger with a
short description of the current security level, and a new section in
the about:preferences#privacy page where users can change their current
security level. In addition, the hanger and the preferences page will
show a visual warning when the user has modified prefs associated with
the security level and provide a one-click 'Restore Defaults' button to
get the user back on recommended settings.

Strings used by this patch are pulled from the torbutton extension, but
en-US defaults are provided if there is an error loading from the
extension. With this patch applied, the usual work-flow of "./mach build
&& ./mach run" work as expected, even if the torbutton extension is
disabled.
parent 22bbd78e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -271,7 +271,7 @@ pref("extensions.legacy.exceptions", "{972ce4c6-7e08-4474-a285-3208198ce6fd},tor
pref("extensions.webextensions.restrictedDomains", "");

// Toolbar layout
pref("browser.uiCustomization.state", "{\"placements\":{\"widget-overflow-fixed-list\":[],\"PersonalToolbar\":[\"personal-bookmarks\"],\"nav-bar\":[\"torbutton-button\",\"back-button\",\"forward-button\",\"stop-reload-button\",\"urlbar-container\",\"downloads-button\",\"_73a6fe31-595d-460b-a920-fcc0f8843232_-browser-action\"],\"TabsToolbar\":[\"tabbrowser-tabs\",\"new-tab-button\",\"alltabs-button\"],\"toolbar-menubar\":[\"menubar-items\"],\"PanelUI-contents\":[\"home-button\",\"edit-controls\",\"zoom-controls\",\"new-window-button\",\"save-page-button\",\"print-button\",\"bookmarks-menu-button\",\"history-panelmenu\",\"find-button\",\"preferences-button\",\"add-ons-button\",\"developer-button\",\"https-everywhere-button\"],\"addon-bar\":[\"addonbar-closebutton\",\"status-bar\"]},\"seen\":[\"developer-button\",\"https-everywhere_eff_org-browser-action\",\"_73a6fe31-595d-460b-a920-fcc0f8843232_-browser-action\"],\"dirtyAreaCache\":[\"PersonalToolbar\",\"nav-bar\",\"TabsToolbar\",\"toolbar-menubar\"],\"currentVersion\":14,\"newElementCount\":1}");
pref("browser.uiCustomization.state", "{\"placements\":{\"widget-overflow-fixed-list\":[],\"PersonalToolbar\":[\"personal-bookmarks\"],\"nav-bar\":[\"back-button\",\"forward-button\",\"stop-reload-button\",\"urlbar-container\",\"downloads-button\",\"torbutton-button\",\"security-level-button\"],\"TabsToolbar\":[\"tabbrowser-tabs\",\"new-tab-button\",\"alltabs-button\"],\"toolbar-menubar\":[\"menubar-items\"],\"PanelUI-contents\":[\"home-button\",\"edit-controls\",\"zoom-controls\",\"new-window-button\",\"save-page-button\",\"print-button\",\"bookmarks-menu-button\",\"history-panelmenu\",\"find-button\",\"preferences-button\",\"add-ons-button\",\"developer-button\"],\"addon-bar\":[\"addonbar-closebutton\",\"status-bar\"]},\"seen\":[\"developer-button\",\"https-everywhere-eff_eff_org-browser-action\",\"_73a6fe31-595d-460b-a920-fcc0f8843232_-browser-action\"],\"dirtyAreaCache\":[\"PersonalToolbar\",\"nav-bar\",\"TabsToolbar\",\"toolbar-menubar\"],\"currentVersion\":14,\"newElementCount\":1}");

// Putting the search engine prefs into this file to fix #11236.
// Default search engine
+7 −0
Original line number Diff line number Diff line
@@ -116,6 +116,8 @@ XPCOMUtils.defineLazyScriptGetter(this, ["DownloadsPanel",
XPCOMUtils.defineLazyScriptGetter(this, ["DownloadsButton",
                                         "DownloadsIndicatorView"],
                                  "chrome://browser/content/downloads/indicator.js");
XPCOMUtils.defineLazyScriptGetter(this, ["SecurityLevelButton"],
                                  "chrome://browser/content/securitylevel/securityLevel.js");
XPCOMUtils.defineLazyScriptGetter(this, "gEditItemOverlay",
                                  "chrome://browser/content/places/editBookmarkOverlay.js");
if (AppConstants.NIGHTLY_BUILD) {
@@ -1328,6 +1330,9 @@ var gBrowserInit = {
    // doesn't flicker as the window is being shown.
    DownloadsButton.init();

    // Init the SecuritySettingsButton
    SecurityLevelButton.init();

    // Certain kinds of automigration rely on this notification to complete
    // their tasks BEFORE the browser window is shown. SessionStore uses it to
    // restore tabs into windows AFTER important parts like gMultiProcessBrowser
@@ -1899,6 +1904,8 @@ var gBrowserInit = {

    DownloadsButton.uninit();

    SecurityLevelButton.uninit();

    gAccessibilityServiceIndicator.uninit();

    LanguagePrompt.uninit();
+5 −0
Original line number Diff line number Diff line
@@ -8,6 +8,8 @@

<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/downloads/downloads.css"?>
<?xml-stylesheet href="chrome://browser/content/securitylevel/securityLevelPanel.css"?>
<?xml-stylesheet href="chrome://browser/content/securitylevel/securityLevelButton.css"?>
<?xml-stylesheet href="chrome://browser/content/places/places.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/usercontext/usercontext.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/controlcenter/panel.css" type="text/css"?>
@@ -500,6 +502,7 @@
#include ../../components/customizableui/content/panelUI.inc.xul
#include ../../components/controlcenter/content/panel.inc.xul
#include ../../components/downloads/content/downloadsPanel.inc.xul
#include ../../components/securitylevel/content/securityLevelPanel.inc.xul

    <hbox id="downloads-animation-container" mousethrough="always">
      <vbox id="downloads-notification-anchor" hidden="true">
@@ -954,6 +957,8 @@
            </stack>
          </toolbarbutton>

#include ../../components/securitylevel/content/securityLevelButton.inc.xul

        <toolbarbutton id="library-button" class="toolbarbutton-1 chromeclass-toolbar-additional subviewbutton-nav"
                       removable="true"
                       onmousedown="PanelUI.showSubView('appMenu-libraryView', this, event);"
+1 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ DIRS += [
    'privatebrowsing',
    'resistfingerprinting',
    'search',
    'securitylevel',
    'sessionstore',
    'shell',
    'syncedtabs',
+14 −4
Original line number Diff line number Diff line
@@ -224,10 +224,20 @@ async function spotlight(subcategory) {
  }
  if (subcategory) {
    if (!gSearchResultsPane.categoriesInitialized) {
      // fix for tor #29554
      // for some reason this code throws an exception when called and
      // prevents the scrollAndHighlight code from running so we
      // swallow the exception here
      //
      // This entire block has been removed and/or refactored as part of
      // mozilla #1520350 (commit d524c53377c22913cac387ad77b803aaf4fb754e)
      // on 2019/01/28
      try {
        await waitForSystemAddonInjectionsFinished([{
          isGoingToInject: formAutofillParent.initialized,
          elementId: "formAutofillGroup",
        }]);
      } catch (e) { }
    }
    scrollAndHighlight(subcategory);
  }
Loading