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

[or-cvs] r15823: Fix bug 753. Also potential fix for some cases of 758 (0x0 w (torbutton/trunk/src/chrome/content)



Author: mikeperry
Date: 2008-07-10 15:08:37 -0400 (Thu, 10 Jul 2008)
New Revision: 15823

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

Fix bug 753. Also potential fix for some cases of 758 (0x0
windows).



Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js	2008-07-10 18:34:45 UTC (rev 15822)
+++ torbutton/trunk/src/chrome/content/torbutton.js	2008-07-10 19:08:37 UTC (rev 15823)
@@ -974,7 +974,12 @@
     if (m_tb_prefs.getBoolPref('extensions.torbutton.clear_cache')) {
         var cache = Components.classes["@mozilla.org/network/cache-service;1"].
         getService(Components.interfaces.nsICacheService);
-        cache.evictEntries(0);
+        // Throws exception on FF3 sometimes.. who knows why. FF3 bug?
+        try {
+            cache.evictEntries(0);
+        } catch(e) {
+            torbutton_log(3, "Exception on cache clearing: "+e);
+        }
     }
 
     if (m_tb_prefs.getBoolPref('extensions.torbutton.clear_history')) {
@@ -2165,9 +2170,14 @@
         if(Math.abs(browser.contentWindow.innerHeight - 
            Math.floor(Math.round(browser.contentWindow.innerHeight/50.0)*50))
            > 0.1) {
-            torbutton_log(2, "Restoring orig window size");
-            window.outerHeight = m_tb_window_height;
-            window.outerWidth = m_tb_window_width;
+            if(m_tb_window_height < 100 && m_tb_window_width < 100) {
+                torbutton_log(4, "Window size damn near zero: ("+
+                        m_tb_window_height+", "+m_tb_window_width+")");
+            } else {
+                torbutton_log(3, "Restoring orig window size");
+                window.outerHeight = m_tb_window_height;
+                window.outerWidth = m_tb_window_width;
+            }
         }
 
         // Always round.