mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-24 02:35:41 +00:00
Bug 850210 - Part 3. Update DownloadLastDir usage of removePrefsByName to nsIContentPrefService2. r=adw
This commit is contained in:
parent
975f9fb142
commit
2d0c4246fb
@ -127,16 +127,6 @@ function runTest() {
|
||||
"uri3 should return dir3"); // set in CPS
|
||||
is(gDownloadLastDir.getFile(uri4).path, dir2.path,
|
||||
"uri4 should return dir2"); // fallback
|
||||
|
||||
// check clearHistory removes all data
|
||||
clearHistory();
|
||||
is(gDownloadLastDir.file, null, "clearHistory removes all data");
|
||||
is(Services.contentPrefs.hasPref(uri1, "browser.download.lastDir", null),
|
||||
false, "LastDir preference should be absent");
|
||||
is(gDownloadLastDir.getFile(uri1), null, "uri1 should point to null");
|
||||
is(gDownloadLastDir.getFile(uri2), null, "uri2 should point to null");
|
||||
is(gDownloadLastDir.getFile(uri3), null, "uri3 should point to null");
|
||||
is(gDownloadLastDir.getFile(uri4), null, "uri4 should point to null");
|
||||
}
|
||||
|
||||
function checkDownloadLastDir(aWin, gDownloadLastDir, aLastDir) {
|
||||
@ -180,6 +170,19 @@ function runTest() {
|
||||
|
||||
yield testOnWindow(false, function(win, downloadDir) {
|
||||
checkInit(win, downloadDir);
|
||||
clearHistory();
|
||||
});
|
||||
|
||||
yield testOnWindow(false, function(win, downloadDir) {
|
||||
// check clearHistory removes all data
|
||||
is(downloadDir.file, null, "clearHistory removes all data");
|
||||
is(Services.contentPrefs.hasPref(uri1, "browser.download.lastDir", null),
|
||||
false, "LastDir preference should be absent");
|
||||
is(downloadDir.getFile(uri1), null, "uri1 should point to null");
|
||||
is(downloadDir.getFile(uri2), null, "uri2 should point to null");
|
||||
is(downloadDir.getFile(uri3), null, "uri3 should point to null");
|
||||
is(downloadDir.getFile(uri4), null, "uri4 should point to null");
|
||||
|
||||
downloadDir.setFile(null, tmpDir);
|
||||
});
|
||||
|
||||
@ -244,6 +247,8 @@ function runTest() {
|
||||
yield testOnWindow(true, function(win, downloadDir) {
|
||||
downloadDir.setFile(uri1, dir2);
|
||||
clearHistory();
|
||||
});
|
||||
yield testOnWindow(true, function(win, downloadDir) {
|
||||
checkDownloadLastDirNull(win, downloadDir);
|
||||
});
|
||||
yield testOnWindow(false, function(win, downloadDir) {
|
||||
|
@ -52,8 +52,11 @@ let observer = {
|
||||
Services.prefs.clearUserPref(LAST_DIR_PREF);
|
||||
// Ensure that purging session history causes both the session-only PB cache
|
||||
// and persistent prefs to be cleared.
|
||||
Services.contentPrefs.removePrefsByName(LAST_DIR_PREF, {usePrivateBrowsing: false});
|
||||
Services.contentPrefs.removePrefsByName(LAST_DIR_PREF, {usePrivateBrowsing: true});
|
||||
let cps2 = Components.classes["@mozilla.org/content-pref/service;1"].
|
||||
getService(Components.interfaces.nsIContentPrefService2);
|
||||
|
||||
cps2.removeByName(LAST_DIR_PREF, {usePrivateBrowsing: false});
|
||||
cps2.removeByName(LAST_DIR_PREF, {usePrivateBrowsing: true});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user