[or-cvs] r10649: Rendering bugfixes, string updates. (in torbutton/trunk/src: chrome/content chrome/locale/en-US components)

mikeperry at seul.org mikeperry at seul.org
Mon Jun 18 08:00:58 UTC 2007


Author: mikeperry
Date: 2007-06-18 04:00:58 -0400 (Mon, 18 Jun 2007)
New Revision: 10649

Modified:
   torbutton/trunk/src/chrome/content/torbutton.js
   torbutton/trunk/src/chrome/locale/en-US/torbutton.dtd
   torbutton/trunk/src/components/cssblocker.js
Log:

Rendering bugfixes, string updates.



Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js	2007-06-18 06:01:34 UTC (rev 10648)
+++ torbutton/trunk/src/chrome/content/torbutton.js	2007-06-18 08:00:58 UTC (rev 10649)
@@ -406,6 +406,7 @@
     torbutton_update_toolbutton(mode);
     torbutton_update_statusbar(mode);
 
+    torbutton_log(2, 'Setting user agent');
     if(torprefs.getBoolPref("set_uagent")) {
         if(mode) {
             m_prefs.setCharPref("general.appname.override", 
@@ -426,14 +427,21 @@
             m_prefs.setCharPref("general.useragent.vendorSub",
                 torprefs.getCharPref("useragent_vendorSub"));
         } else {
-            m_prefs.clearUserPref("general.appname.override");
-            m_prefs.clearUserPref("general.appversion.override");
-            m_prefs.clearUserPref("general.platform.override");
-            m_prefs.clearUserPref("general.useragent.override");
-            m_prefs.clearUserPref("general.useragent.vendor");
-            m_prefs.clearUserPref("general.useragent.vendorSub");
+            try {
+                m_prefs.clearUserPref("general.appname.override");
+                m_prefs.clearUserPref("general.appversion.override");
+                m_prefs.clearUserPref("general.platform.override");
+                m_prefs.clearUserPref("general.useragent.override");
+                m_prefs.clearUserPref("general.useragent.vendor");
+                m_prefs.clearUserPref("general.useragent.vendorSub");
+            } catch (e) {
+                // This happens because we run this from time to time
+                torbutton_log(1, "Prefs already cleared");
+            }
         }
     }
+    
+    torbutton_log(2, 'Done with user agent: '+changed);
 
     // this function is called every time there is a new window! Alot of this
     // stuff expects to be called on toggle only.. like the cookie jars and

Modified: torbutton/trunk/src/chrome/locale/en-US/torbutton.dtd
===================================================================
--- torbutton/trunk/src/chrome/locale/en-US/torbutton.dtd	2007-06-18 06:01:34 UTC (rev 10648)
+++ torbutton/trunk/src/chrome/locale/en-US/torbutton.dtd	2007-06-18 08:00:58 UTC (rev 10649)
@@ -15,13 +15,13 @@
 <!ENTITY torbutton.prefs.proxy.host.socks               "SOCKS Host:">
 <!ENTITY torbutton.prefs.proxy.port                     "Port:">
 <!ENTITY torbutton.prefs.sec_settings        "Security Settings">
-<!ENTITY torbutton.prefs.block_thread        "Block history read during Tor (recomended)">
-<!ENTITY torbutton.prefs.block_thwrite       "Block history write during Tor (recomended)">
-<!ENTITY torbutton.prefs.block_nthread       "Block history read during Non-Tor (optional)">
-<!ENTITY torbutton.prefs.block_nthwrite      "Block history write during Non-Tor (optional)">
+<!ENTITY torbutton.prefs.block_thread        "Block history reads during Tor (recomended)">
+<!ENTITY torbutton.prefs.block_thwrite       "Block history writes during Tor (recomended)">
+<!ENTITY torbutton.prefs.block_nthread       "Block history reads during Non-Tor (optional)">
+<!ENTITY torbutton.prefs.block_nthwrite      "Block history writes during Non-Tor (optional)">
 <!ENTITY torbutton.prefs.clear_history       "Clear history on Tor toggle (optional)">
 <!ENTITY torbutton.prefs.clear_cache        "Block Tor disk cache and clear all cache on Tor toggle">
-<!ENTITY torbutton.prefs.block_cache        "Block all cache during Tor">
+<!ENTITY torbutton.prefs.block_cache        "Block disk and memory cache access during Tor">
 <!ENTITY torbutton.prefs.cookie_jars        "Store Non-Tor cookies in a protected jar">
 <!ENTITY torbutton.prefs.clear_cookies      "Clear cookies on Tor toggle">
 <!ENTITY torbutton.prefs.disable_plugins    "Disable plugins during Tor usage (recommended)">
@@ -34,7 +34,7 @@
 <!ENTITY torbutton.prefs.cache                "Cache">
 <!ENTITY torbutton.prefs.history             "History">
 <!ENTITY torbutton.prefs.uagent              "User Agent">
-<!ENTITY torbutton.prefs.no_search           "Disable search suggestions (optional)">
+<!ENTITY torbutton.prefs.no_search           "Disable search suggestions during Tor (optional)">
 <!ENTITY torbutton.about.title                          "About Torbutton">
 <!ENTITY torbutton.pref_connection.notice               "Disable Torbutton to change these settings.">
 <!ENTITY torbutton.pref_connection.more_info            "More information">

Modified: torbutton/trunk/src/components/cssblocker.js
===================================================================
--- torbutton/trunk/src/components/cssblocker.js	2007-06-18 06:01:34 UTC (rev 10648)
+++ torbutton/trunk/src/components/cssblocker.js	2007-06-18 08:00:58 UTC (rev 10649)
@@ -3,8 +3,9 @@
  * (such as CSS)
  *   - http://www.w3.org/TR/REC-CSS2/selector.html#dynamic-pseudo-classes
  * 
- * Also serves as a safety net to catch content the other
- * mechaanisms somehow fail to block.
+ * Also serves as a safety net to catch content the other mechanisms 
+ * somehow might be tricked into failing to block (this should not happen 
+ * in normal operation though).
  *
  * Based on examples from:
  * - http://adblockplus.org/en/faq_internal
@@ -81,8 +82,6 @@
     "mailbox" : true, "data" : true, "javascript" : true};
 
 var policy = {
-	allowOnce: null,
-
 	init: function() {
         dump("init\n");
         this._prefs = Components.classes["@mozilla.org/preferences-service;1"]
@@ -104,7 +103,7 @@
     // have to continually query prefs
 	// nsIContentPolicy interface implementation
 	shouldLoad: function(contentType, contentLocation, requestOrigin, insecNode, mimeTypeGuess, extra) {
-        dump("ContentLocation: "+contentLocation.spec + " request "+requestOrigin.spec+"\n");
+        dump("ContentLocation: "+contentLocation.spec+"\n");
        
         /*. Debugging hack. DO NOT UNCOMMENT IN PRODUCTION ENVIRONMENTS
         if(contentLocation.spec.search("venkman") != -1) {
@@ -125,11 +124,6 @@
         var node = wrapNode(insecNode);
         var wind = getWindow(wrapNode(insecNode));
 
-		if (!wind || !wind.top.location || !wind.top.location.href) {
-            dump("Location\n");
-			return ok;
-        }
-
 		if (this.isLocalScheme(unwrapURL(contentLocation.spec))) {
 			return ok;
         } 
@@ -140,6 +134,11 @@
 			wind = node;
 		}
 
+        if (!wind || !wind.top.location || !wind.top.location.href) {
+            dump("Location\n");
+			return ok;
+        }
+
         var doc = wind.top.document;
         if(!doc) {
             // 1st load of a page in a new location
@@ -150,6 +149,12 @@
         var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
                      .getService(Components.interfaces.nsIWindowMediator);
         var mainWindow = wm.getMostRecentWindow("navigator:browser");
+
+        if(!mainWindow) {
+            // 1st window gets this.
+            return ok;
+        }
+
         var browser = mainWindow.getBrowser(); 
         var torTag = !this._prefs.getBoolPref("extensions.torbutton.tor_enabled");
        
@@ -157,6 +162,9 @@
         // is gonna be SO fucking slow :(
         // TODO: try nsIWindowWatcher.getChromeForWindow()
         if (browser.contentDocument == doc) {
+            if (typeof(browser.__tb_js_state) == 'undefined') {
+                dump("UNTAGGED WINDOW1!!!!!!!!!");
+            }
             if(browser.__tb_js_state == torTag) {
                 return ok;
             } else {
@@ -168,6 +176,10 @@
         for (var i = 0; i < browser.browsers.length; ++i) {
             var b = browser.browsers[i];
             if (b && b.contentDocument == doc) {
+                if (typeof(browser.__tb_js_state) == 'undefined') {
+                    dump("UNTAGGED WINDOW2!!!!!!!!!");
+                }
+
                 if(b.__tb_js_state == torTag) {
                     return ok;
                 } else {
@@ -177,7 +189,7 @@
             }
         }
 
-        // Favicons hit this.. They have no DOM document.
+        // Favicons hit this.. Their document is browser.xml
         return ok;
 	},
 



More information about the tor-commits mailing list