[or-cvs] r15858: Fix bug that lost history in some situations. (in torbutton/trunk/src: chrome/content components)

mikeperry at seul.org mikeperry at seul.org
Sat Jul 12 20:49:16 UTC 2008


Author: mikeperry
Date: 2008-07-12 16:49:16 -0400 (Sat, 12 Jul 2008)
New Revision: 15858

Modified:
   torbutton/trunk/src/chrome/content/torbutton.js
   torbutton/trunk/src/components/ignore-history.js
Log:

Fix bug that lost history in some situations.



Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js	2008-07-12 18:18:17 UTC (rev 15857)
+++ torbutton/trunk/src/chrome/content/torbutton.js	2008-07-12 20:49:16 UTC (rev 15858)
@@ -986,8 +986,6 @@
 
     if(mode) {
         if(m_tb_prefs.getBoolPref('extensions.torbutton.block_thwrite')) {
-            torbutton_setIntPref("browser.history_expire_days", 
-                    "expire_history", 0, mode, changed);
             torbutton_setIntPref("browser.download.manager.retention", 
                     "download_retention", 0, mode, changed);
         } 
@@ -1000,11 +998,8 @@
         }
     } else {
         if(m_tb_prefs.getBoolPref('extensions.torbutton.block_nthwrite')) {
-            m_tb_prefs.setIntPref("browser.history_expire_days", 0);
             m_tb_prefs.setIntPref("browser.download.manager.retention", 0);
         } else {
-            torbutton_setIntPref("browser.history_expire_days", 
-                    "expire_history", 0, mode, changed);
             torbutton_setIntPref("browser.download.manager.retention", 
                     "download_retention", 0, mode, changed);
         }

Modified: torbutton/trunk/src/components/ignore-history.js
===================================================================
--- torbutton/trunk/src/components/ignore-history.js	2008-07-12 18:18:17 UTC (rev 15857)
+++ torbutton/trunk/src/components/ignore-history.js	2008-07-12 20:49:16 UTC (rev 15858)
@@ -33,6 +33,14 @@
 
 const Cr = Components.results;
 
+var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
+                .getService(Components.interfaces.nsIXULAppInfo);
+var versionChecker = Components.classes["@mozilla.org/xpcom/version-comparator;1"]
+                       .getService(Components.interfaces.nsIVersionComparator);
+var is_ff3 = (versionChecker.compare(appInfo.version, "3.0a1") >= 0);
+
+
+
 function HistoryWrapper() {
   // assuming we're running under Firefox
   var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
@@ -146,7 +154,7 @@
           else call = "()";
           var fun = "(function "+call+"{if (arguments.length < "+wrapped[method].length+") throw Components.results.NS_ERROR_XPC_NOT_ENOUGH_ARGS; return wrapped."+method+".apply(wrapped, arguments);})";
           newObj[method] = eval(fun);
-      } else {
+       } else {
           newObj.__defineGetter__(method, function() { return wrapped[method]; });
           newObj.__defineSetter__(method, function(val) { wrapped[method] = val; });
       }
@@ -180,8 +188,59 @@
       this._history().setPageTitle(URI, title);
   },
 
+  markPageAsTyped: function(aUri) {
+      if(this.blockWriteHistory()) {
+          return;
+      }
+      return this._history().markPageAsTyped(aUri);
+  },
+
+  addPageWithDetails: function(aUri, aTitle, aVisited) { 
+      if(this.blockWriteHistory()) {
+          return;
+      }
+      return this._history().addPageWithDetails(aUri, aTitle, aVisited);
+  },
+
+  setPageTitle: function(aUri, aTitle) {
+      if(this.blockWriteHistory()) {
+          return;
+      }
+      return this._history().setPageTitle(aUri, aTitle);
+  },
+
   count getter: function() { return this._history().count; },
 };
+
+// Block firefox3 history writes..
+if(is_ff3) {
+    // addDocumentRedirect() - currently not needed. It does not touch the DB
+
+
+    // XXX: hrmm...
+    HistoryWrapper.prototype.setPageDetails = function(aUri, aTitle, aVisitCnt, aHidden, aTyped) {
+        if(this.blockWriteHistory()) {
+            return;
+        }
+        return this._history().setPageDetails(aUri, aTitle, aVisitCnt, aHidden, aTyped);
+    };
+
+    HistoryWrapper.prototype.markPageAsFollowedBookmark = function(aUri) {
+        if(this.blockWriteHistory()) {
+            return;
+        }
+        return this._history().markPageAsFollowedBookmark(aUri);
+    };
+
+    // This gets addVisited
+    HistoryWrapper.prototype.canAddURI = function(aUri) {
+        if(this.blockWriteHistory()) {
+            return false;
+        }
+        return this._history().canAddURI(aUri);
+    };
+
+}
  
 var HistoryWrapperSingleton = null;
 var HistoryWrapperFactory = new Object();
@@ -218,7 +277,7 @@
 var HistoryWrapperModule = new Object();
 
 HistoryWrapperModule.registerSelf = 
-function (compMgr, fileSpec, location, type){
+function (compMgr, fileSpec, location, type) {
   var nsIComponentRegistrar = Components.interfaces.nsIComponentRegistrar;
   compMgr = compMgr.QueryInterface(nsIComponentRegistrar);
   compMgr.registerFactoryLocation(kMODULE_CID,



More information about the tor-commits mailing list