[tbb-commits] [torbutton/master] Bug 18093: Remove 'Restore Defaults' button
gk at torproject.org
gk at torproject.org
Mon Oct 17 12:07:48 UTC 2016
commit 7a0efdf6a99969007792d418a6bbfd5e0da4b3cf
Author: Arthur Edelstein <arthuredelstein at gmail.com>
Date: Thu Oct 6 21:58:50 2016 -0700
Bug 18093: Remove 'Restore Defaults' button
---
src/chrome/content/preferences.js | 57 ------------------------------------
src/chrome/content/preferences.xul | 4 +--
src/chrome/content/torbutton_util.js | 24 ---------------
src/chrome/locale/en/torbutton.dtd | 1 -
4 files changed, 1 insertion(+), 85 deletions(-)
diff --git a/src/chrome/content/preferences.js b/src/chrome/content/preferences.js
index 28f5955..1d85cde 100644
--- a/src/chrome/content/preferences.js
+++ b/src/chrome/content/preferences.js
@@ -54,63 +54,6 @@ function torbutton_prefs_save(doc) {
}
}
-function torbutton_prefs_reset_defaults() {
- var o_torprefs = torbutton_get_prefbranch('extensions.torbutton.');
- var tmpcnt = new Object();
- var children;
- var i;
- var loglevel = o_torprefs.getIntPref("loglevel");
- var logmthd = o_torprefs.getIntPref("logmethod");
-
- torbutton_log(3, "Starting Pref reset");
-
- // 1. Clear torbutton settings
- // 2. Clear browser proxy settings
- // 3. Reset Security Slider settings
-
- // XXX Warning: The only reason this works is because of Firefox's
- // threading model. As soon as a pref is changed, all observers
- // are notified by that same thread, immediately. Since torbutton's
- // security state is driven by proxy pref observers, this
- // causes everything to be reset in a linear order. If firefox
- // ever makes pref observers asynchonous, this will all break.
-
- children = o_torprefs.getChildList("" , tmpcnt);
- for(i = 0; i < children.length; i++) {
- if(o_torprefs.prefHasUserValue(children[i]))
- o_torprefs.clearUserPref(children[i]);
- }
-
- // Keep logging the same.
- o_torprefs.setIntPref("loglevel", loglevel);
- o_torprefs.setIntPref("logmethod", logmthd);
-
- torbutton_log(3, "Resetting browser prefs");
-
- // Reset browser prefs that torbutton touches just in case
- // they get horked. Better everything gets set back to default
- // than some arcane pref gets wedged with no clear way to fix it.
- // Technical users who tuned these by themselves will be able to fix it.
- // It's the non-technical ones we should make it easy for
- torbutton_reset_browser_prefs();
-
- // Resetting the Security Slider preferences
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var win = wm.getMostRecentWindow("navigator:browser");
- o_torprefs.setBoolPref('security_custom', false);
- o_torprefs.setIntPref('security_slider', 4);
- win.torbutton_update_security_slider();
-
- torbutton_log(4, "Preferences reset to defaults");
- torbutton_prefs_init(window.document);
-
- // In all cases, force prefs to be synced to disk
- var prefService = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefService);
- prefService.savePrefFile(null);
-}
-
function torbutton_toggle_slider(doc, pos) {
doc.getElementById("torbutton_sec_slider").value = pos;
// Make sure the custom checkbox is unchecked as the user seems to want one
diff --git a/src/chrome/content/preferences.xul b/src/chrome/content/preferences.xul
index 62f649f..574932e 100644
--- a/src/chrome/content/preferences.xul
+++ b/src/chrome/content/preferences.xul
@@ -8,9 +8,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
title="&torbutton.prefs.security_settings;"
- buttons="accept,cancel,extra1"
- buttonlabelextra1="&torbutton.prefs.restore_defaults;"
- ondialogextra1="torbutton_prefs_reset_defaults();"
+ buttons="accept,cancel"
persist="screenX screenY width height"
onload="torbutton_prefs_init(document)"
align="stretch"
diff --git a/src/chrome/content/torbutton_util.js b/src/chrome/content/torbutton_util.js
index 1558ced..f1263f1 100644
--- a/src/chrome/content/torbutton_util.js
+++ b/src/chrome/content/torbutton_util.js
@@ -52,30 +52,6 @@ function torbutton_get_prefbranch(branch_name) {
return o_branch;
}
-// Bug 1506 P3: This would be a semi-polite thing to do on uninstall
-// for pure Firefox users. The most polite thing would be to save
-// all their original prefs.. But meh?
-function torbutton_reset_browser_prefs() {
- var o_all_prefs = torbutton_get_prefbranch('');
- var prefs = ["network.http.sendSecureXSiteReferrer",
- "network.http.sendRefererHeader", "dom.storage.enabled",
- "extensions.update.enabled", "app.update.enabled",
- "app.update.auto", "browser.search.update",
- "browser.cache.memory.enable", "network.http.use-cache",
- "browser.cache.disk.enable", "browser.safebrowsing.enabled",
- "browser.send_pings", "browser.safebrowsing.remoteLookups",
- "network.security.ports.banned", "browser.search.suggest.enabled",
- "security.enable_java", "browser.history_expire_days",
- "browser.download.manager.retention", "browser.formfill.enable",
- "signon.rememberSignons", "plugin.disable_full_page_plugin_for_types",
- "browser.bookmarks.livemark_refresh_seconds",
- "network.cookie.lifetimePolicy" ];
- for(var i = 0; i < prefs.length; i++) {
- if(o_all_prefs.prefHasUserValue(prefs[i]))
- o_all_prefs.clearUserPref(prefs[i]);
- }
-}
-
// load localization strings
function torbutton_get_stringbundle()
{
diff --git a/src/chrome/locale/en/torbutton.dtd b/src/chrome/locale/en/torbutton.dtd
index 0ea18e5..56f663e 100644
--- a/src/chrome/locale/en/torbutton.dtd
+++ b/src/chrome/locale/en/torbutton.dtd
@@ -12,7 +12,6 @@
<!ENTITY torbutton.context_menu.cookieProtections.key "C">
<!ENTITY torbutton.button.tooltip "Click to initialize Torbutton">
<!ENTITY torbutton.prefs.security_settings "Security Settings">
-<!ENTITY torbutton.prefs.restore_defaults "Restore Defaults">
<!ENTITY torbutton.cookiedialog.title "Manage Cookie Protections">
<!ENTITY torbutton.cookiedialog.lockCol "Protected">
<!ENTITY torbutton.cookiedialog.domainCol "Host">
More information about the tbb-commits
mailing list