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

[or-cvs] r15415: Check firefox version before loading FF2 sessionstore. (torbutton/trunk/src/components)



Author: mikeperry
Date: 2008-06-22 05:46:39 -0400 (Sun, 22 Jun 2008)
New Revision: 15415

Modified:
   torbutton/trunk/src/components/nsSessionStore2.js
Log:

Check firefox version before loading FF2 sessionstore.



Modified: torbutton/trunk/src/components/nsSessionStore2.js
===================================================================
--- torbutton/trunk/src/components/nsSessionStore2.js	2008-06-22 09:40:32 UTC (rev 15414)
+++ torbutton/trunk/src/components/nsSessionStore2.js	2008-06-22 09:46:39 UTC (rev 15415)
@@ -2213,7 +2213,16 @@
 function NSGetModule(aComMgr, aFileSpec) {
   var prefs = Components.classes["@mozilla.org/preferences-service;1"]
         .getService(Components.interfaces.nsIPrefBranch);
-  if(prefs.getBoolPref("extensions.torbutton.notor_sessionstore")) {
+  
+  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);
+
+  // Only hook the sessionstore if the pref is enabled and we're firefox 2.
+  if((prefs.getBoolPref("extensions.torbutton.notor_sessionstore") 
+        || prefs.getBoolPref("extensions.torbutton.nonontor_sessionstore"))
+      && versionChecker.compare(appInfo.version, "3.0a1") <= 0) {
     return SessionStoreModule;
   } else {
     return NoModule;