commit 59cabca7ade54fa4f5fec2a398456dbc3891009a Author: Alex Catarineu acat@torproject.org Date: Mon Jun 10 17:49:38 2019 +0200
Bug 30851: Move default preferences to 000-tor-browser.js --- chrome/content/locale/non-localized.properties | 6 --- components/domain-isolator.js | 3 -- components/dragDropFilter.js | 2 - components/startup-observer.js | 1 - components/torbutton-logger.js | 2 - defaults/preferences/preferences.js | 55 -------------------------- jar.mn | 1 - modules/default-prefs.js | 36 ----------------- moz.build | 3 -- 9 files changed, 109 deletions(-)
diff --git a/chrome/content/locale/non-localized.properties b/chrome/content/locale/non-localized.properties deleted file mode 100644 index dca78639..00000000 --- a/chrome/content/locale/non-localized.properties +++ /dev/null @@ -1,6 +0,0 @@ -# This file must be located in a subdirectory named "locale" so that -# about:config will display the correct value for browser.startup.homepage. -# See fetchPref() inside toolkit/components/viewconfig/content/config.js - -# Default home page -browser.startup.homepage=about:tor diff --git a/components/domain-isolator.js b/components/domain-isolator.js index f6a6d598..3ed6e58f 100644 --- a/components/domain-isolator.js +++ b/components/domain-isolator.js @@ -15,9 +15,6 @@ const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm let logger = Cc["@torproject.org/torbutton-logger;1"] .getService(Ci.nsISupports).wrappedJSObject;
-let { ensureDefaultPrefs } = ChromeUtils.import("resource://torbutton/modules/default-prefs.js", {}); -ensureDefaultPrefs(); - // Import crypto object (FF 37+). Cu.importGlobalProperties(["crypto"]);
diff --git a/components/dragDropFilter.js b/components/dragDropFilter.js index 9d6f74c8..f48d1b38 100644 --- a/components/dragDropFilter.js +++ b/components/dragDropFilter.js @@ -6,8 +6,6 @@ *************************************************************************/
-ChromeUtils.import("resource://torbutton/modules/default-prefs.js", {}).ensureDefaultPrefs(); - const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
diff --git a/components/startup-observer.js b/components/startup-observer.js index 008134f8..d2d1d610 100644 --- a/components/startup-observer.js +++ b/components/startup-observer.js @@ -21,7 +21,6 @@ XPCOMUtils.defineLazyModuleGetters(this, { L10nRegistry: "resource://gre/modules/L10nRegistry.jsm", });
-ChromeUtils.import("resource://torbutton/modules/default-prefs.js", {}).ensureDefaultPrefs(); let NoScriptControl = ChromeUtils.import("resource://torbutton/modules/noscript-control.js", {});
// Module specific constants diff --git a/components/torbutton-logger.js b/components/torbutton-logger.js index 52fdfc23..1c946fa7 100644 --- a/components/torbutton-logger.js +++ b/components/torbutton-logger.js @@ -13,8 +13,6 @@ const kMODULE_NAME = "Torbutton Logger"; const kMODULE_CONTRACTID = "@torproject.org/torbutton-logger;1"; const kMODULE_CID = Components.ID("f36d72c9-9718-4134-b550-e109638331d7");
-ChromeUtils.import("resource://torbutton/modules/default-prefs.js", {}).ensureDefaultPrefs(); - const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
diff --git a/defaults/preferences/preferences.js b/defaults/preferences/preferences.js deleted file mode 100644 index 100302b7..00000000 --- a/defaults/preferences/preferences.js +++ /dev/null @@ -1,55 +0,0 @@ -// debug prefs -pref("extensions.torbutton.loglevel",4); -pref("extensions.torbutton.logmethod",1); // 0=stdout, 1=errorconsole, 2=debuglog - -// Display prefs -pref("extensions.torbutton.display_circuit", true); -pref("extensions.torbutton@torproject.org.description", "chrome://torbutton/locale/torbutton.properties"); -pref("extensions.torbutton.updateNeeded", false); - -// Tor check and proxy prefs -pref("extensions.torbutton.test_enabled",true); -pref("extensions.torbutton.test_url","https://check.torproject.org/?TorButton=true"); -pref("extensions.torbutton.local_tor_check",true); -pref("extensions.torbutton.versioncheck_url","https://www.torproject.org/projects/torbrowser/RecommendedTBBVersions"); -pref("extensions.torbutton.versioncheck_enabled",true); -pref("extensions.torbutton.use_nontor_proxy",false); - -// State prefs: -pref("extensions.torbutton.startup",false); -pref("extensions.torbutton.inserted_button",false); -pref("extensions.torbutton.inserted_security_level",false); - -// TODO: This is just part of a stopgap until #14429 gets properly implemented. -// See #7255 for details. We display the warning three times to make sure the -// user did not click on it by accident. -pref("extensions.torbutton.maximize_warnings_remaining", 3); - -// Security prefs: -pref("extensions.torbutton.clear_http_auth",true); -pref("extensions.torbutton.close_newnym",true); -pref("extensions.torbutton.resize_new_windows",false); -pref("extensions.torbutton.startup_state", 2); // 0=non-tor, 1=tor, 2=last -pref("extensions.torbutton.tor_memory_jar",false); -pref("extensions.torbutton.nontor_memory_jar",false); -pref("extensions.torbutton.launch_warning",true); - -// Opt out of Firefox addon pings: -// https://developer.mozilla.org/en/Addons/Working_with_AMO -pref("extensions.torbutton@torproject.org.getAddons.cache.enabled", false); - -// Security Slider -pref("extensions.torbutton.security_slider", 4); -pref("extensions.torbutton.security_custom", false); - -pref("extensions.torbutton.confirm_plugins", true); -pref("extensions.torbutton.confirm_newnym", true); - -pref("extensions.torbutton.noscript_inited", false); -pref("extensions.torbutton.noscript_persist", false); - -// Browser home page: -pref("browser.startup.homepage", "chrome://torbutton/content/locale/non-localized.properties"); - -// This pref specifies an ad-hoc "version" for various pref update hacks we need to do -pref("extensions.torbutton.pref_fixup_version", 0); diff --git a/jar.mn b/jar.mn index 8b6cbcf7..2c6d186b 100644 --- a/jar.mn +++ b/jar.mn @@ -6,7 +6,6 @@ torbutton.jar:
content/ (chrome/content/*) components/ (components/*) - defaults/ (defaults/*) modules/ (modules/*) skin/ (chrome/skin/*)
diff --git a/modules/default-prefs.js b/modules/default-prefs.js deleted file mode 100644 index 5ea549f4..00000000 --- a/modules/default-prefs.js +++ /dev/null @@ -1,36 +0,0 @@ -let loaded = false; - -function ensureDefaultPrefs () { - if (loaded) { - return; - } - const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); - const kDefaultPreferences = "resource://torbutton/defaults/preferences/preferences.js"; - const defaultPrefBranch = Services.prefs.getDefaultBranch(null); - - const context = { - pref: function (aPrefName, aValue) { - const aValueType = typeof aValue; - if (aValueType === "boolean") { - defaultPrefBranch.setBoolPref(aPrefName, aValue); - } else if (aValueType === "number") { - defaultPrefBranch.setIntPref(aPrefName, aValue); - } else if (aValueType === "string") { - defaultPrefBranch.setCharPref(aPrefName, aValue); - } else { - Services.console.logStringMessage( - `Preference ${aPrefName} with value ${aValue} has an invalid value type`); - } - - // Disable the External App Blocker on Android - if ((aPrefName === "extensions.torbutton.launch_warning") && - (Services.appinfo.OS === "Android")) { - defaultPrefBranch.setBoolPref(aPrefName, false); - } - } - }; - Services.scriptloader.loadSubScript(kDefaultPreferences, context); - loaded = true; -} - -let EXPORTED_SYMBOLS = ["ensureDefaultPrefs"]; diff --git a/moz.build b/moz.build index 843cee0d..376c9976 100644 --- a/moz.build +++ b/moz.build @@ -4,6 +4,3 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. JAR_MANIFESTS += ['jar.mn'] -JS_PREFERENCE_FILES += [ - 'defaults/preferences/preferences.js', -]
tbb-commits@lists.torproject.org