[or-cvs] r18698: {torbutton} Fix sessionstore issues from bug 834 and add some log messag (in torbutton/branches/torbutton-1_2_x/src: . chrome/content components)

mikeperry at seul.org mikeperry at seul.org
Thu Feb 26 15:10:46 UTC 2009


Author: mikeperry
Date: 2009-02-26 10:10:45 -0500 (Thu, 26 Feb 2009)
New Revision: 18698

Modified:
   torbutton/branches/torbutton-1_2_x/src/CHANGELOG
   torbutton/branches/torbutton-1_2_x/src/chrome/content/torbutton.js
   torbutton/branches/torbutton-1_2_x/src/components/cookie-jar-selector.js
   torbutton/branches/torbutton-1_2_x/src/components/crash-observer.js
   torbutton/branches/torbutton-1_2_x/src/components/cssblocker.js
   torbutton/branches/torbutton-1_2_x/src/components/ignore-history.js
   torbutton/branches/torbutton-1_2_x/src/components/nsSessionStore3.diff
   torbutton/branches/torbutton-1_2_x/src/components/nsSessionStore3.js
   torbutton/branches/torbutton-1_2_x/src/components/torbutton-logger.js
   torbutton/branches/torbutton-1_2_x/src/components/window-mapper.js
Log:

Fix sessionstore issues from bug 834 and add some log messages
for keeping an eye on component load order.



Modified: torbutton/branches/torbutton-1_2_x/src/CHANGELOG
===================================================================
--- torbutton/branches/torbutton-1_2_x/src/CHANGELOG	2009-02-26 14:52:53 UTC (rev 18697)
+++ torbutton/branches/torbutton-1_2_x/src/CHANGELOG	2009-02-26 15:10:45 UTC (rev 18698)
@@ -1,3 +1,7 @@
+1.2.1
+  ?? Mar 2008
+  * bugfix: bug 834: Fix session saving and startup issues
+
 1.2.0
   30 Jul 2008
   * bugfix: bug 777: Fix issue with locale spoofing breaking translations.

