зеркало из https://github.com/mozilla/gecko-dev.git
Bug 817447 - Create download manager unit tests that do not rely on the global private browsing service. r=ehsan
DONTBUILD because this is NPOTB for global PB builds --HG-- rename : toolkit/components/downloads/test/unit/test_private_resume.js => toolkit/components/downloads/test/unit/test_private_resume_global.js rename : toolkit/components/downloads/test/unit/test_privatebrowsing_cancel.js => toolkit/components/downloads/test/unit/test_privatebrowsing_cancel_global.js rename : toolkit/components/downloads/test/unit/test_privatebrowsing.js => toolkit/components/downloads/test/unit/test_privatebrowsing_global.js
This commit is contained in:
Родитель
5a8419ee85
Коммит
2023fa6683
|
@ -13,15 +13,6 @@ include $(DEPTH)/config/autoconf.mk
|
|||
|
||||
MOCHITEST_BROWSER_FILES = \
|
||||
browser_nsIDownloadManagerUI.js \
|
||||
head.js \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
|
||||
MOCHITEST_BROWSER_FILES += \
|
||||
browser_private_resume.js \
|
||||
browser_privatebrowsing.js \
|
||||
browser_privatebrowsing_cancel.js \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
let windowsToClose = [];
|
||||
let download;
|
||||
let httpServer = startServer();
|
||||
let listener = {
|
||||
onDownloadStateChange: function(aState, aDownload) {
|
||||
switch (aDownload.state) {
|
||||
case Services.downloads.DOWNLOAD_DOWNLOADING:
|
||||
ok(false, "Listener should not be notified on a private window");
|
||||
break;
|
||||
}
|
||||
},
|
||||
onStateChange: function(a, b, c, d, e) { },
|
||||
onProgressChange: function(a, b, c, d, e, f, g) { },
|
||||
onSecurityChange: function(a, b, c, d) { }
|
||||
};
|
||||
|
||||
Services.downloads.addListener(listener);
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.downloads.removeListener(listener);
|
||||
windowsToClose.forEach(function(win) {
|
||||
win.close();
|
||||
});
|
||||
});
|
||||
|
||||
function testOnWindow(aIsPrivate, aCallback) {
|
||||
whenNewWindowLoaded(aIsPrivate, function(win) {
|
||||
windowsToClose.push(win);
|
||||
aCallback(win);
|
||||
});
|
||||
}
|
||||
|
||||
function testDownload(aWin, aIsPrivate) {
|
||||
let downloadInfo = {
|
||||
isPrivate: aIsPrivate,
|
||||
sourceURI: "http://localhost:4444/bigFile",
|
||||
downloadName: "download-" + aIsPrivate,
|
||||
runBeforeStart: function (aDownload) {
|
||||
is(Services.downloads.activeDownloadCount, aIsPrivate ? 0 : 1,
|
||||
"Check that download is retrievable");
|
||||
}
|
||||
}
|
||||
return addDownload(downloadInfo);
|
||||
}
|
||||
|
||||
httpServer.registerPathHandler("/bigFile", function (meta, response) {
|
||||
response.setHeader("Content-Type", "text/plain", false);
|
||||
response.setStatusLine("1.1", !meta.hasHeader('range') ? 200 : 206);
|
||||
|
||||
let full = "";
|
||||
let body = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; //60
|
||||
for (let i = 0; i < 1000; i++) {
|
||||
full += body;
|
||||
}
|
||||
response.write(full);
|
||||
});
|
||||
|
||||
testOnWindow(true, function(aWin) {
|
||||
download = testDownload(aWin, true);
|
||||
waitForDownloadState(download, Services.downloads.DOWNLOAD_DOWNLOADING, function() {
|
||||
is(download.resumable, true, "Private download must be resumable");
|
||||
isnot(download.cancelable, null, "Private download must be cancelable");
|
||||
download.pause();
|
||||
is(download.state, Services.downloads.DOWNLOAD_PAUSED,
|
||||
"Private download should be paused");
|
||||
download.resume();
|
||||
is(download.state, Services.downloads.DOWNLOAD_DOWNLOADING,
|
||||
"Private download should be resumed");
|
||||
download.cancel();
|
||||
is(Services.downloads.activeDownloadCount, 0,
|
||||
"There should not be active downloads");
|
||||
httpServer.stop(finish);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,213 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
Test download manager's interaction with the private browsing service.
|
||||
|
||||
An overview of what this test does follows:
|
||||
|
||||
* Open a normal window.
|
||||
* Create a download (Download-A) with specific details.
|
||||
* Check that Download-A is retrievable.
|
||||
* Open a private window.
|
||||
* Check that Download-A is accessible.
|
||||
* Create another download (Download-B) with specific and different details.
|
||||
* Check that Download-B is not retrievable.
|
||||
* Open a normal window.
|
||||
* Check that Download-A is retrievable.
|
||||
* Check that Download-B is not accessible.
|
||||
**/
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
let windowsToClose = [];
|
||||
let tmpDir = Services.dirsvc.get("TmpD", Ci.nsIFile);
|
||||
|
||||
// properties of Download-A
|
||||
let downloadA;
|
||||
const downloadASource = "data:image/png;base64,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";
|
||||
const downloadADest = "download-file-A";
|
||||
const downloadAName = "download-A";
|
||||
|
||||
// properties of Download-B
|
||||
let downloadB;
|
||||
const downloadBSource = "data:application/octet-stream;base64,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";
|
||||
const downloadBDest = "download-file-B";
|
||||
const downloadBName = "download-B";
|
||||
|
||||
// Create all target files
|
||||
let fileA = createFile(downloadADest);
|
||||
let fileB = createFile(downloadBDest);
|
||||
|
||||
let listener = {
|
||||
onDownloadStateChange: function(aState, aDownload) {
|
||||
switch (aDownload.state) {
|
||||
case Services.downloads.DOWNLOAD_FAILED:
|
||||
case Services.downloads.DOWNLOAD_CANCELED:
|
||||
case Services.downloads.DOWNLOAD_DIRTY:
|
||||
case Services.downloads.DOWNLOAD_BLOCKED_POLICY:
|
||||
// Fail!
|
||||
if (aDownload.targetFile.exists())
|
||||
aDownload.targetFile.remove(false);
|
||||
Services.downloads.removeListener(this);
|
||||
throw ("Download failed (name: " + aDownload.displayName + ", state: " + aDownload.state + ")");
|
||||
finish();
|
||||
break;
|
||||
case Services.downloads.DOWNLOAD_FINISHED:
|
||||
ok(aDownload.targetFile.exists(), "Check that targetFile exists");
|
||||
aDownload.targetFile.remove(false);
|
||||
this.onDownloadFinished();
|
||||
break;
|
||||
}
|
||||
},
|
||||
onStateChange: function(a, b, c, d, e) { },
|
||||
onProgressChange: function(a, b, c, d, e, f, g) { },
|
||||
onSecurityChange: function(a, b, c, d) { },
|
||||
onDownloadFinished: function() {
|
||||
// onDownloadFinished is only called one time (on Download-A finished)
|
||||
// because the listener isn't called on private windows
|
||||
// (on Download-B finished)
|
||||
is(Services.downloads.activeDownloadCount, 0,
|
||||
"Check that activeDownloadCount is zero");
|
||||
|
||||
// Open private window
|
||||
testOnWindow(true, function(win) {
|
||||
// Create Download-B
|
||||
downloadB = addDownload({
|
||||
isPrivate: true,
|
||||
targetFile: fileB,
|
||||
sourceURI: downloadBSource,
|
||||
downloadName: downloadBName,
|
||||
runBeforeStart: function (aDownload) {
|
||||
checkDownloads(aDownload);
|
||||
}
|
||||
});
|
||||
// Wait for Download-B to finish
|
||||
waitForDownloadState(downloadB,
|
||||
Services.downloads.DOWNLOAD_FINISHED, function() {
|
||||
testOnWindow(false, function() {
|
||||
checkDownloads(downloadB);
|
||||
cleanUp();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
Services.downloads.addListener(listener);
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.downloads.removeListener(listener);
|
||||
windowsToClose.forEach(function(win) {
|
||||
win.close();
|
||||
});
|
||||
});
|
||||
|
||||
function cleanUp() {
|
||||
Services.downloads.removeDownload(downloadA.id);
|
||||
if (downloadA.targetFile.exists()) {
|
||||
downloadA.targetFile.remove(false);
|
||||
}
|
||||
if (downloadB.targetFile.exists()) {
|
||||
downloadB.targetFile.remove(false);
|
||||
}
|
||||
Services.downloads.cleanUp();
|
||||
is(Services.downloads.activeDownloadCount, 0,
|
||||
"Make sure download DB is empty");
|
||||
finish();
|
||||
}
|
||||
|
||||
function testOnWindow(aIsPrivate, aCallback) {
|
||||
whenNewWindowLoaded(aIsPrivate, function(win) {
|
||||
windowsToClose.push(win);
|
||||
aCallback(win);
|
||||
});
|
||||
}
|
||||
|
||||
function createFile(aFileName) {
|
||||
let file = tmpDir.clone();
|
||||
file.append(aFileName);
|
||||
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
|
||||
return file;
|
||||
}
|
||||
|
||||
function checkDownloads(aDownloadB) {
|
||||
// Check that Download-A is accessible
|
||||
ok(is_download_available(downloadA.id, downloadASource,
|
||||
fileA, downloadAName),
|
||||
"Check that Download-A is accessible");
|
||||
|
||||
// Check that Download-B is not accessible
|
||||
is(Services.downloads.activeDownloadCount, 0,
|
||||
"Check that Download-B is not retrievable");
|
||||
|
||||
// Try to access the Download-B but it will fail since it's private
|
||||
try {
|
||||
let downloadID = aDownloadB.id;
|
||||
ok(false,
|
||||
"Check that Download-B is not available");
|
||||
} catch (e) {
|
||||
ok(true,
|
||||
"Check that Download-B is not available");
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure we're starting with an empty DB
|
||||
is(Services.downloads.activeDownloadCount, 0,
|
||||
"Make sure we're starting with an empty DB");
|
||||
|
||||
testOnWindow(false, function(win) {
|
||||
// Create Download-A
|
||||
downloadA = addDownload({
|
||||
isPrivate: false,
|
||||
targetFile: fileA,
|
||||
sourceURI: downloadASource,
|
||||
downloadName: downloadAName,
|
||||
runBeforeStart: function (aDownload) {
|
||||
// Check that Download-A is retrievable
|
||||
is(Services.downloads.activeDownloadCount, 1,
|
||||
"Check that Download-A is retrievable");
|
||||
ok(is_active_download_available(aDownload.id, downloadASource, fileA,
|
||||
downloadAName, false), "Check that active download (Download-A) is available");
|
||||
ok(is_download_available(aDownload.id, downloadASource, fileA,
|
||||
downloadAName), "Check that download (Download-A) is available");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to see if an active download is available using the |activeDownloads|
|
||||
* property.
|
||||
*/
|
||||
function is_active_download_available(aID, aSrc, aDst, aName, aPrivate) {
|
||||
let enumerator = Services.downloads.activeDownloads;
|
||||
while (enumerator.hasMoreElements()) {
|
||||
let download = enumerator.getNext();
|
||||
if (download.id == aID &&
|
||||
download.source.spec == aSrc &&
|
||||
download.targetFile.path == aDst.path &&
|
||||
download.displayName == aName &&
|
||||
download.isPrivate == aPrivate)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to see if a download is available using the |getDownload| method. The
|
||||
* download can both be active or inactive.
|
||||
*/
|
||||
function is_download_available(aID, aSrc, aDst, aName) {
|
||||
let download;
|
||||
try {
|
||||
download = Services.downloads.getDownload(aID);
|
||||
} catch (ex) {
|
||||
return false;
|
||||
}
|
||||
return (download.id == aID &&
|
||||
download.source.spec == aSrc &&
|
||||
download.targetFile.path == aDst.path &&
|
||||
download.displayName == aName);
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
let windowsToClose = [];
|
||||
let publicDownload;
|
||||
let privateDownload;
|
||||
let tmpDir = Services.dirsvc.get("TmpD", Ci.nsIFile);
|
||||
let httpServer = startServer();
|
||||
let listener = {
|
||||
onDownloadStateChange: function(aState, aDownload) {
|
||||
switch (aDownload.state) {
|
||||
case Services.downloads.DOWNLOAD_QUEUED:
|
||||
case Services.downloads.DOWNLOAD_DOWNLOADING:
|
||||
if (aDownload.targetFile.equals(publicDownload.targetFile)) {
|
||||
is(Services.downloads.activeDownloadCount, 1,
|
||||
"Check public download is active");
|
||||
is(publicDownload.resumable, false,
|
||||
"Download must not be resumable");
|
||||
isnot(publicDownload.cancelable, null,
|
||||
"Download must be cancelable");
|
||||
// Cancel the download
|
||||
publicDownload.cancel();
|
||||
}
|
||||
break;
|
||||
case Services.downloads.DOWNLOAD_CANCELED:
|
||||
if (aDownload.targetFile.equals(publicDownload.targetFile)) {
|
||||
is(publicDownload.resumable, false,
|
||||
"Download must not be resumable");
|
||||
is(publicDownload.cancelable, null,
|
||||
"Download must not be cancelable");
|
||||
testOnWindow(true, function(aWin) {
|
||||
is(Services.downloads.activeDownloadCount, 0,
|
||||
"Check public download is not active on private window");
|
||||
privateDownload = testDownload(aWin, true);
|
||||
waitForDownloadState(privateDownload,
|
||||
Services.downloads.DOWNLOAD_QUEUED, function() {
|
||||
isnot(privateDownload.cancelable, null,
|
||||
"Private download must be cancelable");
|
||||
privateDownload.cancel();
|
||||
testOnWindow(false, function(aWin) {
|
||||
is(Services.downloads.activeDownloadCount, 0,
|
||||
"Check that there are no active downloads on a new public window");
|
||||
cleanUp();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
onStateChange: function(a, b, c, d, e) { },
|
||||
onProgressChange: function(a, b, c, d, e, f, g) { },
|
||||
onSecurityChange: function(a, b, c, d) { }
|
||||
};
|
||||
Services.downloads.addListener(listener);
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.downloads.removeListener(listener);
|
||||
windowsToClose.forEach(function(win) {
|
||||
win.close();
|
||||
});
|
||||
});
|
||||
|
||||
function cleanUp() {
|
||||
Services.downloads.removeDownload(publicDownload.id);
|
||||
if (publicDownload.targetFile.exists()) {
|
||||
publicDownload.targetFile.remove(false);
|
||||
}
|
||||
if (privateDownload.targetFile.exists()) {
|
||||
privateDownload.targetFile.remove(false);
|
||||
}
|
||||
Services.downloads.cleanUp();
|
||||
is(Services.downloads.activeDownloadCount, 0,
|
||||
"Make sure we're starting with an empty DB");
|
||||
httpServer.stop(finish);
|
||||
}
|
||||
|
||||
function testOnWindow(aIsPrivate, aCallback) {
|
||||
whenNewWindowLoaded(aIsPrivate, function(win) {
|
||||
windowsToClose.push(win);
|
||||
aCallback(win);
|
||||
});
|
||||
}
|
||||
|
||||
function createFile(aFileName) {
|
||||
let file = tmpDir.clone();
|
||||
file.append(aFileName);
|
||||
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
|
||||
return file;
|
||||
}
|
||||
|
||||
function testDownload(aWin, aIsPrivate) {
|
||||
let file = createFile("download-file-" + aIsPrivate);
|
||||
let sourceURI =
|
||||
aIsPrivate ? "file/browser_privatebrowsing_cancel.js" : "noresume";
|
||||
let downloadInfo = {
|
||||
isPrivate: aIsPrivate,
|
||||
targetFile: file,
|
||||
sourceURI: "http://localhost:4444/" + sourceURI,
|
||||
downloadName: "download-" + aIsPrivate
|
||||
}
|
||||
return addDownload(downloadInfo);
|
||||
}
|
||||
|
||||
// Make sure we're starting with an empty DB
|
||||
is(Services.downloads.activeDownloadCount, 0,
|
||||
"Make sure we're starting with an empty DB");
|
||||
|
||||
testOnWindow(false, function(aWin) {
|
||||
publicDownload = testDownload(aWin, false);
|
||||
});
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
let HttpServer =
|
||||
Cu.import("resource://testing-common/httpd.js", {}).HttpServer;
|
||||
|
||||
function createURI(aObj) {
|
||||
return (aObj instanceof Ci.nsIFile) ?
|
||||
Services.io.newFileURI(aObj) : Services.io.newURI(aObj, null, null);
|
||||
}
|
||||
|
||||
var gDownloadCount = 0;
|
||||
/**
|
||||
* Adds a download to the DM, and starts it.
|
||||
* @param aParams (optional): an optional object which contains the function
|
||||
* parameters:
|
||||
* resultFileName: leaf node for the target file
|
||||
* targetFile: nsIFile for the target (overrides resultFileName)
|
||||
* sourceURI: the download source URI
|
||||
* downloadName: the display name of the download
|
||||
* runBeforeStart: a function to run before starting the download
|
||||
* isPrivate: whether the download is private or not
|
||||
*/
|
||||
function addDownload(aParams) {
|
||||
if (!aParams)
|
||||
aParams = {};
|
||||
if (!("resultFileName" in aParams))
|
||||
aParams.resultFileName = "download.result";
|
||||
if (!("targetFile" in aParams)) {
|
||||
aParams.targetFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
aParams.targetFile.append(aParams.resultFileName);
|
||||
}
|
||||
if (!("sourceURI" in aParams))
|
||||
aParams.sourceURI = "http://localhost:4444/head.js";
|
||||
if (!("downloadName" in aParams))
|
||||
aParams.downloadName = null;
|
||||
if (!("runBeforeStart" in aParams))
|
||||
aParams.runBeforeStart = function () {};
|
||||
|
||||
const nsIWBP = Ci.nsIWebBrowserPersist;
|
||||
var persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].
|
||||
createInstance(Ci.nsIWebBrowserPersist);
|
||||
persist.persistFlags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
|
||||
nsIWBP.PERSIST_FLAGS_BYPASS_CACHE |
|
||||
nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
|
||||
|
||||
// it is part of the active downloads the moment addDownload is called
|
||||
gDownloadCount++;
|
||||
|
||||
var dl =
|
||||
Services.downloads.addDownload(
|
||||
Ci.nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
|
||||
createURI(aParams.sourceURI), createURI(aParams.targetFile),
|
||||
aParams.downloadName, null, Math.round(Date.now() * 1000), null,
|
||||
persist, aParams.isPrivate);
|
||||
|
||||
// This will throw if it isn't found, and that would mean test failure, so no
|
||||
// try catch block
|
||||
if (!aParams.isPrivate)
|
||||
Services.downloads.getDownload(dl.id);
|
||||
|
||||
aParams.runBeforeStart.call(undefined, dl);
|
||||
|
||||
persist.progressListener = dl.QueryInterface(Ci.nsIWebProgressListener);
|
||||
persist.savePrivacyAwareURI(dl.source, null, null, null, null, dl.targetFile,
|
||||
aParams.isPrivate);
|
||||
|
||||
return dl;
|
||||
}
|
||||
|
||||
function whenNewWindowLoaded(aIsPrivate, aCallback) {
|
||||
let win = OpenBrowserWindow({private: aIsPrivate});
|
||||
win.addEventListener("load", function onLoad() {
|
||||
win.removeEventListener("load", onLoad, false);
|
||||
executeSoon(function() aCallback(win));
|
||||
}, false);
|
||||
}
|
||||
|
||||
function startServer() {
|
||||
let httpServer = new HttpServer();
|
||||
let currentWorkDir = Services.dirsvc.get("CurWorkD", Ci.nsILocalFile);
|
||||
httpServer.registerDirectory("/file/", currentWorkDir);
|
||||
httpServer.registerPathHandler("/noresume", function (meta, response) {
|
||||
response.setHeader("Content-Type", "text/html", false);
|
||||
response.setHeader("Accept-Ranges", "none", false);
|
||||
response.write("foo");
|
||||
});
|
||||
httpServer.start(4444);
|
||||
return httpServer;
|
||||
}
|
||||
|
||||
function waitForDownloadState(aDownload, aState, aCallback) {
|
||||
executeSoon(function() {
|
||||
if (aDownload.state == aState) {
|
||||
aCallback();
|
||||
} else {
|
||||
waitForDownloadState(aDownload, aState, aCallback);
|
||||
}
|
||||
});
|
||||
}
|
|
@ -2,30 +2,14 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
this.__defineGetter__("pb", function () {
|
||||
delete this.pb;
|
||||
try {
|
||||
return this.pb = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
} catch (e) {}
|
||||
return this.pb = null;
|
||||
});
|
||||
|
||||
// Public request gets times=0 cookie, completes
|
||||
// Private request gets times=1 cookie, canceled
|
||||
// Private resumed request sends times=1 cookie, completes
|
||||
|
||||
function run_test() {
|
||||
// Don't run the test where the PB service is not available
|
||||
if (!pb) {
|
||||
return;
|
||||
}
|
||||
|
||||
do_test_pending();
|
||||
let httpserv = new HttpServer();
|
||||
|
||||
Services.prefs.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
||||
|
||||
let times = 0;
|
||||
httpserv.registerPathHandler("/head_download_manager.js", function (meta, response) {
|
||||
response.setHeader("Content-Type", "text/plain", false);
|
||||
|
@ -63,11 +47,11 @@ function run_test() {
|
|||
state++;
|
||||
do_check_true(aDownload.resumable);
|
||||
|
||||
downloadUtils.downloadManager.pauseDownload(aDownload.id);
|
||||
aDownload.pause();
|
||||
do_check_eq(aDownload.state, downloadUtils.downloadManager.DOWNLOAD_PAUSED);
|
||||
|
||||
do_execute_soon(function() {
|
||||
downloadUtils.downloadManager.resumeDownload(aDownload.id);
|
||||
aDownload.resume();
|
||||
});
|
||||
break;
|
||||
|
||||
|
@ -80,23 +64,19 @@ function run_test() {
|
|||
|
||||
state++;
|
||||
|
||||
pb.privateBrowsingEnabled = true;
|
||||
|
||||
addDownload({
|
||||
isPrivate: pb.privateBrowsingEnabled,
|
||||
isPrivate: true,
|
||||
sourceURI: downloadCSource,
|
||||
downloadName: downloadCName + "!!!",
|
||||
runBeforeStart: function (aDownload) {
|
||||
// Check that dl is retrievable
|
||||
do_check_eq(downloadUtils.downloadManager.activeDownloadCount, 1);
|
||||
do_check_eq(downloadUtils.downloadManager.activePrivateDownloadCount, 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (state == 2) {
|
||||
// We're done here.
|
||||
do_execute_soon(function() {
|
||||
pb.privateBrowsingEnabled = false;
|
||||
Services.prefs.clearUserPref("browser.privatebrowsing.keep_current_session");
|
||||
httpserv.stop(do_test_finished);
|
||||
});
|
||||
}
|
||||
|
@ -111,14 +91,14 @@ function run_test() {
|
|||
onSecurityChange: function(a, b, c, d) { }
|
||||
};
|
||||
|
||||
downloadUtils.downloadManager.addListener(listener);
|
||||
downloadUtils.downloadManager.addPrivacyAwareListener(listener);
|
||||
|
||||
const downloadCSource = "http://localhost:4444/head_download_manager.js";
|
||||
const downloadCName = "download-C";
|
||||
|
||||
// First a public download that completes without interruption.
|
||||
let dl = addDownload({
|
||||
isPrivate: pb.privateBrowsingEnabled,
|
||||
isPrivate: false,
|
||||
sourceURI: downloadCSource,
|
||||
downloadName: downloadCName,
|
||||
runBeforeStart: function (aDownload) {
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
this.__defineGetter__("pb", function () {
|
||||
delete this.pb;
|
||||
try {
|
||||
return this.pb = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
} catch (e) {}
|
||||
return this.pb = null;
|
||||
});
|
||||
|
||||
// Public request gets times=0 cookie, completes
|
||||
// Private request gets times=1 cookie, canceled
|
||||
// Private resumed request sends times=1 cookie, completes
|
||||
|
||||
function run_test() {
|
||||
// Don't run the test where the PB service is not available
|
||||
if (!pb) {
|
||||
return;
|
||||
}
|
||||
|
||||
do_test_pending();
|
||||
let httpserv = new HttpServer();
|
||||
|
||||
Services.prefs.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
||||
|
||||
let times = 0;
|
||||
httpserv.registerPathHandler("/head_download_manager.js", function (meta, response) {
|
||||
response.setHeader("Content-Type", "text/plain", false);
|
||||
response.setStatusLine("1.1", !meta.hasHeader('range') ? 200 : 206);
|
||||
|
||||
// Set a cookie if none is sent with the request. Public and private requests
|
||||
// should therefore receive different cookies, so we can tell if the resumed
|
||||
// request is actually treated as private or not.
|
||||
if (!meta.hasHeader('Cookie')) {
|
||||
do_check_true(times == 0 || times == 1);
|
||||
response.setHeader('Set-Cookie', 'times=' + times++);
|
||||
} else {
|
||||
do_check_eq(times, 2);
|
||||
do_check_eq(meta.getHeader('Cookie'), 'times=1');
|
||||
}
|
||||
let full = "";
|
||||
let body = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; //60
|
||||
for (var i = 0; i < 1000; i++) {
|
||||
full += body;
|
||||
}
|
||||
response.write(full);
|
||||
});
|
||||
httpserv.start(4444);
|
||||
|
||||
let state = 0;
|
||||
|
||||
let listener = {
|
||||
onDownloadStateChange: function(aState, aDownload) {
|
||||
switch (aDownload.state) {
|
||||
case downloadUtils.downloadManager.DOWNLOAD_DOWNLOADING:
|
||||
// We only care about the private download
|
||||
if (state != 1)
|
||||
break;
|
||||
|
||||
state++;
|
||||
do_check_true(aDownload.resumable);
|
||||
|
||||
downloadUtils.downloadManager.pauseDownload(aDownload.id);
|
||||
do_check_eq(aDownload.state, downloadUtils.downloadManager.DOWNLOAD_PAUSED);
|
||||
|
||||
do_execute_soon(function() {
|
||||
downloadUtils.downloadManager.resumeDownload(aDownload.id);
|
||||
});
|
||||
break;
|
||||
|
||||
case downloadUtils.downloadManager.DOWNLOAD_FINISHED:
|
||||
if (state == 0) {
|
||||
do_execute_soon(function() {
|
||||
// Perform an identical request but in private mode.
|
||||
// It should receive a different cookie than the
|
||||
// public request.
|
||||
|
||||
state++;
|
||||
|
||||
pb.privateBrowsingEnabled = true;
|
||||
|
||||
addDownload({
|
||||
isPrivate: pb.privateBrowsingEnabled,
|
||||
sourceURI: downloadCSource,
|
||||
downloadName: downloadCName + "!!!",
|
||||
runBeforeStart: function (aDownload) {
|
||||
// Check that dl is retrievable
|
||||
do_check_eq(downloadUtils.downloadManager.activeDownloadCount, 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (state == 2) {
|
||||
// We're done here.
|
||||
do_execute_soon(function() {
|
||||
pb.privateBrowsingEnabled = false;
|
||||
Services.prefs.clearUserPref("browser.privatebrowsing.keep_current_session");
|
||||
httpserv.stop(do_test_finished);
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
onStateChange: function(a, b, c, d, e) { },
|
||||
onProgressChange: function(a, b, c, d, e, f, g) { },
|
||||
onSecurityChange: function(a, b, c, d) { }
|
||||
};
|
||||
|
||||
downloadUtils.downloadManager.addListener(listener);
|
||||
|
||||
const downloadCSource = "http://localhost:4444/head_download_manager.js";
|
||||
const downloadCName = "download-C";
|
||||
|
||||
// First a public download that completes without interruption.
|
||||
let dl = addDownload({
|
||||
isPrivate: pb.privateBrowsingEnabled,
|
||||
sourceURI: downloadCSource,
|
||||
downloadName: downloadCName,
|
||||
runBeforeStart: function (aDownload) {
|
||||
// Check that dl is retrievable
|
||||
do_check_eq(downloadUtils.downloadManager.activeDownloadCount, 1);
|
||||
}
|
||||
});
|
||||
}
|
|
@ -23,14 +23,7 @@
|
|||
* Verify that Download-C resumes and finishes correctly now.
|
||||
**/
|
||||
|
||||
this.__defineGetter__("pb", function () {
|
||||
delete this.pb;
|
||||
try {
|
||||
return this.pb = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
} catch (e) {}
|
||||
return this.pb = null;
|
||||
});
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
this.__defineGetter__("dm", function() {
|
||||
delete this.dm;
|
||||
|
@ -42,44 +35,52 @@ this.__defineGetter__("dm", function() {
|
|||
* Try to see if an active download is available using the |activeDownloads|
|
||||
* property.
|
||||
*/
|
||||
function is_active_download_available(aID, aSrc, aDst, aName) {
|
||||
let enumerator = dm.activeDownloads;
|
||||
function is_active_download_available(aGUID, aSrc, aDst, aName, aPrivate) {
|
||||
let enumerator = aPrivate ? dm.activePrivateDownloads : dm.activeDownloads;
|
||||
while (enumerator.hasMoreElements()) {
|
||||
let download = enumerator.getNext();
|
||||
if (download.id == aID &&
|
||||
if (download.guid == aGUID &&
|
||||
download.source.spec == aSrc &&
|
||||
download.targetFile.path == aDst.path &&
|
||||
download.displayName == aName &&
|
||||
download.isPrivate == pb.privateBrowsingEnabled)
|
||||
download.isPrivate == aPrivate)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function expect_download_present(aGUID, aSrc, aDst, aName, aPrivate) {
|
||||
is_download_available(aGUID, aSrc, aDst, aName, aPrivate, true);
|
||||
}
|
||||
|
||||
function expect_download_absent(aGUID, aSrc, aDst, aName, aPrivate) {
|
||||
is_download_available(aGUID, aSrc, aDst, aName, aPrivate, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to see if a download is available using the |getDownload| method. The
|
||||
* Try to see if a download is available using the |getDownloadByGUID| method. The
|
||||
* download can both be active or inactive.
|
||||
*/
|
||||
function is_download_available(aID, aSrc, aDst, aName) {
|
||||
let download;
|
||||
try {
|
||||
download = dm.getDownload(aID);
|
||||
} catch (ex) {
|
||||
return false;
|
||||
}
|
||||
return (download.id == aID &&
|
||||
download.source.spec == aSrc &&
|
||||
download.targetFile.path == aDst.path &&
|
||||
download.displayName == aName);
|
||||
function is_download_available(aGUID, aSrc, aDst, aName, aPrivate, present) {
|
||||
do_test_pending();
|
||||
dm.getDownloadByGUID(aGUID, function(status, download) {
|
||||
if (!present) {
|
||||
do_check_eq(download, null);
|
||||
} else {
|
||||
do_check_neq(download, null);
|
||||
do_check_eq(download.guid, aGUID);
|
||||
do_check_eq(download.source.spec, aSrc);
|
||||
do_check_eq(download.targetFile.path, aDst.path);
|
||||
do_check_eq(download.displayName, aName);
|
||||
do_check_eq(download.isPrivate, aPrivate);
|
||||
}
|
||||
do_test_finished();
|
||||
});
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
if (!pb) // Private Browsing might not be available
|
||||
return;
|
||||
|
||||
let prefBranch = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
prefBranch.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
||||
|
||||
do_test_pending();
|
||||
let httpserv = new HttpServer();
|
||||
|
@ -92,6 +93,7 @@ function run_test() {
|
|||
|
||||
// make sure we're starting with an empty DB
|
||||
do_check_eq(dm.activeDownloadCount, 0);
|
||||
do_check_eq(dm.activePrivateDownloadCount, 0);
|
||||
|
||||
let listener = {
|
||||
phase: 1,
|
||||
|
@ -114,35 +116,21 @@ function run_test() {
|
|||
// We need to wait until Download-C has started, because otherwise it
|
||||
// won't be resumable, so the private browsing mode won't correctly pause it.
|
||||
case dm.DOWNLOAD_DOWNLOADING:
|
||||
if (aDownload.id == downloadC && !this.handledC && this.phase == 2) {
|
||||
if (aDownload.guid == downloadC && !this.handledC && this.phase == 2) {
|
||||
// Sanity check: Download-C must be resumable
|
||||
do_check_true(dlC.resumable);
|
||||
|
||||
// Enter private browsing mode immediately
|
||||
pb.privateBrowsingEnabled = true;
|
||||
do_check_true(pb.privateBrowsingEnabled);
|
||||
|
||||
// Check that Download-C is paused and not accessible
|
||||
do_check_eq(dlC.state, dm.DOWNLOAD_PAUSED);
|
||||
do_check_eq(dm.activeDownloadCount, 0);
|
||||
do_check_false(is_download_available(downloadC, downloadCSource,
|
||||
fileC, downloadCName));
|
||||
|
||||
// Exit private browsing mode
|
||||
pb.privateBrowsingEnabled = false;
|
||||
do_check_false(pb.privateBrowsingEnabled);
|
||||
|
||||
// Check that Download-A is accessible
|
||||
do_check_true(is_download_available(downloadA, downloadASource,
|
||||
fileA, downloadAName));
|
||||
expect_download_present(downloadA, downloadASource,
|
||||
fileA, downloadAName, false);
|
||||
|
||||
// Check that Download-B is not accessible
|
||||
do_check_false(is_download_available(downloadB, downloadBSource,
|
||||
fileB, downloadBName));
|
||||
expect_download_absent(downloadB, downloadBSource,
|
||||
fileB, downloadBName, true);
|
||||
|
||||
// Check that Download-C is accessible
|
||||
do_check_true(is_download_available(downloadC, downloadCSource,
|
||||
fileC, downloadCName));
|
||||
expect_download_present(downloadC, downloadCSource,
|
||||
fileC, downloadCName, false);
|
||||
|
||||
// only perform these checks the first time that Download-C is started
|
||||
this.handledC = true;
|
||||
|
@ -164,30 +152,23 @@ function run_test() {
|
|||
case 1: {
|
||||
do_check_eq(dm.activeDownloadCount, 0);
|
||||
|
||||
// Enter private browsing mode
|
||||
pb.privateBrowsingEnabled = true;
|
||||
do_check_true(pb.privateBrowsingEnabled);
|
||||
|
||||
// Check that Download-A is not accessible
|
||||
do_check_false(is_download_available(downloadA, downloadASource,
|
||||
fileA, downloadAName));
|
||||
|
||||
// Create Download-B
|
||||
let dlB = addDownload({
|
||||
isPrivate: pb.privateBrowsingEnabled,
|
||||
isPrivate: true,
|
||||
targetFile: fileB,
|
||||
sourceURI: downloadBSource,
|
||||
downloadName: downloadBName,
|
||||
runBeforeStart: function (aDownload) {
|
||||
// Check that Download-B is retrievable
|
||||
do_check_eq(dm.activeDownloadCount, 1);
|
||||
do_check_true(is_active_download_available(aDownload.id,
|
||||
downloadBSource, fileB, downloadBName));
|
||||
do_check_true(is_download_available(aDownload.id,
|
||||
downloadBSource, fileB, downloadBName));
|
||||
do_check_eq(dm.activePrivateDownloadCount, 1);
|
||||
do_check_eq(dm.activeDownloadCount, 0);
|
||||
do_check_true(is_active_download_available(aDownload.guid,
|
||||
downloadBSource, fileB, downloadBName, true));
|
||||
expect_download_present(aDownload.guid,
|
||||
downloadBSource, fileB, downloadBName, true);
|
||||
}
|
||||
});
|
||||
downloadB = dlB.id;
|
||||
downloadB = dlB.guid;
|
||||
|
||||
// wait for Download-B to finish
|
||||
++this.phase;
|
||||
|
@ -197,58 +178,56 @@ function run_test() {
|
|||
case 2: {
|
||||
do_check_eq(dm.activeDownloadCount, 0);
|
||||
|
||||
// Exit private browsing mode
|
||||
pb.privateBrowsingEnabled = false;
|
||||
do_check_false(pb.privateBrowsingEnabled);
|
||||
|
||||
// Check that Download-A is accessible
|
||||
do_check_true(is_download_available(downloadA, downloadASource,
|
||||
fileA, downloadAName));
|
||||
|
||||
// Check that Download-B is not accessible
|
||||
do_check_false(is_download_available(downloadB, downloadBSource,
|
||||
fileB, downloadBName));
|
||||
// Simulate last private browsing context triggering cleanup
|
||||
Services.obs.notifyObservers(null, "last-pb-context-exited", null);
|
||||
|
||||
// Create Download-C
|
||||
httpserv.start(4444);
|
||||
dlC = addDownload({
|
||||
isPrivate: pb.privateBrowsingEnabled,
|
||||
isPrivate: false,
|
||||
targetFile: fileC,
|
||||
sourceURI: downloadCSource,
|
||||
downloadName: downloadCName,
|
||||
runBeforeStart: function (aDownload) {
|
||||
// Check that Download-C is retrievable
|
||||
do_check_eq(dm.activeDownloadCount, 1);
|
||||
do_check_true(is_active_download_available(aDownload.id,
|
||||
downloadCSource, fileC, downloadCName));
|
||||
do_check_true(is_download_available(aDownload.id,
|
||||
downloadCSource, fileC, downloadCName));
|
||||
do_check_eq(dm.activePrivateDownloadCount, 0);
|
||||
do_check_true(is_active_download_available(aDownload.guid,
|
||||
downloadCSource, fileC, downloadCName, false));
|
||||
expect_download_present(aDownload.guid,
|
||||
downloadCSource, fileC, downloadCName, false);
|
||||
}
|
||||
});
|
||||
downloadC = dlC.id;
|
||||
downloadC = dlC.guid;
|
||||
|
||||
// wait for Download-C to finish
|
||||
++this.phase;
|
||||
|
||||
// Check that Download-A is accessible
|
||||
expect_download_present(downloadA, downloadASource,
|
||||
fileA, downloadAName, false);
|
||||
|
||||
// Check that Download-B is not accessible
|
||||
expect_download_absent(downloadB, downloadBSource,
|
||||
fileB, downloadBName, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: {
|
||||
do_check_eq(dm.activeDownloadCount, 0);
|
||||
do_check_eq(dm.activePrivateDownloadCount, 0);
|
||||
|
||||
// Check that Download-A is accessible
|
||||
do_check_true(is_download_available(downloadA, downloadASource,
|
||||
fileA, downloadAName));
|
||||
expect_download_present(downloadA, downloadASource,
|
||||
fileA, downloadAName, false);
|
||||
|
||||
// Check that Download-B is not accessible
|
||||
do_check_false(is_download_available(downloadB, downloadBSource,
|
||||
fileB, downloadBName));
|
||||
expect_download_absent(downloadB, downloadBSource,
|
||||
fileB, downloadBName, true);
|
||||
|
||||
// Check that Download-C is accessible
|
||||
do_check_true(is_download_available(downloadC, downloadCSource,
|
||||
fileC, downloadCName));
|
||||
expect_download_present(downloadC, downloadCSource,
|
||||
fileC, downloadCName, false);
|
||||
|
||||
// cleanup
|
||||
prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
|
||||
dm.removeListener(this);
|
||||
httpserv.stop(do_test_finished);
|
||||
}
|
||||
|
@ -261,8 +240,8 @@ function run_test() {
|
|||
}
|
||||
};
|
||||
|
||||
dm.addListener(listener);
|
||||
dm.addListener(getDownloadListener());
|
||||
dm.addPrivacyAwareListener(listener);
|
||||
dm.addPrivacyAwareListener(getDownloadListener());
|
||||
|
||||
// properties of Download-A
|
||||
let downloadA = -1;
|
||||
|
@ -298,18 +277,18 @@ function run_test() {
|
|||
|
||||
// Create Download-A
|
||||
let dlA = addDownload({
|
||||
isPrivate: pb.privateBrowsingEnabled,
|
||||
isPrivate: false,
|
||||
targetFile: fileA,
|
||||
sourceURI: downloadASource,
|
||||
downloadName: downloadAName,
|
||||
runBeforeStart: function (aDownload) {
|
||||
// Check that Download-A is retrievable
|
||||
do_check_eq(dm.activeDownloadCount, 1);
|
||||
do_check_true(is_active_download_available(aDownload.id, downloadASource, fileA, downloadAName));
|
||||
do_check_true(is_download_available(aDownload.id, downloadASource, fileA, downloadAName));
|
||||
do_check_eq(dm.activePrivateDownloadCount, 0);
|
||||
do_check_true(is_active_download_available(aDownload.guid, downloadASource, fileA, downloadAName, false));
|
||||
expect_download_present(aDownload.guid, downloadASource, fileA, downloadAName, false);
|
||||
}
|
||||
});
|
||||
downloadA = dlA.id;
|
||||
downloadA = dlA.guid;
|
||||
|
||||
// wait for Download-A to finish
|
||||
}
|
||||
|
|
|
@ -59,33 +59,33 @@ Cm.QueryInterface(Ci.nsIComponentRegistrar)
|
|||
.registerFactory(Components.ID(kPromptServiceUUID), "Prompt Service",
|
||||
kPromptServiceContractID, fakePromptServiceFactory);
|
||||
|
||||
this.__defineGetter__("pb", function () {
|
||||
delete this.pb;
|
||||
try {
|
||||
return this.pb = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
} catch (e) {}
|
||||
return this.pb = null;
|
||||
});
|
||||
|
||||
this.__defineGetter__("dm", function() {
|
||||
delete this.dm;
|
||||
return this.dm = Cc["@mozilla.org/download-manager;1"].
|
||||
getService(Ci.nsIDownloadManager);
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
if (!pb) // Private Browsing might not be available
|
||||
return;
|
||||
function trigger_pb_cleanup(expected)
|
||||
{
|
||||
var obs = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
|
||||
var cancel = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
|
||||
cancel.data = false;
|
||||
obs.notifyObservers(cancel, "last-pb-context-exiting", null);
|
||||
do_check_eq(expected, cancel.data);
|
||||
if (!expected)
|
||||
obs.notifyObservers(cancel, "last-pb-context-exited", null);
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
function finishTest() {
|
||||
// Cancel Download-E
|
||||
dm.cancelDownload(dlE.id);
|
||||
dm.removeDownload(dlE.id);
|
||||
dlF.cancel();
|
||||
dlF.remove();
|
||||
dm.cleanUp();
|
||||
dm.cleanUpPrivate();
|
||||
do_check_eq(dm.activeDownloadCount, 0);
|
||||
do_check_eq(dm.activePrivateDownloadCount, 0);
|
||||
|
||||
prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
|
||||
dm.removeListener(listener);
|
||||
httpserv.stop(do_test_finished);
|
||||
|
||||
|
@ -100,10 +100,6 @@ function run_test() {
|
|||
kPromptServiceContractID, kPromptServiceFactory);
|
||||
}
|
||||
|
||||
let prefBranch = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
prefBranch.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
||||
|
||||
do_test_pending();
|
||||
let httpserv = new HttpServer();
|
||||
httpserv.registerDirectory("/file/", do_get_cwd());
|
||||
|
@ -133,33 +129,19 @@ function run_test() {
|
|||
|
||||
// Cancel the transition
|
||||
promptService.sayCancel();
|
||||
|
||||
// Enter private browsing mode immediately
|
||||
pb.privateBrowsingEnabled = true;
|
||||
trigger_pb_cleanup(true);
|
||||
do_check_true(promptService.wasCalled());
|
||||
do_check_false(pb.privateBrowsingEnabled); // transition was canceled
|
||||
do_check_eq(dm.activePrivateDownloadCount, 1);
|
||||
|
||||
// Check that Download-D status has not changed
|
||||
do_check_neq(dlD.state, dm.DOWNLOAD_PAUSED);
|
||||
|
||||
// proceed with the transition
|
||||
promptService.sayProceed();
|
||||
|
||||
// Try to enter the private browsing mode again
|
||||
pb.privateBrowsingEnabled = true;
|
||||
trigger_pb_cleanup(false);
|
||||
do_check_true(promptService.wasCalled());
|
||||
do_check_true(pb.privateBrowsingEnabled);
|
||||
|
||||
// Check that Download-D is canceled and not accessible
|
||||
do_check_eq(dm.activePrivateDownloadCount, 0);
|
||||
do_check_eq(dlD.state, dm.DOWNLOAD_CANCELED);
|
||||
|
||||
// Exit private browsing mode
|
||||
pb.privateBrowsingEnabled = false;
|
||||
do_check_false(pb.privateBrowsingEnabled);
|
||||
|
||||
// Create Download-E
|
||||
dlE = addDownload({
|
||||
isPrivate: pb.privateBrowsingEnabled,
|
||||
isPrivate: true,
|
||||
targetFile: fileE,
|
||||
sourceURI: downloadESource,
|
||||
downloadName: downloadEName
|
||||
|
@ -170,14 +152,20 @@ function run_test() {
|
|||
// Sanity check: Download-E must be resumable
|
||||
do_check_true(dlE.resumable);
|
||||
|
||||
// Enter the private browsing mode
|
||||
pb.privateBrowsingEnabled = true;
|
||||
do_check_false(promptService.wasCalled());
|
||||
do_check_true(pb.privateBrowsingEnabled);
|
||||
promptService.sayCancel();
|
||||
trigger_pb_cleanup(true);
|
||||
do_check_true(promptService.wasCalled());
|
||||
do_check_eq(dm.activePrivateDownloadCount, 1);
|
||||
|
||||
promptService.sayProceed();
|
||||
trigger_pb_cleanup(false);
|
||||
do_check_true(promptService.wasCalled());
|
||||
do_check_eq(dm.activePrivateDownloadCount, 0);
|
||||
do_check_eq(dlE.state, dm.DOWNLOAD_PAUSED);
|
||||
|
||||
// Create Download-F
|
||||
dlF = addDownload({
|
||||
isPrivate: pb.privateBrowsingEnabled,
|
||||
isPrivate: false,
|
||||
targetFile: fileF,
|
||||
sourceURI: downloadFSource,
|
||||
downloadName: downloadFName
|
||||
|
@ -185,34 +173,14 @@ function run_test() {
|
|||
|
||||
// Wait for Download-F to start
|
||||
} else if (aDownload.targetFile.equals(dlF.targetFile)) {
|
||||
// Sanity check: Download-F must be resumable
|
||||
do_check_true(dlF.resumable);
|
||||
// Sanity check: Download-F must not be resumable
|
||||
do_check_false(dlF.resumable);
|
||||
|
||||
// Cancel the transition
|
||||
promptService.sayCancel();
|
||||
|
||||
// Exit private browsing mode immediately
|
||||
pb.privateBrowsingEnabled = false;
|
||||
do_check_true(promptService.wasCalled());
|
||||
do_check_true(pb.privateBrowsingEnabled); // transition was canceled
|
||||
|
||||
// Check that Download-F status has not changed
|
||||
do_check_neq(dlF.state, dm.DOWNLOAD_PAUSED);
|
||||
|
||||
// proceed with the transition
|
||||
promptService.sayProceed();
|
||||
|
||||
// Try to exit the private browsing mode again
|
||||
pb.privateBrowsingEnabled = false;
|
||||
do_check_true(promptService.wasCalled());
|
||||
do_check_false(pb.privateBrowsingEnabled);
|
||||
|
||||
// Simulate leaving PB mode
|
||||
Services.obs.notifyObservers(null, "last-pb-context-exited", null);
|
||||
|
||||
// Check that Download-F is canceled and not accessible
|
||||
do_check_eq(dlF.state, dm.DOWNLOAD_PAUSED);
|
||||
|
||||
trigger_pb_cleanup(false);
|
||||
do_check_false(promptService.wasCalled());
|
||||
do_check_eq(dm.activeDownloadCount, 1);
|
||||
do_check_eq(dlF.state, dm.DOWNLOAD_DOWNLOADING);
|
||||
finishTest();
|
||||
}
|
||||
break;
|
||||
|
@ -223,7 +191,7 @@ function run_test() {
|
|||
onSecurityChange: function(a, b, c, d) { }
|
||||
};
|
||||
|
||||
dm.addListener(listener);
|
||||
dm.addPrivacyAwareListener(listener);
|
||||
|
||||
// properties of Download-D
|
||||
const downloadDSource = "http://localhost:4444/noresume";
|
||||
|
@ -236,7 +204,7 @@ function run_test() {
|
|||
const downloadEName = "download-E";
|
||||
|
||||
// properties of Download-F
|
||||
const downloadFSource = "http://localhost:4444/file/test_privatebrowsing_cancel.js";
|
||||
const downloadFSource = "http://localhost:4444/noresume";
|
||||
const downloadFDest = "download-file-F";
|
||||
const downloadFName = "download-F";
|
||||
|
||||
|
@ -253,12 +221,11 @@ function run_test() {
|
|||
|
||||
// Create Download-D
|
||||
let dlD = addDownload({
|
||||
isPrivate: pb.privateBrowsingEnabled,
|
||||
isPrivate: true,
|
||||
targetFile: fileD,
|
||||
sourceURI: downloadDSource,
|
||||
downloadName: downloadDName
|
||||
});
|
||||
downloadD = dlD.id;
|
||||
|
||||
let dlE, dlF;
|
||||
|
||||
|
|
|
@ -0,0 +1,266 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
Make sure that the download manager service is given a chance to cancel the
|
||||
private browisng mode transition.
|
||||
**/
|
||||
|
||||
const Cm = Components.manager;
|
||||
|
||||
const kPromptServiceUUID = "{6cc9c9fe-bc0b-432b-a410-253ef8bcc699}";
|
||||
const kPromptServiceContractID = "@mozilla.org/embedcomp/prompt-service;1";
|
||||
|
||||
// Save original prompt service factory
|
||||
const kPromptServiceFactory = Cm.getClassObject(Cc[kPromptServiceContractID],
|
||||
Ci.nsIFactory);
|
||||
|
||||
let fakePromptServiceFactory = {
|
||||
createInstance: function(aOuter, aIid) {
|
||||
if (aOuter != null)
|
||||
throw Cr.NS_ERROR_NO_AGGREGATION;
|
||||
return promptService.QueryInterface(aIid);
|
||||
}
|
||||
};
|
||||
|
||||
let promptService = {
|
||||
_buttonChoice: 0,
|
||||
_called: false,
|
||||
wasCalled: function() {
|
||||
let called = this._called;
|
||||
this._called = false;
|
||||
return called;
|
||||
},
|
||||
sayCancel: function() {
|
||||
this._buttonChoice = 1;
|
||||
this._called = false;
|
||||
},
|
||||
sayProceed: function() {
|
||||
this._buttonChoice = 0;
|
||||
this._called = false;
|
||||
},
|
||||
QueryInterface: function(aIID) {
|
||||
if (aIID.equals(Ci.nsIPromptService) ||
|
||||
aIID.equals(Ci.nsISupports)) {
|
||||
return this;
|
||||
}
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
confirmEx: function(parent, title, text, buttonFlags,
|
||||
button0Title, button1Title, button2Title,
|
||||
checkMsg, checkState) {
|
||||
this._called = true;
|
||||
return this._buttonChoice;
|
||||
}
|
||||
};
|
||||
|
||||
Cm.QueryInterface(Ci.nsIComponentRegistrar)
|
||||
.registerFactory(Components.ID(kPromptServiceUUID), "Prompt Service",
|
||||
kPromptServiceContractID, fakePromptServiceFactory);
|
||||
|
||||
this.__defineGetter__("pb", function () {
|
||||
delete this.pb;
|
||||
try {
|
||||
return this.pb = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
} catch (e) {}
|
||||
return this.pb = null;
|
||||
});
|
||||
|
||||
this.__defineGetter__("dm", function() {
|
||||
delete this.dm;
|
||||
return this.dm = Cc["@mozilla.org/download-manager;1"].
|
||||
getService(Ci.nsIDownloadManager);
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
if (!pb) // Private Browsing might not be available
|
||||
return;
|
||||
|
||||
function finishTest() {
|
||||
// Cancel Download-E
|
||||
dm.cancelDownload(dlE.id);
|
||||
dm.removeDownload(dlE.id);
|
||||
dm.cleanUp();
|
||||
do_check_eq(dm.activeDownloadCount, 0);
|
||||
|
||||
prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
|
||||
dm.removeListener(listener);
|
||||
httpserv.stop(do_test_finished);
|
||||
|
||||
// Unregister the factory so we do not leak
|
||||
Cm.QueryInterface(Ci.nsIComponentRegistrar)
|
||||
.unregisterFactory(Components.ID(kPromptServiceUUID),
|
||||
fakePromptServiceFactory);
|
||||
|
||||
// Restore the original factory
|
||||
Cm.QueryInterface(Ci.nsIComponentRegistrar)
|
||||
.registerFactory(Components.ID(kPromptServiceUUID), "Prompt Service",
|
||||
kPromptServiceContractID, kPromptServiceFactory);
|
||||
}
|
||||
|
||||
let prefBranch = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
prefBranch.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
||||
|
||||
do_test_pending();
|
||||
let httpserv = new HttpServer();
|
||||
httpserv.registerDirectory("/file/", do_get_cwd());
|
||||
httpserv.registerPathHandler("/noresume", function (meta, response) {
|
||||
response.setHeader("Content-Type", "text/html", false);
|
||||
response.setHeader("Accept-Ranges", "none", false);
|
||||
response.write("foo");
|
||||
});
|
||||
httpserv.start(4444);
|
||||
|
||||
let tmpDir = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties).
|
||||
get("TmpD", Ci.nsIFile);
|
||||
|
||||
// make sure we're starting with an empty DB
|
||||
do_check_eq(dm.activeDownloadCount, 0);
|
||||
|
||||
let listener = {
|
||||
onDownloadStateChange: function(aState, aDownload)
|
||||
{
|
||||
switch (aDownload.state) {
|
||||
case dm.DOWNLOAD_QUEUED:
|
||||
case dm.DOWNLOAD_DOWNLOADING:
|
||||
if (aDownload.targetFile.equals(dlD.targetFile)) {
|
||||
// Sanity check: Download-D must not be resumable
|
||||
do_check_false(dlD.resumable);
|
||||
|
||||
// Cancel the transition
|
||||
promptService.sayCancel();
|
||||
|
||||
// Enter private browsing mode immediately
|
||||
pb.privateBrowsingEnabled = true;
|
||||
do_check_true(promptService.wasCalled());
|
||||
do_check_false(pb.privateBrowsingEnabled); // transition was canceled
|
||||
|
||||
// Check that Download-D status has not changed
|
||||
do_check_neq(dlD.state, dm.DOWNLOAD_PAUSED);
|
||||
|
||||
// proceed with the transition
|
||||
promptService.sayProceed();
|
||||
|
||||
// Try to enter the private browsing mode again
|
||||
pb.privateBrowsingEnabled = true;
|
||||
do_check_true(promptService.wasCalled());
|
||||
do_check_true(pb.privateBrowsingEnabled);
|
||||
|
||||
// Check that Download-D is canceled and not accessible
|
||||
do_check_eq(dlD.state, dm.DOWNLOAD_CANCELED);
|
||||
|
||||
// Exit private browsing mode
|
||||
pb.privateBrowsingEnabled = false;
|
||||
do_check_false(pb.privateBrowsingEnabled);
|
||||
|
||||
// Create Download-E
|
||||
dlE = addDownload({
|
||||
isPrivate: pb.privateBrowsingEnabled,
|
||||
targetFile: fileE,
|
||||
sourceURI: downloadESource,
|
||||
downloadName: downloadEName
|
||||
});
|
||||
|
||||
// Wait for Download-E to start
|
||||
} else if (aDownload.targetFile.equals(dlE.targetFile)) {
|
||||
// Sanity check: Download-E must be resumable
|
||||
do_check_true(dlE.resumable);
|
||||
|
||||
// Enter the private browsing mode
|
||||
pb.privateBrowsingEnabled = true;
|
||||
do_check_false(promptService.wasCalled());
|
||||
do_check_true(pb.privateBrowsingEnabled);
|
||||
|
||||
// Create Download-F
|
||||
dlF = addDownload({
|
||||
isPrivate: pb.privateBrowsingEnabled,
|
||||
targetFile: fileF,
|
||||
sourceURI: downloadFSource,
|
||||
downloadName: downloadFName
|
||||
});
|
||||
|
||||
// Wait for Download-F to start
|
||||
} else if (aDownload.targetFile.equals(dlF.targetFile)) {
|
||||
// Sanity check: Download-F must be resumable
|
||||
do_check_true(dlF.resumable);
|
||||
|
||||
// Cancel the transition
|
||||
promptService.sayCancel();
|
||||
|
||||
// Exit private browsing mode immediately
|
||||
pb.privateBrowsingEnabled = false;
|
||||
do_check_true(promptService.wasCalled());
|
||||
do_check_true(pb.privateBrowsingEnabled); // transition was canceled
|
||||
|
||||
// Check that Download-F status has not changed
|
||||
do_check_neq(dlF.state, dm.DOWNLOAD_PAUSED);
|
||||
|
||||
// proceed with the transition
|
||||
promptService.sayProceed();
|
||||
|
||||
// Try to exit the private browsing mode again
|
||||
pb.privateBrowsingEnabled = false;
|
||||
do_check_true(promptService.wasCalled());
|
||||
do_check_false(pb.privateBrowsingEnabled);
|
||||
|
||||
// Simulate leaving PB mode
|
||||
Services.obs.notifyObservers(null, "last-pb-context-exited", null);
|
||||
|
||||
// Check that Download-F is canceled and not accessible
|
||||
do_check_eq(dlF.state, dm.DOWNLOAD_PAUSED);
|
||||
|
||||
finishTest();
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
onStateChange: function(a, b, c, d, e) { },
|
||||
onProgressChange: function(a, b, c, d, e, f, g) { },
|
||||
onSecurityChange: function(a, b, c, d) { }
|
||||
};
|
||||
|
||||
dm.addListener(listener);
|
||||
|
||||
// properties of Download-D
|
||||
const downloadDSource = "http://localhost:4444/noresume";
|
||||
const downloadDDest = "download-file-D";
|
||||
const downloadDName = "download-D";
|
||||
|
||||
// properties of Download-E
|
||||
const downloadESource = "http://localhost:4444/file/head_download_manager.js";
|
||||
const downloadEDest = "download-file-E";
|
||||
const downloadEName = "download-E";
|
||||
|
||||
// properties of Download-F
|
||||
const downloadFSource = "http://localhost:4444/file/test_privatebrowsing_cancel.js";
|
||||
const downloadFDest = "download-file-F";
|
||||
const downloadFName = "download-F";
|
||||
|
||||
// Create all target files
|
||||
let fileD = tmpDir.clone();
|
||||
fileD.append(downloadDDest);
|
||||
fileD.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
|
||||
let fileE = tmpDir.clone();
|
||||
fileE.append(downloadEDest);
|
||||
fileE.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
|
||||
let fileF = tmpDir.clone();
|
||||
fileF.append(downloadFDest);
|
||||
fileF.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
|
||||
|
||||
// Create Download-D
|
||||
let dlD = addDownload({
|
||||
isPrivate: pb.privateBrowsingEnabled,
|
||||
targetFile: fileD,
|
||||
sourceURI: downloadDSource,
|
||||
downloadName: downloadDName
|
||||
});
|
||||
downloadD = dlD.id;
|
||||
|
||||
let dlE, dlF;
|
||||
|
||||
// wait for Download-D to start
|
||||
}
|
|
@ -0,0 +1,315 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
Test download manager's interaction with the private browsing service.
|
||||
|
||||
An overview of what this test does follows:
|
||||
|
||||
* Create a download (Download-A) with specific details.
|
||||
* Check that Download-A is retrievable.
|
||||
* Enter private browsing mode.
|
||||
* Check that Download-A is not accessible.
|
||||
* Create another download (Download-B) with specific and different details.
|
||||
* Check that Download-B is retrievable.
|
||||
* Exit private browsing mode.
|
||||
* Check that Download-A is retrievable.
|
||||
* Check that Download-B is not accessible.
|
||||
* Create a new download (Download-C) with specific details.
|
||||
Start it and enter private browsing mode immediately after.
|
||||
* Check that Download-C has been paused.
|
||||
* Exit the private browsing mode.
|
||||
* Verify that Download-C resumes and finishes correctly now.
|
||||
**/
|
||||
|
||||
this.__defineGetter__("pb", function () {
|
||||
delete this.pb;
|
||||
try {
|
||||
return this.pb = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
} catch (e) {}
|
||||
return this.pb = null;
|
||||
});
|
||||
|
||||
this.__defineGetter__("dm", function() {
|
||||
delete this.dm;
|
||||
return this.dm = Cc["@mozilla.org/download-manager;1"].
|
||||
getService(Ci.nsIDownloadManager);
|
||||
});
|
||||
|
||||
/**
|
||||
* Try to see if an active download is available using the |activeDownloads|
|
||||
* property.
|
||||
*/
|
||||
function is_active_download_available(aID, aSrc, aDst, aName) {
|
||||
let enumerator = dm.activeDownloads;
|
||||
while (enumerator.hasMoreElements()) {
|
||||
let download = enumerator.getNext();
|
||||
if (download.id == aID &&
|
||||
download.source.spec == aSrc &&
|
||||
download.targetFile.path == aDst.path &&
|
||||
download.displayName == aName &&
|
||||
download.isPrivate == pb.privateBrowsingEnabled)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to see if a download is available using the |getDownload| method. The
|
||||
* download can both be active or inactive.
|
||||
*/
|
||||
function is_download_available(aID, aSrc, aDst, aName) {
|
||||
let download;
|
||||
try {
|
||||
download = dm.getDownload(aID);
|
||||
} catch (ex) {
|
||||
return false;
|
||||
}
|
||||
return (download.id == aID &&
|
||||
download.source.spec == aSrc &&
|
||||
download.targetFile.path == aDst.path &&
|
||||
download.displayName == aName);
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
if (!pb) // Private Browsing might not be available
|
||||
return;
|
||||
|
||||
let prefBranch = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
prefBranch.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
||||
|
||||
do_test_pending();
|
||||
let httpserv = new HttpServer();
|
||||
httpserv.registerDirectory("/", do_get_cwd());
|
||||
|
||||
let tmpDir = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties).
|
||||
get("TmpD", Ci.nsIFile);
|
||||
const nsIWBP = Ci.nsIWebBrowserPersist;
|
||||
|
||||
// make sure we're starting with an empty DB
|
||||
do_check_eq(dm.activeDownloadCount, 0);
|
||||
|
||||
let listener = {
|
||||
phase: 1,
|
||||
handledC: false,
|
||||
onDownloadStateChange: function(aState, aDownload)
|
||||
{
|
||||
switch (aDownload.state) {
|
||||
case dm.DOWNLOAD_FAILED:
|
||||
case dm.DOWNLOAD_CANCELED:
|
||||
case dm.DOWNLOAD_DIRTY:
|
||||
case dm.DOWNLOAD_BLOCKED_POLICY:
|
||||
// Fail!
|
||||
if (aDownload.targetFile.exists())
|
||||
aDownload.targetFile.remove(false);
|
||||
dm.removeListener(this);
|
||||
do_throw("Download failed (name: " + aDownload.displayName + ", state: " + aDownload.state + ")");
|
||||
do_test_finished();
|
||||
break;
|
||||
|
||||
// We need to wait until Download-C has started, because otherwise it
|
||||
// won't be resumable, so the private browsing mode won't correctly pause it.
|
||||
case dm.DOWNLOAD_DOWNLOADING:
|
||||
if (aDownload.id == downloadC && !this.handledC && this.phase == 2) {
|
||||
// Sanity check: Download-C must be resumable
|
||||
do_check_true(dlC.resumable);
|
||||
|
||||
// Enter private browsing mode immediately
|
||||
pb.privateBrowsingEnabled = true;
|
||||
do_check_true(pb.privateBrowsingEnabled);
|
||||
|
||||
// Check that Download-C is paused and not accessible
|
||||
do_check_eq(dlC.state, dm.DOWNLOAD_PAUSED);
|
||||
do_check_eq(dm.activeDownloadCount, 0);
|
||||
do_check_false(is_download_available(downloadC, downloadCSource,
|
||||
fileC, downloadCName));
|
||||
|
||||
// Exit private browsing mode
|
||||
pb.privateBrowsingEnabled = false;
|
||||
do_check_false(pb.privateBrowsingEnabled);
|
||||
|
||||
// Check that Download-A is accessible
|
||||
do_check_true(is_download_available(downloadA, downloadASource,
|
||||
fileA, downloadAName));
|
||||
|
||||
// Check that Download-B is not accessible
|
||||
do_check_false(is_download_available(downloadB, downloadBSource,
|
||||
fileB, downloadBName));
|
||||
|
||||
// Check that Download-C is accessible
|
||||
do_check_true(is_download_available(downloadC, downloadCSource,
|
||||
fileC, downloadCName));
|
||||
|
||||
// only perform these checks the first time that Download-C is started
|
||||
this.handledC = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case dm.DOWNLOAD_FINISHED:
|
||||
do_check_true(aDownload.targetFile.exists());
|
||||
aDownload.targetFile.remove(false);
|
||||
this.onDownloadFinished();
|
||||
break;
|
||||
}
|
||||
},
|
||||
onStateChange: function(a, b, c, d, e) { },
|
||||
onProgressChange: function(a, b, c, d, e, f, g) { },
|
||||
onSecurityChange: function(a, b, c, d) { },
|
||||
onDownloadFinished: function () {
|
||||
switch (this.phase) {
|
||||
case 1: {
|
||||
do_check_eq(dm.activeDownloadCount, 0);
|
||||
|
||||
// Enter private browsing mode
|
||||
pb.privateBrowsingEnabled = true;
|
||||
do_check_true(pb.privateBrowsingEnabled);
|
||||
|
||||
// Check that Download-A is not accessible
|
||||
do_check_false(is_download_available(downloadA, downloadASource,
|
||||
fileA, downloadAName));
|
||||
|
||||
// Create Download-B
|
||||
let dlB = addDownload({
|
||||
isPrivate: pb.privateBrowsingEnabled,
|
||||
targetFile: fileB,
|
||||
sourceURI: downloadBSource,
|
||||
downloadName: downloadBName,
|
||||
runBeforeStart: function (aDownload) {
|
||||
// Check that Download-B is retrievable
|
||||
do_check_eq(dm.activeDownloadCount, 1);
|
||||
do_check_true(is_active_download_available(aDownload.id,
|
||||
downloadBSource, fileB, downloadBName));
|
||||
do_check_true(is_download_available(aDownload.id,
|
||||
downloadBSource, fileB, downloadBName));
|
||||
}
|
||||
});
|
||||
downloadB = dlB.id;
|
||||
|
||||
// wait for Download-B to finish
|
||||
++this.phase;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: {
|
||||
do_check_eq(dm.activeDownloadCount, 0);
|
||||
|
||||
// Exit private browsing mode
|
||||
pb.privateBrowsingEnabled = false;
|
||||
do_check_false(pb.privateBrowsingEnabled);
|
||||
|
||||
// Check that Download-A is accessible
|
||||
do_check_true(is_download_available(downloadA, downloadASource,
|
||||
fileA, downloadAName));
|
||||
|
||||
// Check that Download-B is not accessible
|
||||
do_check_false(is_download_available(downloadB, downloadBSource,
|
||||
fileB, downloadBName));
|
||||
|
||||
// Create Download-C
|
||||
httpserv.start(4444);
|
||||
dlC = addDownload({
|
||||
isPrivate: pb.privateBrowsingEnabled,
|
||||
targetFile: fileC,
|
||||
sourceURI: downloadCSource,
|
||||
downloadName: downloadCName,
|
||||
runBeforeStart: function (aDownload) {
|
||||
// Check that Download-C is retrievable
|
||||
do_check_eq(dm.activeDownloadCount, 1);
|
||||
do_check_true(is_active_download_available(aDownload.id,
|
||||
downloadCSource, fileC, downloadCName));
|
||||
do_check_true(is_download_available(aDownload.id,
|
||||
downloadCSource, fileC, downloadCName));
|
||||
}
|
||||
});
|
||||
downloadC = dlC.id;
|
||||
|
||||
// wait for Download-C to finish
|
||||
++this.phase;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: {
|
||||
do_check_eq(dm.activeDownloadCount, 0);
|
||||
|
||||
// Check that Download-A is accessible
|
||||
do_check_true(is_download_available(downloadA, downloadASource,
|
||||
fileA, downloadAName));
|
||||
|
||||
// Check that Download-B is not accessible
|
||||
do_check_false(is_download_available(downloadB, downloadBSource,
|
||||
fileB, downloadBName));
|
||||
|
||||
// Check that Download-C is accessible
|
||||
do_check_true(is_download_available(downloadC, downloadCSource,
|
||||
fileC, downloadCName));
|
||||
|
||||
// cleanup
|
||||
prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
|
||||
dm.removeListener(this);
|
||||
httpserv.stop(do_test_finished);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
do_throw("Unexpected phase: " + this.phase);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
dm.addListener(listener);
|
||||
dm.addListener(getDownloadListener());
|
||||
|
||||
// properties of Download-A
|
||||
let downloadA = -1;
|
||||
const downloadASource = "data:image/png;base64,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";
|
||||
const downloadADest = "download-file-A";
|
||||
const downloadAName = "download-A";
|
||||
|
||||
// properties of Download-B
|
||||
let downloadB = -1;
|
||||
const downloadBSource = "data:application/octet-stream;base64,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";
|
||||
const downloadBDest = "download-file-B";
|
||||
const downloadBName = "download-B";
|
||||
|
||||
// properties of Download-C
|
||||
let downloadC = -1;
|
||||
const downloadCSource = "http://localhost:4444/head_download_manager.js";
|
||||
const downloadCDest = "download-file-C";
|
||||
const downloadCName = "download-C";
|
||||
|
||||
// Create all target files
|
||||
let fileA = tmpDir.clone();
|
||||
fileA.append(downloadADest);
|
||||
fileA.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
|
||||
let fileB = tmpDir.clone();
|
||||
fileB.append(downloadBDest);
|
||||
fileB.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
|
||||
let fileC = tmpDir.clone();
|
||||
fileC.append(downloadCDest);
|
||||
fileC.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
|
||||
|
||||
// use js closures to access dlC
|
||||
let dlC;
|
||||
|
||||
// Create Download-A
|
||||
let dlA = addDownload({
|
||||
isPrivate: pb.privateBrowsingEnabled,
|
||||
targetFile: fileA,
|
||||
sourceURI: downloadASource,
|
||||
downloadName: downloadAName,
|
||||
runBeforeStart: function (aDownload) {
|
||||
// Check that Download-A is retrievable
|
||||
do_check_eq(dm.activeDownloadCount, 1);
|
||||
do_check_true(is_active_download_available(aDownload.id, downloadASource, fileA, downloadAName));
|
||||
do_check_true(is_download_available(aDownload.id, downloadASource, fileA, downloadAName));
|
||||
}
|
||||
});
|
||||
downloadA = dlA.id;
|
||||
|
||||
// wait for Download-A to finish
|
||||
}
|
|
@ -22,10 +22,16 @@ skip-if = os == "android"
|
|||
[test_offline_support.js]
|
||||
[test_old_download_files_removed.js]
|
||||
[test_private_resume.js]
|
||||
skip-if = !perwindowprivatebrowsing
|
||||
[test_private_resume_global.js]
|
||||
skip-if = perwindowprivatebrowsing
|
||||
[test_privatebrowsing.js]
|
||||
skip-if = !perwindowprivatebrowsing
|
||||
[test_privatebrowsing_global.js]
|
||||
skip-if = perwindowprivatebrowsing
|
||||
[test_privatebrowsing_cancel.js]
|
||||
skip-if = !perwindowprivatebrowsing
|
||||
[test_privatebrowsing_cancel_global.js]
|
||||
skip-if = perwindowprivatebrowsing
|
||||
[test_removeDownloadsByTimeframe.js]
|
||||
[test_resume.js]
|
||||
|
|
Загрузка…
Ссылка в новой задаче