[or-cvs] r20180: {torbutton} Localize the external app blocker strings. Also provide a wa (in torbutton/trunk/src: chrome/content chrome/locale/en components defaults/preferences)
mikeperry at seul.org
mikeperry at seul.org
Tue Jul 28 06:32:58 UTC 2009
Author: mikeperry
Date: 2009-07-28 02:32:58 -0400 (Tue, 28 Jul 2009)
New Revision: 20180
Modified:
torbutton/trunk/src/chrome/content/preferences.js
torbutton/trunk/src/chrome/content/preferences.xul
torbutton/trunk/src/chrome/content/torbutton.js
torbutton/trunk/src/chrome/content/torbutton_util.js
torbutton/trunk/src/chrome/locale/en/torbutton.dtd
torbutton/trunk/src/chrome/locale/en/torbutton.properties
torbutton/trunk/src/components/external-app-blocker.js
torbutton/trunk/src/defaults/preferences/preferences.js
Log:
Localize the external app blocker strings. Also provide
a way to have a separate "No Proxy For" option for Tor
mode.
Modified: torbutton/trunk/src/chrome/content/preferences.js
===================================================================
--- torbutton/trunk/src/chrome/content/preferences.js 2009-07-28 06:01:31 UTC (rev 20179)
+++ torbutton/trunk/src/chrome/content/preferences.js 2009-07-28 06:32:58 UTC (rev 20180)
@@ -66,6 +66,7 @@
doc.getElementById('torbutton_socksHost').disabled = true;
doc.getElementById('torbutton_socksPort').disabled = true;
doc.getElementById('torbutton_socksGroup').disabled = true;
+ doc.getElementById('torbutton_noProxiesOn').disabled = true;
} else {
doc.getElementById('torbutton_httpProxy').disabled = false;
doc.getElementById('torbutton_httpPort').disabled = false;
@@ -78,6 +79,7 @@
doc.getElementById('torbutton_socksHost').disabled = false;
doc.getElementById('torbutton_socksPort').disabled = false;
doc.getElementById('torbutton_socksGroup').disabled = false;
+ doc.getElementById('torbutton_noProxiesOn').disabled = false;
/* Do not reset these on every document update..
doc.getElementById('torbutton_httpProxy').value = o_customprefs.getCharPref('http_proxy');
doc.getElementById('torbutton_httpPort').value = o_customprefs.getIntPref('http_port');
@@ -138,6 +140,8 @@
doc.getElementById('torbutton_socksGroup').selectedItem =
doc.getElementById('torbutton_socksv5');
}
+ doc.getElementById('torbutton_noProxiesOn').value = o_torprefs.getCharPref('no_proxies_on');
+
// doc.getElementById('torbutton_warnUponExcludedSite').checked = o_torprefs.getBoolPref('prompt_before_visiting_excluded_sites');
doc.getElementById('torbutton_disablePlugins').checked = o_torprefs.getBoolPref('no_tor_plugins');
@@ -330,6 +334,8 @@
o_torprefs.setIntPref('socks_version', 5);
}
+ o_torprefs.setCharPref('no_proxies_on', doc.getElementById('torbutton_noProxiesOn').value);
+
if (doc.getElementById('torbutton_settingsMethod').value == 'custom') {
// XXX: Is this even needed anymore? We don't read the
// custom prefs at all it seems..
Modified: torbutton/trunk/src/chrome/content/preferences.xul
===================================================================
--- torbutton/trunk/src/chrome/content/preferences.xul 2009-07-28 06:01:31 UTC (rev 20179)
+++ torbutton/trunk/src/chrome/content/preferences.xul 2009-07-28 06:32:58 UTC (rev 20180)
@@ -108,10 +108,28 @@
oncommand="torbutton_prefs_set_field_attributes(document)"/>
</radiogroup>
</row>
+ <row align="center">
+ <hbox align="center" pack="end">
+ <label value="&torbutton.prefs.no_proxies_on;" control="torbutton_noProxiesOn"/>
+ </hbox>
+ <hbox align="center">
+ <textbox id="torbutton_noProxiesOn"/>
+ <spacer/>
+ </hbox>
+ </row>
+ <row align="right">
+ <hbox align="center" pack="end">
+ <spacer flex="1"/>
+ </hbox>
+ <hbox align="center" pack="end">
+ <label class="indent" value="&torbutton.prefs.no_proxy_warning;"/>
+ </hbox>
+ </row>
</rows>
</grid>
</radiogroup>
-
+
+
<checkbox id="torbutton_lockedMode"
label="&torbutton.prefs.locked_mode;"
oncommand="torbutton_prefs_set_field_attributes(document)"/>
@@ -333,7 +351,7 @@
</vbox>
</tabpanel>
- </tabpanels>
+ </tabpanels>
</tabbox>
<!--
Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js 2009-07-28 06:01:31 UTC (rev 20179)
+++ torbutton/trunk/src/chrome/content/torbutton.js 2009-07-28 06:32:58 UTC (rev 20180)
@@ -554,6 +554,7 @@
savprefs.setCharPref('socks_host', liveprefs.getCharPref('socks'));
savprefs.setIntPref('socks_port', liveprefs.getIntPref('socks_port'));
savprefs.setIntPref('socks_version', liveprefs.getIntPref('socks_version'));
+ savprefs.setCharPref('no_proxies_on', liveprefs.getCharPref('no_proxies_on'));
try { // ff-0.9 doesn't have share_proxy_settings
savprefs.setBoolPref('share_proxy_settings', liveprefs.getBoolPref('share_proxy_settings'));
} catch(e) {}
@@ -592,6 +593,7 @@
liveprefs.setCharPref('socks', savprefs.getCharPref('socks_host'));
liveprefs.setIntPref('socks_port', savprefs.getIntPref('socks_port'));
liveprefs.setIntPref('socks_version', savprefs.getIntPref('socks_version'));
+ liveprefs.setCharPref('no_proxies_on',savprefs.getCharPref('no_proxies_on'));
try { // ff-0.9 doesn't have share_proxy_settings
liveprefs.setBoolPref('share_proxy_settings', savprefs.getBoolPref('share_proxy_settings'));
} catch(e) {}
Modified: torbutton/trunk/src/chrome/content/torbutton_util.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton_util.js 2009-07-28 06:01:31 UTC (rev 20179)
+++ torbutton/trunk/src/chrome/content/torbutton_util.js 2009-07-28 06:32:58 UTC (rev 20180)
@@ -160,6 +160,7 @@
liveprefs.setCharPref('socks', torprefs.getCharPref('socks_host'));
liveprefs.setIntPref('socks_port', torprefs.getIntPref('socks_port'));
liveprefs.setIntPref('socks_version', torprefs.getIntPref('socks_version'));
+ liveprefs.setCharPref('no_proxies_on', torprefs.getCharPref('no_proxies_on'));
liveprefs.setBoolPref('share_proxy_settings', false);
if (torbutton_check_socks_remote_dns()) {
liveprefs.setBoolPref('socks_remote_dns', true);
Modified: torbutton/trunk/src/chrome/locale/en/torbutton.dtd
===================================================================
--- torbutton/trunk/src/chrome/locale/en/torbutton.dtd 2009-07-28 06:01:31 UTC (rev 20179)
+++ torbutton/trunk/src/chrome/locale/en/torbutton.dtd 2009-07-28 06:32:58 UTC (rev 20180)
@@ -90,3 +90,5 @@
<!ENTITY torbutton.prefs.tor_tabs "Tabs loaded in Tor">
<!ENTITY torbutton.prefs.socks_vfour "SOCKS v4">
<!ENTITY torbutton.prefs.socks_vfive "SOCKS v5">
+<!ENTITY torbutton.prefs.no_proxies_on "No Proxies for: ">
+<!ENTITY torbutton.prefs.no_proxy_warning "Warning: Avoid using any hostnames above">
Modified: torbutton/trunk/src/chrome/locale/en/torbutton.properties
===================================================================
--- torbutton/trunk/src/chrome/locale/en/torbutton.properties 2009-07-28 06:01:31 UTC (rev 20179)
+++ torbutton/trunk/src/chrome/locale/en/torbutton.properties 2009-07-28 06:32:58 UTC (rev 20180)
@@ -21,3 +21,9 @@
torbutton.prefs.recommended = (recommended)
torbutton.prefs.optional = (optional)
torbutton.prefs.crucial = (crucial)
+torbutton.popup.external.title = Load external content?
+torbutton.popup.external.app = An external application is needed to handle:\n\n
+torbutton.popup.external.note = \n\nNOTE: External applications are NOT Tor safe by default and can unmask you!\n
+torbutton.popup.launch = Launch application
+torbutton.popup.cancel = Cancel
+torbutton.popup.dontask = Always launch applications from now on
Modified: torbutton/trunk/src/components/external-app-blocker.js
===================================================================
--- torbutton/trunk/src/components/external-app-blocker.js 2009-07-28 06:01:31 UTC (rev 20179)
+++ torbutton/trunk/src/components/external-app-blocker.js 2009-07-28 06:32:58 UTC (rev 20180)
@@ -125,38 +125,14 @@
}
},
-
loadURI: function(aUri, aContext) {
if(this.blockApp()) {
- var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var chrome = wm.getMostRecentWindow("navigator:browser");
-
- var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Components.interfaces.nsIPromptService);
var check = {value: false};
- // XXX: Localize
- var flags = prompts.BUTTON_POS_0 * prompts.BUTTON_TITLE_IS_STRING +
- prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_IS_STRING +
- prompts.BUTTON_DELAY_ENABLE +
- prompts.BUTTON_POS_1_DEFAULT;
- var result = prompts.confirmEx(chrome, "Load external content?",
- "An external application is needed to handle"
- +"\n"+aUri.spec
- +"\n\nNOTE: External applications are NOT Tor safe by default and can unmask you!\n ",
- flags,
- "Launch application", "Cancel", "",
- "Do not ask me again", check);
+ var result = this._confirmLaunch(aUri.spec, check);
- // do something check.value / result
- if (check.value) {
- // XXX: Set a pref...
- }
-
if (result != 0) {
return null;
}
-
}
return this._external().loadURI(aUri, aContext);
@@ -164,31 +140,45 @@
// loadUrl calls loadURI
+ _confirmLaunch: function(urispec, check) {
+ if (!this._prefs.getBoolPref("extensions.torbutton.launch_warning")) {
+ return 0;
+ }
+
+ var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Components.interfaces.nsIWindowMediator);
+ var chrome = wm.getMostRecentWindow("navigator:browser");
+
+ var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
+ .getService(Components.interfaces.nsIPromptService);
+ var flags = prompts.BUTTON_POS_0 * prompts.BUTTON_TITLE_IS_STRING +
+ prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_IS_STRING +
+ prompts.BUTTON_DELAY_ENABLE +
+ prompts.BUTTON_POS_1_DEFAULT;
+
+ var bundle = chrome.torbutton_get_stringbundle();
+
+ var title = bundle.GetStringFromName("torbutton.popup.external.title");
+ var app = bundle.GetStringFromName("torbutton.popup.external.app");
+ var note = bundle.GetStringFromName("torbutton.popup.external.note");
+ var launch = bundle.GetStringFromName("torbutton.popup.launch");
+ var cancel = bundle.GetStringFromName("torbutton.popup.cancel");
+ var dontask = bundle.GetStringFromName("torbutton.popup.dontask");
+
+ var result = prompts.confirmEx(chrome, title, app+urispec+note+" ", flags,
+ launch, cancel, "", dontask, check);
+
+ if (check.value) {
+ this._prefs.setBoolPref("extensions.torbutton.launch_warning", false);
+ }
+
+ return result;
+ },
+
doContent: function(aMimeContentType, aRequest, aWindowContext, aForceSave) {
if(this.blockApp()) {
- var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var chrome = wm.getMostRecentWindow("navigator:browser");
-
- var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Components.interfaces.nsIPromptService);
var check = {value: false};
- // XXX: Localize
- var flags = prompts.BUTTON_POS_0 * prompts.BUTTON_TITLE_IS_STRING +
- prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_IS_STRING +
- prompts.BUTTON_DELAY_ENABLE +
- prompts.BUTTON_POS_1_DEFAULT;
- var result = prompts.confirmEx(chrome, "Load external content?",
- "An external application is needed to handle"
- +"\n"+aRequest.name
- +"\n\nNOTE: External applications are NOT Tor safe by default and can unmask you!\n ",
- flags,
- "Launch application", "Cancel", "",
- "Do not ask me again", check);
- // do something check.value / result
- if (check.value) {
- // XXX: Set a pref...
- }
+ var result = this._confirmLaunch(aRequest.name, check);
if (result != 0) {
return null;
Modified: torbutton/trunk/src/defaults/preferences/preferences.js
===================================================================
--- torbutton/trunk/src/defaults/preferences/preferences.js 2009-07-28 06:01:31 UTC (rev 20179)
+++ torbutton/trunk/src/defaults/preferences/preferences.js 2009-07-28 06:32:58 UTC (rev 20180)
@@ -25,6 +25,7 @@
pref("extensions.torbutton.locked_mode",false);
pref("extensions.torbutton.test_url","https://check.torproject.org/?TorButton=true");
pref("extensions.torbutton.test_failed",false);
+pref("extensions.torbutton.no_proxies_on","127.0.0.1");
// XXX: wtf prefs? These seem not actually connected, but govern
// if user wants own tor proxy settings
@@ -54,6 +55,7 @@
pref("extensions.torbutton.saved.socks_version",0);
pref("extensions.torbutton.saved.socks_port",0);
pref("extensions.torbutton.saved.socks_remote_dns",false);
+pref("extensions.torbutton.saved.no_proxies_on","localhost, 127.0.0.1");
pref("extensions.torbutton.saved.cookieLifetime",0);
pref("extensions.torbutton.saved.full_page_plugins","");
@@ -134,6 +136,7 @@
pref("extensions.torbutton.tor_memory_jar",false);
pref("extensions.torbutton.nontor_memory_jar",false);
pref("extensions.torbutton.tz_string","");
+pref("extensions.torbutton.launch_warning",true);
// User agent prefs:
pref("extensions.torbutton.appname_override","Netscape");
More information about the tor-commits
mailing list