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
Родитель 708361ed09
Коммит 6f4dafcc2c
3 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -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;
}
}

Просмотреть файл

@ -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();

Просмотреть файл

@ -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) {