commit 08ab94d738eb27c0b759275b379c8656521dc96d Author: Mike Perry mikeperry-git@fscked.org Date: Tue May 29 13:57:03 2012 -0700
Bug 3838: Inform Torbutton users about TBB
We launch a confirm dialog when they click on the button. --- src/chrome/content/torbutton.js | 28 ++++++++++++++++++++++++++++ src/chrome/locale/en/torbutton.properties | 1 + src/defaults/preferences/preferences.js | 1 + 3 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js index c714a93..57aaef8 100644 --- a/src/chrome/content/torbutton.js +++ b/src/chrome/content/torbutton.js @@ -629,6 +629,30 @@ function torbutton_prompt_for_language_preference() { m_tb_prefs.setBoolPref("extensions.torbutton.prompted_language", true); }
+function torbutton_inform_about_tbb() { + var prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"] + .getService(Components.interfaces.nsIPromptService); + + var flags = prompts.BUTTON_POS_0 * prompts.BUTTON_TITLE_OK; + + var strings = torbutton_get_stringbundle(); + var message = strings.GetStringFromName("torbutton.popup.prompt_torbrowser"); + var checkbox = {value: false}; + + var sb = Components.classes["@mozilla.org/intl/stringbundle;1"] + .getService(Components.interfaces.nsIStringBundleService); + var browserstrings = sb.createBundle("chrome://browser/locale/browser.properties"); + + var askagain = browserstrings.GetStringFromName("privateBrowsingNeverAsk"); + + var response = prompts.confirmEx(null, "", message, flags, null, null, null, + askagain, checkbox); + + // Update preferences to reflect their response and to prevent the prompt from + // being displayed again. + m_tb_prefs.setBoolPref("extensions.torbutton.prompt_torbrowser", !checkbox.value); +} + //this function checks to see if the context menu is being clicked on a link. //if it is, then we show the two context menu items function torbutton_check_contextmenu() { @@ -2219,6 +2243,10 @@ function torbutton_check_protections()
if (!m_tb_control_pass || !m_tb_control_port) document.getElementById("torbutton-new-identity").disabled = true; + + if (!m_tb_tbb && m_tb_prefs.getBoolPref("extensions.torbutton.prompt_torbrowser")) { + torbutton_inform_about_tbb(); + } }
function torbutton_open_cookie_dialog() { diff --git a/src/chrome/locale/en/torbutton.properties b/src/chrome/locale/en/torbutton.properties index 773e8db..aa0167c 100644 --- a/src/chrome/locale/en/torbutton.properties +++ b/src/chrome/locale/en/torbutton.properties @@ -40,3 +40,4 @@ torbutton.popup.use_tbb = It appears that you are using Torbutton with Firefox, torbutton.popup.pref_error = Torbutton cannot update preferences in the Tor Browser profile directory. torbutton.popup.permission_denied = Please either reset the permissions of the Tor Browser directory or copy it to a new location. torbutton.popup.device_full = The disk appears to be full. Please free up space or move Tor Browser to a new device. +torbutton.popup.prompt_torbrowser = Torbutton is no longer safe to use in a browser that is also used for non-Tor browsing. We have disabled the ability to toggle Torbutton as a result.\n\nIf you wish to keep using Firefox for non-Tor browsing, you should uninstall Torbutton and download Tor Browser. The privacy properties of Tor Browser are also superior to those of normal Firefox, even when Firefox is used with Torbutton. diff --git a/src/defaults/preferences/preferences.js b/src/defaults/preferences/preferences.js index f8e6730..8dd2add 100644 --- a/src/defaults/preferences/preferences.js +++ b/src/defaults/preferences/preferences.js @@ -220,3 +220,4 @@ pref("extensions.torbutton.useragent_vendorSub",""); pref("extensions.torbutton.safecache",1); // 0=always, 1=during tor, 2=never pref("extensions.torbutton.dual_key_cookies",false); pref("extensions.torbutton.cookie_js_allow", true); +pref("extensions.torbutton.prompt_torbrowser", true);
tor-commits@lists.torproject.org