Commit 7a0efdf6 authored by Arthur Edelstein's avatar Arthur Edelstein Committed by Georg Koppen
Browse files

Bug 18093: Remove 'Restore Defaults' button

parent 52fbcbfa
...@@ -54,63 +54,6 @@ function torbutton_prefs_save(doc) { ...@@ -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) { function torbutton_toggle_slider(doc, pos) {
doc.getElementById("torbutton_sec_slider").value = pos; doc.getElementById("torbutton_sec_slider").value = pos;
// Make sure the custom checkbox is unchecked as the user seems to want one // Make sure the custom checkbox is unchecked as the user seems to want one
......
...@@ -8,9 +8,7 @@ ...@@ -8,9 +8,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml"
title="&torbutton.prefs.security_settings;" title="&torbutton.prefs.security_settings;"
buttons="accept,cancel,extra1" buttons="accept,cancel"
buttonlabelextra1="&torbutton.prefs.restore_defaults;"
ondialogextra1="torbutton_prefs_reset_defaults();"
persist="screenX screenY width height" persist="screenX screenY width height"
onload="torbutton_prefs_init(document)" onload="torbutton_prefs_init(document)"
align="stretch" align="stretch"
......
...@@ -52,30 +52,6 @@ function torbutton_get_prefbranch(branch_name) { ...@@ -52,30 +52,6 @@ function torbutton_get_prefbranch(branch_name) {
return o_branch; 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 // load localization strings
function torbutton_get_stringbundle() function torbutton_get_stringbundle()
{ {
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
<!ENTITY torbutton.context_menu.cookieProtections.key "C"> <!ENTITY torbutton.context_menu.cookieProtections.key "C">
<!ENTITY torbutton.button.tooltip "Click to initialize Torbutton"> <!ENTITY torbutton.button.tooltip "Click to initialize Torbutton">
<!ENTITY torbutton.prefs.security_settings "Security Settings"> <!ENTITY torbutton.prefs.security_settings "Security Settings">
<!ENTITY torbutton.prefs.restore_defaults "Restore Defaults">
<!ENTITY torbutton.cookiedialog.title "Manage Cookie Protections"> <!ENTITY torbutton.cookiedialog.title "Manage Cookie Protections">
<!ENTITY torbutton.cookiedialog.lockCol "Protected"> <!ENTITY torbutton.cookiedialog.lockCol "Protected">
<!ENTITY torbutton.cookiedialog.domainCol "Host"> <!ENTITY torbutton.cookiedialog.domainCol "Host">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment