Verified Commit fb381b64 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃
Browse files

Bug 41352: Always show the link to the manual in about:tor

parent 88803b52
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@

const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");

const { bindPrefAndInit, show_torbrowser_manual } = ChromeUtils.import(
const { bindPrefAndInit } = ChromeUtils.import(
  "resource://torbutton/modules/utils.js"
);

@@ -95,12 +95,6 @@ var AboutTorListener = {
      body.removeAttribute("toron");
    }

    if (show_torbrowser_manual()) {
      body.setAttribute("showmanual", "yes");
    } else {
      body.removeAttribute("showmanual");
    }

    if (aData.updateChannel) {
      body.setAttribute("updatechannel", aData.updateChannel);
    } else {
+0 −26
Original line number Diff line number Diff line
@@ -10,10 +10,6 @@ const {
  getCharPref,
} = Services.prefs;

let { getLocale, show_torbrowser_manual } = ChromeUtils.import(
  "resource://torbutton/modules/utils.js"
);

// Description elements have the follow names.
const descNames = ["", "desc_standard", "desc_safer", "desc_safest"];
// "Learn-more"-elements have the follow names.
@@ -51,7 +47,6 @@ function torbutton_init_security_ui() {
      getIntPref("extensions.torbutton.security_slider")
    )
  );
  torbutton_set_learn_more_links();
}

// Write the two prefs from the current settings.
@@ -62,24 +57,3 @@ function torbutton_save_security_settings() {
  );
  setBoolPref("extensions.torbutton.security_custom", state.custom);
}

// We follow the way we treat the links to the Tor Browser User Manual on the
// Help Menu and on about:tor: if we have the manual available for a locale,
// let's show the "Learn more"-link, otherwise hide it.
function torbutton_set_learn_more_links() {
  let show_manual = show_torbrowser_manual();
  let locale = "";
  if (show_manual) {
    locale = getLocale();
  }
  let links = linkNames.map(name => document.getElementById(name));
  links.forEach(link => {
    if (show_manual && locale != "") {
      link.href =
        "https:/tb-manual.torproject.org/" + locale + "/security-slider.html";
      link.hidden = false;
    } else {
      link.hidden = true;
    }
  });
}
+0 −18
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ var torbutton_new_circuit;
 */

  let {
    show_torbrowser_manual,
    unescapeTorString,
    bindPrefAndInit,
    getDomainForBrowser,
@@ -275,12 +274,6 @@ var torbutton_new_circuit;
    torbutton_log(1, "registering Tor check observer");
    torbutton_tor_check_observer.register();

    try {
      torbutton_init_user_manual_links();
    } catch (e) {
      torbutton_log(4, "Error loading the user manual " + e);
    }

    // Arrange for our about:tor content script to be loaded in each frame.
    window.messageManager.loadFrameScript(
      "chrome://torbutton/content/aboutTor/aboutTor-content.js",
@@ -1042,16 +1035,5 @@ var torbutton_new_circuit;
    onStatusChange(aProgress, aRequest, stat, message) {},
    onSecurityChange() {},
  };

  // Makes sure the item in the Help Menu and the link in about:tor
  // for the Tor Browser User Manual are only visible when
  // show_torbrowser_manual() returns true.
  function torbutton_init_user_manual_links() {
    let menuitem = document.getElementById("torBrowserUserManual");
    bindPrefAndInit("intl.locale.requested", val => {
      menuitem.hidden = !show_torbrowser_manual();
      torbutton_abouttor_message_handler.updateAllOpenPages();
    });
  }
})();
//vim:set ts=4
+1 −2
Original line number Diff line number Diff line
@@ -112,8 +112,7 @@ body:not([toron]) .hideIfTorOff {
  display: none;
}

body:not([hasbeenupdated]) .showIfHasBeenUpdated,
body:not([showmanual]) .showForManual {
body:not([hasbeenupdated]) .showIfHasBeenUpdated {
  display: none;
}

+0 −7
Original line number Diff line number Diff line
@@ -208,13 +208,6 @@ var unescapeTorString = function(str) {
  return _torControl._strUnescape(str);
};

// Returns true if we should show the tor browser manual.
var show_torbrowser_manual = () => {
  let availableLocales = ["de", "en", "es", "fr", "nl", "pt", "tr", "vi", "zh"];
  let shortLocale = getLocale().substring(0, 2);
  return availableLocales.includes(shortLocale);
};

var getFPDFromHost = hostname => {
  try {
    return Services.eTLD.getBaseDomainFromHost(hostname);