Bug 684107 - Remove private browsing code from DownloadLastDir.jsm after
bug 679784 is fixed; r=ehsan
--- a/toolkit/mozapps/downloads/DownloadLastDir.jsm
+++ b/toolkit/mozapps/downloads/DownloadLastDir.jsm
@@ -78,24 +78,22 @@ let observer = {
},
observe: function (aSubject, aTopic, aData) {
switch (aTopic) {
case "private-browsing":
if (aData == "enter")
gDownloadLastDirFile = readLastDirPref();
else if (aData == "exit") {
gDownloadLastDirFile = null;
- gDownloadLastDirStore = new Dict();
}
break;
case "browser:purge-session-history":
gDownloadLastDirFile = null;
if (Services.prefs.prefHasUserValue(LAST_DIR_PREF))
Services.prefs.clearUserPref(LAST_DIR_PREF);
- gDownloadLastDirStore = new Dict();
Services.contentPrefs.removePrefsByName(LAST_DIR_PREF);
break;
}
}
};
let os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
@@ -107,31 +105,23 @@ function readLastDirPref() {
return Services.prefs.getComplexValue(LAST_DIR_PREF, nsILocalFile);
}
catch (e) {
return null;
}
}
let gDownloadLastDirFile = readLastDirPref();
-let gDownloadLastDirStore = new Dict();
let gDownloadLastDir = {
// compat shims
get file() { return this.getFile(); },
set file(val) { this.setFile(null, val); },
getFile: function (aURI) {
if (aURI) {
- let lastDir;
- if (pbSvc && pbSvc.privateBrowsingEnabled) {
- let group = Services.contentPrefs.grouper.group(aURI);
- lastDir = gDownloadLastDirStore.get(group, null);
- }
- if (!lastDir) {
- lastDir = Services.contentPrefs.getPref(aURI, LAST_DIR_PREF);
- }
+ let lastDir = Services.contentPrefs.getPref(aURI, LAST_DIR_PREF);
if (lastDir) {
var lastDirFile = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
lastDirFile.initWithPath(lastDir);
return lastDirFile;
}
}
if (gDownloadLastDirFile && !gDownloadLastDirFile.exists())
@@ -139,22 +129,17 @@ let gDownloadLastDir = {
if (pbSvc && pbSvc.privateBrowsingEnabled)
return gDownloadLastDirFile;
else
return readLastDirPref();
},
setFile: function (aURI, aFile) {
if (aURI) {
- if (pbSvc && pbSvc.privateBrowsingEnabled) {
- let group = Services.contentPrefs.grouper.group(aURI);
- gDownloadLastDirStore.set(group, aFile.path);
- } else {
- Services.contentPrefs.setPref(aURI, LAST_DIR_PREF, aFile.path);
- }
+ Services.contentPrefs.setPref(aURI, LAST_DIR_PREF, aFile.path);
}
if (pbSvc && pbSvc.privateBrowsingEnabled) {
if (aFile instanceof Components.interfaces.nsIFile)
gDownloadLastDirFile = aFile.clone();
else
gDownloadLastDirFile = null;
} else {
if (aFile instanceof Components.interfaces.nsIFile)