[or-cvs] r15265: Fix the torbutton half of a Firefox 3-specific bug involving (in torbutton/trunk/src: . components)
mikeperry at seul.org
mikeperry at seul.org
Sun Jun 15 03:27:50 UTC 2008
Author: mikeperry
Date: 2008-06-14 23:27:49 -0400 (Sat, 14 Jun 2008)
New Revision: 15265
Modified:
torbutton/trunk/src/components/cookie-jar-selector.js
torbutton/trunk/src/install.rdf
Log:
Fix the torbutton half of a Firefox 3-specific bug involving
cookie jars. Firefox 3 still doesn't properly listen to
"profile-do-change" events though, so cookies still aren't
properly restored from jars. :/
Modified: torbutton/trunk/src/components/cookie-jar-selector.js
===================================================================
--- torbutton/trunk/src/components/cookie-jar-selector.js 2008-06-15 02:34:26 UTC (rev 15264)
+++ torbutton/trunk/src/components/cookie-jar-selector.js 2008-06-15 03:27:49 UTC (rev 15265)
@@ -20,6 +20,9 @@
var Cc = Components.classes;
var Ci = Components.interfaces;
+ this.logger = Components.classes["@torproject.org/torbutton-logger;1"]
+ .getService(Components.interfaces.nsISupports).wrappedJSObject;
+
var getProfileFile = function(filename) {
var loc = "ProfD"; // profile directory
var file =
@@ -70,7 +73,7 @@
cookieManager.observe(this, "profile-before-change", "");
// Tell the cookie manager to reload cookies from disk
cookieManager.observe(this, "profile-do-change", "");
- copyProfileFile("cookies.txt", "cookies-" + name + ".txt");
+ copyProfileFile("cookies"+this.extn, "cookies-" + name + this.extn);
};
this.loadCookies = function(name, deleteSavedCookieJar) {
@@ -85,12 +88,28 @@
// Replace the cookies.txt file with the loaded data
var fn = deleteSavedCookieJar ? moveProfileFile : copyProfileFile;
- fn("cookies-" + name + ".txt", "cookies.txt");
+ fn("cookies-"+name+this.extn, "cookies"+this.extn);
// Tell the cookie manager to reload cookies from disk
cookieManager.observe(this, "profile-do-change", context);
+ this.logger.log(2, "Cookies reloaded");
};
+ // Check firefox version to know filename
+ 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.is_ff3 = true;
+ this.extn = ".sqlite";
+ } else {
+ this.is_ff3 = false;
+ this.extn = ".txt";
+ }
+
+
// This JSObject is exported directly to chrome
this.wrappedJSObject = this;
}
Modified: torbutton/trunk/src/install.rdf
===================================================================
--- torbutton/trunk/src/install.rdf 2008-06-15 02:34:26 UTC (rev 15264)
+++ torbutton/trunk/src/install.rdf 2008-06-15 03:27:49 UTC (rev 15265)
@@ -6,7 +6,7 @@
<em:name>Torbutton</em:name>
<em:creator>Mike Perry & Scott Squires</em:creator>
<em:id>{e0204bd5-9d31-402b-a99d-a6aa8ffebdca}</em:id>
- <em:version>1.2.0rc2tb</em:version>
+ <em:version>1.2.0rc2-dev</em:version>
<em:homepageURL>https://torbutton.torproject.org/dev/</em:homepageURL>
<em:optionsURL>chrome://torbutton/content/preferences.xul</em:optionsURL>
<em:iconURL>chrome://torbutton/skin/tor.png</em:iconURL>
More information about the tor-commits
mailing list