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

[or-cvs] r14135: Fix bug 638. Retag all windows on crash to catch the first t (in torbutton/trunk/src: chrome/content components)



Author: mikeperry
Date: 2008-03-20 03:02:19 -0400 (Thu, 20 Mar 2008)
New Revision: 14135

Modified:
   torbutton/trunk/src/chrome/content/torbutton.js
   torbutton/trunk/src/components/cssblocker.js
Log:

Fix bug 638. Retag all windows on crash to catch the first
tab/tabs opened before session restore.



Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js	2008-03-20 00:04:39 UTC (rev 14134)
+++ torbutton/trunk/src/chrome/content/torbutton.js	2008-03-20 07:02:19 UTC (rev 14135)
@@ -1056,7 +1056,31 @@
 
 function torbutton_conditional_set(state) {
     if (!m_tb_wasinited) torbutton_init();
+    var no_plugins = m_tb_prefs.getBoolPref("extensions.torbutton.no_tor_plugins");
+            
+    torbutton_log(3, "Conditional set");
+    
+    // Need to set the tag on all tabs, some of them can be mis-set when
+    // the first window is created (before session restore)
+    var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+                       .getService(Components.interfaces.nsIWindowMediator);
+    var enumerator = wm.getEnumerator("navigator:browser");
+    var js_enabled = m_tb_prefs.getBoolPref("javascript.enabled");
+    while(enumerator.hasMoreElements()) {
+        var win = enumerator.getNext();
+        var browser = win.getBrowser();
+        var browsers = browser.browsers;
 
+        for (var i = 0; i < browsers.length; ++i) {
+            var b = browser.browsers[i];
+
+            if (!state && no_plugins) {
+                b.docShell.allowPlugins = false;
+            } 
+            b.__tb_tor_fetched = state;
+        }
+    }
+
     torbutton_log(4, "Restoring tor state");
     if (torbutton_check_status() == state) return;
     

Modified: torbutton/trunk/src/components/cssblocker.js
===================================================================
--- torbutton/trunk/src/components/cssblocker.js	2008-03-20 00:04:39 UTC (rev 14134)
+++ torbutton/trunk/src/components/cssblocker.js	2008-03-20 07:02:19 UTC (rev 14135)
@@ -149,7 +149,7 @@
             return ok;
         }
             
-        this.logger.log(2, "Cpolicy load of: "+contentLocation.spec+" from: "+
+        this.logger.log(1, "Cpolicy load of: "+contentLocation.spec+" from: "+
                         (( null == requestOrigin ) ? "<null>" : requestOrigin.spec));
 
         var utmp = unwrapURL(contentLocation.spec, false);