[or-cvs] r13252: Begin work on FF3 support. Update homepage, update info to u (in torbutton/trunk/src: . chrome/content components)

mikeperry at seul.org mikeperry at seul.org
Thu Jan 24 05:00:28 UTC 2008


Author: mikeperry
Date: 2008-01-24 00:00:28 -0500 (Thu, 24 Jan 2008)
New Revision: 13252

Modified:
   torbutton/trunk/src/chrome/content/about.xul
   torbutton/trunk/src/chrome/content/torbutton.js
   torbutton/trunk/src/components/cssblocker.js
   torbutton/trunk/src/components/ignore-history.js
   torbutton/trunk/src/install.rdf
Log:

Begin work on FF3 support. Update homepage, update info to
use new url.



Modified: torbutton/trunk/src/chrome/content/about.xul
===================================================================
--- torbutton/trunk/src/chrome/content/about.xul	2008-01-24 04:45:30 UTC (rev 13251)
+++ torbutton/trunk/src/chrome/content/about.xul	2008-01-24 05:00:28 UTC (rev 13252)
@@ -18,8 +18,8 @@
     <label value="Torbutton" style="font-weight: bold;"/>
     <label id="torbuttonVersion"/>
     <label value="Scott Squires & Mike Perry"/>
-    <label value="http://freehaven.net/~squires/torbutton/"
+    <label value="https://torbutton.torproject.org/dev"
           class="url"
           style="color: blue; text-decoration: underline;"
-          onclick="window.open('http://freehaven.net/~squires/torbutton/');"/>
+          onclick="window.open('https://torbutton.torproject.org/dev');"/>
 </dialog>

Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js	2008-01-24 04:45:30 UTC (rev 13251)
+++ torbutton/trunk/src/chrome/content/torbutton.js	2008-01-24 05:00:28 UTC (rev 13252)
@@ -930,8 +930,14 @@
         torbutton_log(4, "Crash detected, attempting recovery");
         m_tb_prefs.setBoolPref("extensions.torbutton.tor_enabled", 
                 torbutton_check_status());
+       
+        // Do the restore cookies first because we potentially save
+        // cookies by toggling tor state in the next pref. If we
+        // do this first, we can be sure we have the 'right' cookies
+        // currently loaded before the switch writes out a new jar
         if(m_tb_prefs.getBoolPref("extensions.torbutton.reload_crashed_jar"))
             torbutton_restore_cookies();
+
         if(m_tb_prefs.getBoolPref("extensions.torbutton.restore_tor"))
             torbutton_conditional_set(true);
         else
@@ -1331,6 +1337,10 @@
                             window.alert("Torbutton blocked direct Tor load of plugin content.\n\nUse Save-As instead.\n\n");
                             aProgress.DOMWindow.__tb_kill_flag = true;
                         }
+                        // This doesn't seem to actually remove the child..
+                        // It usually just causes an exception to be thrown,
+                        // which strangely enough, actually does finally 
+                        // kill the plugin.
                         aProgress.DOMWindow.document.removeChild(
                                 aProgress.DOMWindow.document.firstChild);
                     } catch(e) {

Modified: torbutton/trunk/src/components/cssblocker.js
===================================================================
--- torbutton/trunk/src/components/cssblocker.js	2008-01-24 04:45:30 UTC (rev 13251)
+++ torbutton/trunk/src/components/cssblocker.js	2008-01-24 05:00:28 UTC (rev 13252)
@@ -20,7 +20,7 @@
  *************************************************************************/
 
 // This is all local scope
-const CSSB_CONTRACTID = "@freehaven.net/cssblocker;1";
+const CSSB_CONTRACTID = "@torproject.org/cssblocker;1";
 const CSSB_CID = Components.ID("{23f4d9ba-023a-94ab-eb75-67aed7562a18}");
 
 const DNode = Components.interfaces.nsIDOMNode;
@@ -208,7 +208,6 @@
             this.logger.log(3, "Blocking: "+contentLocation.spec);
             return block;
         }
-
 	},
 
 	shouldProcess: function(contentType, contentLocation, requestOrigin, insecNode, mimeType, extra) {

Modified: torbutton/trunk/src/components/ignore-history.js
===================================================================
--- torbutton/trunk/src/components/ignore-history.js	2008-01-24 04:45:30 UTC (rev 13251)
+++ torbutton/trunk/src/components/ignore-history.js	2008-01-24 05:00:28 UTC (rev 13252)
@@ -16,19 +16,33 @@
 const kMODULE_CONTRACTID = "@mozilla.org/browser/global-history;2";
 const kMODULE_CID = Components.ID("bc666d45-a9a1-4096-9511-f6db6f686881");
 
-/* Mozilla defined interfaces */
-const kREAL_HISTORY_CID = "{59648a91-5a60-4122-8ff2-54b839c84aed}";
-const kREAL_HISTORY = Components.classesByID[kREAL_HISTORY_CID];
+/* Mozilla defined interfaces for FF3.0 and 2.0 */
+const kREAL_HISTORY_CID3 = "{88cecbb7-6c63-4b3b-8cd4-84f3b8228c69}";
+const kREAL_HISTORY_CID2 = "{59648a91-5a60-4122-8ff2-54b839c84aed}";
+
+// const kREAL_HISTORY = Components.classesByID[kREAL_HISTORY_CID];
+
 const kHistoryInterfaces = [ "nsIBrowserHistory", "nsIGlobalHistory2" ];
 
 const Cr = Components.results;
 
 function HistoryWrapper() {
+  // assuming we're running under Firefox
+  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);
+  if(versionChecker.compare(appInfo.version, "3.0a1") >= 0) {
+    this._real_history = Components.classesByID[kREAL_HISTORY_CID3];
+  } else {
+    this._real_history = Components.classesByID[kREAL_HISTORY_CID2];
+  }
+
   this._prefs = Components.classes["@mozilla.org/preferences-service;1"]
       .getService(Components.interfaces.nsIPrefBranch);
 
   this._history = function() {
-    var history = kREAL_HISTORY.getService();
+    var history = this._real_history.getService();
     for (var i = 0; i < kHistoryInterfaces.length; i++) {
       history.QueryInterface(Components.interfaces[kHistoryInterfaces[i]]);
     }
@@ -52,6 +66,7 @@
   /*
    * Determine whether we should hide visited links
    */
+  // XXX: Make observer?
   blockReadHistory: function() {
     return ((this._prefs.getBoolPref("extensions.torbutton.block_thread") 
             && this._prefs.getBoolPref("extensions.torbutton.tor_enabled"))
@@ -125,6 +140,7 @@
     return null;
   }
 
+  // XXX: needs updating for FF3
   if (!iid.equals(Components.interfaces.nsIGlobalHistory2) &&
       !iid.equals(Components.interfaces.nsIBrowserHistory) &&
     !iid.equals(Components.interfaces.nsISupports)) {

Modified: torbutton/trunk/src/install.rdf
===================================================================
--- torbutton/trunk/src/install.rdf	2008-01-24 04:45:30 UTC (rev 13251)
+++ torbutton/trunk/src/install.rdf	2008-01-24 05:00:28 UTC (rev 13252)
@@ -16,7 +16,7 @@
             <Description>
                 <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
                 <em:minVersion>2.0</em:minVersion>
-                <em:maxVersion>2.0.0.*</em:maxVersion>
+                <em:maxVersion>3.0b*</em:maxVersion>
             </Description>
         </em:targetApplication>
 



More information about the tor-commits mailing list