[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r12557: Fix for favicon leak bug discussed anonymously in onionland. (torbutton/trunk/src/components)



Author: mikeperry
Date: 2007-11-23 06:25:29 -0500 (Fri, 23 Nov 2007)
New Revision: 12557

Modified:
   torbutton/trunk/src/components/cssblocker.js
   torbutton/trunk/src/components/window-mapper.js
Log:

Fix for favicon leak bug discussed anonymously in onionland.



Modified: torbutton/trunk/src/components/cssblocker.js
===================================================================
--- torbutton/trunk/src/components/cssblocker.js	2007-11-23 05:47:11 UTC (rev 12556)
+++ torbutton/trunk/src/components/cssblocker.js	2007-11-23 11:25:29 UTC (rev 12557)
@@ -94,7 +94,6 @@
         .getService(Components.interfaces.nsISupports)
         .wrappedJSObject;
     
-    // XXX: Ewww. torbutton.logger may not be loaded yet..
     this.logger = Components.classes["@torproject.org/torbutton-logger;1"]
         .getService(Components.interfaces.nsISupports).wrappedJSObject;
         
@@ -157,7 +156,6 @@
 			wind = node;
 		}
 
-        // XXX: Something is rotten in denmark        
         var tor_state = this.tor_enabled;
 
         if (contentType == 5) { // Object
@@ -184,14 +182,14 @@
 
         var browser = this.wm.getBrowserForContentWindow(wind.top);
         if(!browser) {
-            // This happens on the first load of a doc
-            this.logger.log(3, "No window found: "+contentLocation.spec);
-            return ok; 
+            this.logger.log(5, "No window found: "+contentLocation.spec);
+            return block; 
         }
 
+        // This happens on the first load of a doc
         if (typeof(browser.__tb_tor_fetched) == 'undefined') {
-            this.logger.log(5, "UNTAGGED WINDOW2!!!!!!!!! "+contentLocation.spec);
-            return block;
+            this.logger.log(3, "Untagged window for "+contentLocation.spec);
+            return ok;
         }
 
         if(browser.__tb_tor_fetched == tor_state) {

Modified: torbutton/trunk/src/components/window-mapper.js
===================================================================
--- torbutton/trunk/src/components/window-mapper.js	2007-11-23 05:47:11 UTC (rev 12556)
+++ torbutton/trunk/src/components/window-mapper.js	2007-11-23 11:25:29 UTC (rev 12557)
@@ -99,8 +99,6 @@
       }
   },
 
-  // XXX: Handle case where browser XUL *is* the content window!
-  // (favicons and the like..)
   getBrowserForContentWindow: function(topContentWindow) {
       var cached = this.checkCache(topContentWindow);
       if(cached != null) return cached;
@@ -120,10 +118,15 @@
           }
       }
 
+      if(topContentWindow instanceof Components.interfaces.nsIDOMChromeWindow) {
+          this.logger.log(3, "Chrome browser found: "+topContentWindow.location);
+          return topContentWindow.getBrowser().selectedTab.linkedBrowser;
+      }
+
       if(topContentWindow && topContentWindow.location)
-          this.logger.log(3, "No browser found: "+topContentWindow.location);
+          this.logger.log(5, "No browser found: "+topContentWindow.location);
       else
-          this.logger.log(3, "No browser found!");
+          this.logger.log(5, "No browser found!");
 
       return null;
   }