[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] [torbutton/maint-1.2] Fix a bogus log message about reset user agents.
Author: Mike Perry <mikeperry-git@xxxxxxxxxx>
Date: Sat, 7 Nov 2009 13:59:38 -0800
Subject: Fix a bogus log message about reset user agents.
Commit: c6d618025e1239f8494357935abef685835f23ed
Also fix some random errors and warnings.
---
src/chrome/content/torbutton.js | 14 ++++++++++----
src/components/window-mapper.js | 7 ++++++-
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 5351824..5e956e0 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -96,8 +96,9 @@ var torbutton_unique_pref_observer =
case "general.useragent.vendorSub":
case "general.useragent.override":
if((!m_tb_prefs.prefHasUserValue("general.useragent.override")
- || !m_tb_prefs.prefHasUserValue("general.useragent.vendorSub"))
+ || !m_tb_prefs.prefHasUserValue("general.useragent.vendorSub"))
&& m_tb_prefs.getBoolPref("extensions.torbutton.tor_enabled")
+ && m_tb_prefs.getBoolPref("extensions.torbutton.settings_applied")
&& m_tb_prefs.getBoolPref("extensions.torbutton.set_uagent")) {
torbutton_log(4, "Some other addon tried to clear user agent settings.");
torbutton_set_uagent();
@@ -715,6 +716,7 @@ function torbutton_update_toolbutton(mode)
var o_toolbutton = torbutton_get_toolbutton();
if (!o_toolbutton) return;
var o_stringbundle = torbutton_get_stringbundle();
+ var tooltip = "";
if (mode) {
tooltip = o_stringbundle.GetStringFromName("torbutton.button.tooltip.enabled");
@@ -2036,9 +2038,13 @@ function torbutton_tag_new_browser(browser, tor_tag, no_plugins) {
if(!browser.webNavigation.sessionHistory) {
torbutton_log(4, "Still failed to add historyListener!");
}
- browser.webNavigation.sessionHistory.addSHistoryListener(hlisten);
- browser.__tb_hlistener = hlisten;
- torbutton_log(2, "Added history listener");
+ try {
+ browser.webNavigation.sessionHistory.addSHistoryListener(hlisten);
+ browser.__tb_hlistener = hlisten;
+ torbutton_log(2, "Added history listener");
+ } catch(e) {
+ torbutton_log(4, "Exception adding history listener: "+e);
+ }
}
if(browser.webNavigation.sessionHistory) {
diff --git a/src/components/window-mapper.js b/src/components/window-mapper.js
index 26aee4b..b43f109 100644
--- a/src/components/window-mapper.js
+++ b/src/components/window-mapper.js
@@ -87,13 +87,18 @@ ContentWindowMapper.prototype =
return;
}
+ var delkeys = [];
for(var elem in this.cache) {
if((now - this.cache[elem].time) > EXPIRATION_TIME) {
this.logger.log(2, "Deleting cached element: "+elem.location);
- delete this.cache[elem];
+ delkeys.push(elem);
}
}
+ for(var k in delkeys) {
+ delete this.cache[k];
+ }
+
this.last_expired = now;
},
--
1.5.6.5