[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] [torbutton/master] Initial implementation of FF35 support.
Author: Mike Perry <mikeperry-git@xxxxxxxxxx>
Date: Fri, 6 Nov 2009 14:16:38 -0800
Subject: Initial implementation of FF35 support.
Commit: 30e4ca3e6cc63dc015ff178e19694e616c7430f3
---
src/chrome/content/torbutton.js | 67 +++++++++++++++++++++++++++---
src/defaults/preferences/preferences.js | 4 ++
website/design/FF35_AUDIT | 3 +
3 files changed, 67 insertions(+), 7 deletions(-)
diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index c6f0d5e..f2a3bad 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -15,6 +15,7 @@ var m_tb_window_height = window.outerHeight;
var m_tb_window_width = window.outerWidth;
var m_tb_ff3 = false;
+var m_tb_ff35 = false;
var torbutton_window_pref_observer =
{
@@ -398,7 +399,13 @@ function torbutton_init() {
} else {
m_tb_ff3 = false;
}
-
+
+ if(versionChecker.compare(appInfo.version, "3.5a1") >= 0) {
+ m_tb_ff35 = true;
+ } else {
+ m_tb_ff35 = false;
+ }
+
// initialize preferences before we start our prefs observer
torbutton_init_prefs();
@@ -1114,12 +1121,18 @@ function torbutton_update_status(mode, force_update) {
m_tb_prefs.clearUserPref(children[i]);
}
}
-
+
// Always block disk cache during Tor. We clear it on toggle,
// so no need to keep it around for someone to rifle through.
torbutton_setBoolPref("browser.cache.disk.enable", "disk_cache", !mode,
mode, changed);
+ torbutton_setBoolPref("browser.cache.offline.enable", "offline_cache",
+ !mode, mode, changed);
+
+ torbutton_setBoolPref("browser.zoom.siteSpecific", "zoom_specific",
+ !mode, mode, changed);
+
// Disable safebrowsing in Tor for FF2. It fetches some info in
// cleartext with no HMAC (Firefox Bug 360387)
if(!m_tb_ff3) {
@@ -1127,6 +1140,29 @@ function torbutton_update_status(mode, force_update) {
!mode, mode, changed);
}
+ if(m_tb_ff35) {
+ // Disable geolocation
+ torbutton_setBoolPref("geo.enabled", "geo_enabled", !mode, mode,
+ changed);
+ torbutton_setBoolPref("network.dns.disablePrefetch", "dns_prefetch",
+ mode, !mode, changed);
+ try {
+ if(m_tb_prefs.prefHasUserValue("geo.wifi.access_token")) {
+ m_tb_prefs.clearUserPref("geo.wifi.access_token");
+ }
+ } catch(e) {
+ torbutton_log(3, "Exception on wifi token clear: "+e);
+ }
+ }
+
+ try {
+ if(m_tb_prefs.prefHasUserValue("general.open_location.last_url")) {
+ m_tb_prefs.clearUserPref("general.open_location.last_url");
+ }
+ } catch(e) {
+ torbutton_log(3, "Exception on wifi token clear: "+e);
+ }
+
// I think this pref is evil (and also hidden from user configuration,
// which makes it extra evil) and so therefore am disabling it
// by fiat for both tor and non-tor. Basically, I'm not willing
@@ -1140,7 +1176,7 @@ function torbutton_update_status(mode, force_update) {
// Prevent pages from pinging the Tor ports regardless tor mode
m_tb_prefs.setCharPref("network.security.ports.banned",
m_tb_prefs.getCharPref("extensions.torbutton.banned_ports"));
-
+
if (m_tb_prefs.getBoolPref("extensions.torbutton.no_search")) {
torbutton_setBoolPref("browser.search.suggest.enabled",
"search_suggest", !mode, mode, changed);
@@ -1907,7 +1943,13 @@ function torbutton_toggle_win_jsplugins(win, tor_enabled, js_enabled, isolate_dy
b.docShell.allowPlugins = !b.__tb_tor_fetched && !tor_enabled;
else
b.docShell.allowPlugins = true;
-
+
+ // Likewise for DNS prefetch
+ if(m_tb_ff35) {
+ b.docShell.allowDNSPrefetch = !b.__tb_tor_fetched
+ && !tor_enabled;
+ }
+
if(isolate_dyn) {
torbutton_check_js_tag(b, tor_enabled, js_enabled);
// kill meta-refresh and existing page loading
@@ -1976,6 +2018,10 @@ function torbutton_tag_new_browser(browser, tor_tag, no_plugins) {
browser.docShell.allowPlugins = tor_tag;
}
+ if (!tor_tag && m_tb_ff35) {
+ browser.docShell.allowDNSPrefetch = tor_tag;
+ }
+
// Only tag new windows
if (typeof(browser.__tb_tor_fetched) == 'undefined') {
torbutton_log(3, "Tagging new window: "+tor_tag);
@@ -2022,9 +2068,10 @@ function torbutton_conditional_set(state) {
for (var i = 0; i < browsers.length; ++i) {
var b = browser.browsers[i];
- if (!state && no_plugins) {
+ if (state) {
if(b && b.docShell){
- b.docShell.allowPlugins = false;
+ if(no_plugins) b.docShell.allowPlugins = false;
+ if(m_tb_ff35) b.docShell.allowDNSPrefetch = false;
} else {
try {
if (b && b.currentURI)
@@ -2034,7 +2081,7 @@ function torbutton_conditional_set(state) {
} catch(e) {
torbutton_log(5, "Initial docShell is null for unparsable URL: "+e);
}
- }
+ }
}
b.__tb_tor_fetched = state;
}
@@ -3135,6 +3182,12 @@ function torbutton_update_tags(win) {
browser.__tb_tor_fetched = !tor_tag;
browser.docShell.allowPlugins = tor_tag || !kill_plugins;
+
+ /* We want to disable allowDNSPrefetch on Tor-loaded tabs
+ * before the load, because we don't want prefetch to be enabled
+ * on tor tabs once we leave Tor. */
+ if(m_tb_ff35) browser.docShell.allowDNSPrefetch = tor_tag;
+
if(js_enabled && !browser.docShell.allowJavascript) {
// Only care about re-enabling javascript.
// The js engine obeys the pref over the docshell attribute
diff --git a/src/defaults/preferences/preferences.js b/src/defaults/preferences/preferences.js
index c4284e0..5902f59 100644
--- a/src/defaults/preferences/preferences.js
+++ b/src/defaults/preferences/preferences.js
@@ -72,11 +72,15 @@ pref("extensions.torbutton.saved.sendSecureXSiteReferrer", true);
pref("extensions.torbutton.saved.sendRefererHeader", 2);
pref("extensions.torbutton.saved.dom_storage", true);
pref("extensions.torbutton.saved.mem_cache", true);
+pref("extensions.torbutton.saved.offline_cache", true);
pref("extensions.torbutton.saved.http_cache", true);
pref("extensions.torbutton.saved.extension_update", true);
pref("extensions.torbutton.saved.app_update", true);
pref("extensions.torbutton.saved.auto_update", true);
pref("extensions.torbutton.saved.search_update", true);
+pref("extensions.torbutton.saved.geo_enabled", true);
+pref("extensions.torbutton.saved.zoom_specific", true);
+pref("extensions.torbutton.saved.dns_prefetch", true);
// State prefs:
pref("extensions.torbutton.tor_enabled",false);
diff --git a/website/design/FF35_AUDIT b/website/design/FF35_AUDIT
index 1f644ab..d066314 100644
--- a/website/design/FF35_AUDIT
+++ b/website/design/FF35_AUDIT
@@ -91,6 +91,7 @@ First pass: Quick Review of Firefox Features
- Each docshell has tons of storages for each origin contained in it
- Toggling dom.storage.enabled does not clear existing storage
- Oh HOT! cookie-changed to clear cookies clears all storages!
+ - happens for both ff3.0 and 3.5 in dom/src/storage/nsDOMStorage.cpp
- Conclusion:
- can safely enable dom storage
- May have minor buggy usability issues unless we preserve it
@@ -114,6 +115,8 @@ Second Pass: Verification of all Torbutton Assumptions
- Stuff the emit does (grep for NS_PRIVATE_BROWSING_SWITCH_TOPIC and
"private-browsing")
- XXX: clear mozilla.org/security/sdr;1. We should too! Wtf is it??
+ - Neg. Best to let them handle this. Users will be annoyed
+ at having to re-enter their passwords..
- They also clear the console service..
- Recommend watching private-browsing-cancel-vote and blocking if
we are performing a db operation
--
1.5.6.5