Modified: torbutton/branches/torbutton-1_2_x/src/chrome/content/torbutton.js
===================================================================
--- torbutton/branches/torbutton-1_2_x/src/chrome/content/torbutton.js	2009-02-26 14:52:53 UTC (rev 18697)
+++ torbutton/branches/torbutton-1_2_x/src/chrome/content/torbutton.js	2009-02-26 15:10:45 UTC (rev 18698)
@@ -1871,7 +1871,11 @@
             if(m_tb_prefs.getBoolPref("extensions.torbutton.normal_exit")) {
                 m_tb_prefs.setBoolPref("extensions.torbutton.normal_exit", false);
                 m_tb_prefs.setBoolPref("extensions.torbutton.crashed", false);
-                torbutton_log(3, "False positive crash recovery averted");
+                torbutton_log(3, "False positive crash recovery. Setting tor state");
+                if(m_tb_prefs.getBoolPref("extensions.torbutton.restore_tor"))
+                    torbutton_conditional_set(true);
+                else
+                    torbutton_conditional_set(false);
                 return;
             }
         } catch(e) {

Modified: torbutton/branches/torbutton-1_2_x/src/components/cookie-jar-selector.js
===================================================================
--- torbutton/branches/torbutton-1_2_x/src/components/cookie-jar-selector.js	2009-02-26 14:52:53 UTC (rev 18697)
+++ torbutton/branches/torbutton-1_2_x/src/components/cookie-jar-selector.js	2009-02-26 15:10:45 UTC (rev 18698)
@@ -22,7 +22,9 @@
 
   this.logger = Components.classes["@torproject.org/torbutton-logger;1"]
       .getService(Components.interfaces.nsISupports).wrappedJSObject;
-    
+
+  this.logger.log(3, "Component Load 5: New CookieJarSelector "+kMODULE_CONTRACTID);
+
   this.prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
 
   var getProfileFile = function(filename) {

Modified: torbutton/branches/torbutton-1_2_x/src/components/crash-observer.js
===================================================================
--- torbutton/branches/torbutton-1_2_x/src/components/crash-observer.js	2009-02-26 14:52:53 UTC (rev 18697)
+++ torbutton/branches/torbutton-1_2_x/src/components/crash-observer.js	2009-02-26 15:10:45 UTC (rev 18698)
@@ -33,14 +33,13 @@
 };
 
 function StoreWrapper() {
-  this._prefs = Components.classes["@mozilla.org/preferences-service;1"]
-      .getService(Components.interfaces.nsIPrefBranch);
-
   this.logger = Components.classes["@torproject.org/torbutton-logger;1"]
       .getService(Components.interfaces.nsISupports).wrappedJSObject;
-  //dump("New crash observer\n");
-  this.logger.log(3, "New StoreWrapper");
+  this.logger.log(3, "Component Load 4: New StoreWrapper "+kMODULE_CONTRACTID);
 
+  this._prefs = Components.classes["@mozilla.org/preferences-service;1"]
+      .getService(Components.interfaces.nsIPrefBranch);
+
   this._store = function() {
     var store = kREAL_STORE.getService();
     for (var i = 0; i < kStoreInterfaces.length; i++) {

Modified: torbutton/branches/torbutton-1_2_x/src/components/cssblocker.js
===================================================================
--- torbutton/branches/torbutton-1_2_x/src/components/cssblocker.js	2009-02-26 14:52:53 UTC (rev 18697)
+++ torbutton/branches/torbutton-1_2_x/src/components/cssblocker.js	2009-02-26 15:10:45 UTC (rev 18698)
@@ -102,14 +102,15 @@
      "file":true, "view-source":true, "about":true};
 
 function ContentPolicy() {
+    this.logger = Components.classes["@torproject.org/torbutton-logger;1"]
+        .getService(Components.interfaces.nsISupports).wrappedJSObject;
+    this.logger.log(3, "Component Load 1: New ContentPolicy ("+CSSB_CONTRACTID+")");
+
     this._prefs = Components.classes["@mozilla.org/preferences-service;1"]
         .getService(Components.interfaces.nsIPrefBranch);
     this.wm = Components.classes["@torproject.org/content-window-mapper;1"]
         .getService(Components.interfaces.nsISupports)
         .wrappedJSObject;
-    
-    this.logger = Components.classes["@torproject.org/torbutton-logger;1"]
-        .getService(Components.interfaces.nsISupports).wrappedJSObject;
 
     // Register observer: 
     var pref_service = Components.classes["@mozilla.org/preferences-service;1"]

Modified: torbutton/branches/torbutton-1_2_x/src/components/ignore-history.js
===================================================================
--- torbutton/branches/torbutton-1_2_x/src/components/ignore-history.js	2009-02-26 14:52:53 UTC (rev 18697)
+++ torbutton/branches/torbutton-1_2_x/src/components/ignore-history.js	2009-02-26 15:10:45 UTC (rev 18698)
@@ -42,6 +42,10 @@
 
 
 function HistoryWrapper() {
+  this.logger = Components.classes["@torproject.org/torbutton-logger;1"]
+      .getService(Components.interfaces.nsISupports).wrappedJSObject;
+  this.logger.log(3, "Component Load 3: New HistoryWrapper "+kMODULE_CONTRACTID3);
+
   // assuming we're running under Firefox
   var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
       .getService(Components.interfaces.nsIXULAppInfo);

Modified: torbutton/branches/torbutton-1_2_x/src/components/nsSessionStore3.diff
===================================================================
--- torbutton/branches/torbutton-1_2_x/src/components/nsSessionStore3.diff	2009-02-26 14:52:53 UTC (rev 18697)
+++ torbutton/branches/torbutton-1_2_x/src/components/nsSessionStore3.diff	2009-02-26 15:10:45 UTC (rev 18698)
@@ -1,5 +1,5 @@
---- nsSessionStore3.js	2009-02-25 02:14:54.000000000 -0800
-+++ nsSessionStore3.js	2009-02-25 02:24:04.000000000 -0800
+--- nsSessionStore3.js.orig	2009-02-25 02:23:59.000000000 -0800
++++ nsSessionStore3.js	2009-02-26 07:01:10.000000000 -0800
 @@ -99,9 +99,21 @@
    "Subframes", "Plugins", "Javascript", "MetaRedirects", "Images"
  ];
@@ -25,7 +25,17 @@
  
  function debug(aMsg) {
    aMsg = ("SessionStore: " + aMsg).replace(/\S{80}/g, "$&\n");
-@@ -857,9 +869,23 @@
+@@ -112,6 +124,9 @@
+ /* :::::::: The Service ::::::::::::::: */
+ 
+ function SessionStoreService() {
++  this.logger = Components.classes["@torproject.org/torbutton-logger;1"]
++      .getService(Components.interfaces.nsISupports).wrappedJSObject;
++  this.logger.log(3, "Component Load: New SessionStoreService @mozilla.org/browser/sessionstore;1");
+ }
+ 
+ SessionStoreService.prototype = {
+@@ -857,9 +872,26 @@
      var tabbrowser = aWindow.getBrowser();
      var tabs = tabbrowser.mTabs;
      var tabsData = this._windows[aWindow.__SSi].tabs = [];
@@ -40,19 +50,22 @@
 +    for (var i = 0; i < tabs.length; i++) {
 +      if(typeof(tabs[i].linkedBrowser.__tb_tor_fetched) != "undefined") {
 +          if(bypass_tor && tabs[i].linkedBrowser.__tb_tor_fetched) {
++              this.logger.log(2, "Skipping saving tor tab: "+tabs[i].linkedBrowser.currentURI.spec);
 +              continue; 
 +          }
 +          if(bypass_nontor && !tabs[i].linkedBrowser.__tb_tor_fetched) {
++              this.logger.log(2, "Skipping saving non-tor tab: "+tabs[i].linkedBrowser.currentURI.spec);
 +              continue; 
 +          }
 +      }
++      this.logger.log(2, "Saving tab: "+tabs[i].linkedBrowser.currentURI.spec);
 +      var tabData = this._collectTabData(tabs[i]);
 +      if(tabData) tabsData.push(tabData);
 +    }
      
      this._windows[aWindow.__SSi].selected = tabbrowser.mTabBox.selectedIndex + 1;
    },
-@@ -892,6 +918,7 @@
+@@ -892,6 +924,7 @@
      if (history && browser.parentNode.__SS_data &&
          browser.parentNode.__SS_data.entries[history.index] && !aFullData) {
        tabData = browser.parentNode.__SS_data;
@@ -60,7 +73,7 @@
        tabData.index = history.index + 1;
      }
      else if (history && history.count > 0) {
-@@ -1109,7 +1136,7 @@
+@@ -1109,7 +1142,7 @@
      for (var i = 0; i < browsers.length; i++) {
        try {
          var tabData = this._windows[aWindow.__SSi].tabs[i];
@@ -69,7 +82,7 @@
              browsers[i].parentNode.__SS_data && browsers[i].parentNode.__SS_data._tab)
            continue; // ignore incompletely initialized tabs
          this._updateTextAndScrollDataForTab(aWindow, browsers[i], tabData);
-@@ -2182,5 +2209,24 @@
+@@ -2182,5 +2215,23 @@
    }
  };
  
@@ -89,8 +102,7 @@
 +function NSGetModule(aComMgr, aFileSpec) {
 +  var prefs = Components.classes["@mozilla.org/preferences-service;1"]
 +        .getService(Components.interfaces.nsIPrefBranch);
-+  if(is_FF3 && (prefs.getBoolPref("extensions.torbutton.notor_sessionstore") 
-+        || prefs.getBoolPref("extensions.torbutton.nonontor_sessionstore"))) {
++  if(is_FF3) {
 +      return XPCOMUtils.generateModule([SessionStoreService]);
 +  } else {
 +      return NoModule;

Modified: torbutton/branches/torbutton-1_2_x/src/components/nsSessionStore3.js
===================================================================
--- torbutton/branches/torbutton-1_2_x/src/components/nsSessionStore3.js	2009-02-26 14:52:53 UTC (rev 18697)
+++ torbutton/branches/torbutton-1_2_x/src/components/nsSessionStore3.js	2009-02-26 15:10:45 UTC (rev 18698)
@@ -124,6 +124,9 @@
 /* :::::::: The Service ::::::::::::::: */
 
 function SessionStoreService() {
+  this.logger = Components.classes["@torproject.org/torbutton-logger;1"]
+      .getService(Components.interfaces.nsISupports).wrappedJSObject;
+  this.logger.log(3, "Component Load: New SessionStoreService @mozilla.org/browser/sessionstore;1");
 }
 
 SessionStoreService.prototype = {
@@ -877,12 +880,15 @@
     for (var i = 0; i < tabs.length; i++) {
       if(typeof(tabs[i].linkedBrowser.__tb_tor_fetched) != "undefined") {
           if(bypass_tor && tabs[i].linkedBrowser.__tb_tor_fetched) {
+              this.logger.log(2, "Skipping saving tor tab: "+tabs[i].linkedBrowser.currentURI.spec);
               continue; 
           }
           if(bypass_nontor && !tabs[i].linkedBrowser.__tb_tor_fetched) {
+              this.logger.log(2, "Skipping saving non-tor tab: "+tabs[i].linkedBrowser.currentURI.spec);
               continue; 
           }
       }
+      this.logger.log(2, "Saving tab: "+tabs[i].linkedBrowser.currentURI.spec);
       var tabData = this._collectTabData(tabs[i]);
       if(tabData) tabsData.push(tabData);
     }
@@ -2223,8 +2229,7 @@
 function NSGetModule(aComMgr, aFileSpec) {
   var prefs = Components.classes["@mozilla.org/preferences-service;1"]
         .getService(Components.interfaces.nsIPrefBranch);
-  if(is_FF3 && (prefs.getBoolPref("extensions.torbutton.notor_sessionstore") 
-        || prefs.getBoolPref("extensions.torbutton.nonontor_sessionstore"))) {
+  if(is_FF3) {
       return XPCOMUtils.generateModule([SessionStoreService]);
   } else {
       return NoModule;

Modified: torbutton/branches/torbutton-1_2_x/src/components/torbutton-logger.js
===================================================================
--- torbutton/branches/torbutton-1_2_x/src/components/torbutton-logger.js	2009-02-26 14:52:53 UTC (rev 18697)
+++ torbutton/branches/torbutton-1_2_x/src/components/torbutton-logger.js	2009-02-26 15:10:45 UTC (rev 18698)
@@ -39,6 +39,8 @@
 
     // This JSObject is exported directly to chrome
     this.wrappedJSObject = this;
+
+    dump("Torbutton logger online\n");
 }
 
 /**

Modified: torbutton/branches/torbutton-1_2_x/src/components/window-mapper.js
===================================================================
--- torbutton/branches/torbutton-1_2_x/src/components/window-mapper.js	2009-02-26 14:52:53 UTC (rev 18697)
+++ torbutton/branches/torbutton-1_2_x/src/components/window-mapper.js	2009-02-26 15:10:45 UTC (rev 18698)
@@ -26,6 +26,7 @@
 
     this.logger = Components.classes["@torproject.org/torbutton-logger;1"]
         .getService(Components.interfaces.nsISupports).wrappedJSObject;
+    this.logger.log(3, "Component Load 2: Content window mapper online: "+kMODULE_CONTRACTID);
     this.last_expired = Date.now();
     // This JSObject is exported directly to chrome
     this.wrappedJSObject = this;



More information about the tor-commits mailing list