Bug 941099 - Default application handler is not correctly used when an alternate app handler exists. r=paolo

This commit is contained in:
Felipe Gomes 2013-11-28 00:57:05 -02:00
parent 66e008f703
commit 5b12e7ad40
3 changed files with 7 additions and 3 deletions

View File

@ -200,7 +200,8 @@ DownloadLegacyTransfer.prototype = {
contentType = aMIMEInfo.type;
let appHandler = aMIMEInfo.preferredApplicationHandler;
if (appHandler instanceof Ci.nsILocalHandlerApp) {
if (aMIMEInfo.preferredAction == Ci.nsIMIMEInfo.useHelperApp &&
appHandler instanceof Ci.nsILocalHandlerApp) {
launcherPath = appHandler.executable.path;
}
}

View File

@ -1521,6 +1521,7 @@ add_task(function test_launch() {
source: httpUrl("source.txt"),
target: getTempFile(TEST_TARGET_FILE_NAME).path,
launcherPath: launcherPath,
launchWhenSucceeded: true
});
try {
@ -1537,11 +1538,12 @@ add_task(function test_launch() {
// it is created, thus we don't test calling "launch" before starting.
download = yield promiseStartLegacyDownload(
httpUrl("source.txt"),
{ launcherPath: launcherPath });
{ launcherPath: launcherPath,
launchWhenSucceeded: true });
yield promiseDownloadStopped(download);
}
do_check_false(download.launchWhenSucceeded);
do_check_true(download.launchWhenSucceeded);
DownloadIntegration._deferTestOpenFile = Promise.defer();
download.launch();

View File

@ -341,6 +341,7 @@ function promiseStartLegacyDownload(aSourceUrl, aOptions) {
localHandlerApp.executable = new FileUtils.File(aOptions.launcherPath);
mimeInfo.preferredApplicationHandler = localHandlerApp;
mimeInfo.preferredAction = Ci.nsIMIMEInfo.useHelperApp;
}
if (aOptions && aOptions.launchWhenSucceeded) {