Bug 1416254 - Remove conditional catch consumers in uriloader/. r=mak

This commit is contained in:
Tooru Fujisawa 2017-11-23 14:22:19 +09:00
Родитель cbd4fe279b
Коммит 4c6f4eda25
3 изменённых файлов: 15 добавлений и 6 удалений

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

@ -16,8 +16,11 @@ function run_test() {
var type = Cc["@mozilla.org/mime;1"].
getService(Ci.nsIMIMEService).
getFromTypeAndExtension(badMimeType, "txt");
} catch (e if (e instanceof Ci.nsIException &&
e.result == Cr.NS_ERROR_NOT_AVAILABLE)) {
} catch (e) {
if (!(e instanceof Ci.nsIException) ||
e.result != Cr.NS_ERROR_NOT_AVAILABLE) {
throw e;
}
// This is an expected exception, thrown if the type can't be determined
} finally {
}

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

@ -30,8 +30,11 @@ function run_test() {
mimeService.getTypeFromExtension(kTestExtension);
// The line above should have thrown an exception.
do_throw("nsIMIMEService.getTypeFromExtension succeeded unexpectedly");
} catch (e if (e instanceof Ci.nsIException &&
e.result == Cr.NS_ERROR_NOT_AVAILABLE)) {
} catch (e) {
if (!(e instanceof Ci.nsIException) ||
e.result != Cr.NS_ERROR_NOT_AVAILABLE) {
throw e;
}
// This is an expected exception, thrown if the type can't be determined.
// Any other exception would cause the test to fail.
}

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

@ -174,8 +174,11 @@ function run_test() {
var type = Cc["@mozilla.org/mime;1"].
getService(Ci.nsIMIMEService).
getTypeFromExtension(".txt");
} catch (e if (e instanceof Ci.nsIException &&
e.result == Cr.NS_ERROR_NOT_AVAILABLE)) {
} catch (e) {
if (!(e instanceof Ci.nsIException) ||
e.result != Cr.NS_ERROR_NOT_AVAILABLE) {
throw e;
}
// This is an expected exception, thrown if the type can't be determined
} finally {
// Ensure we restore the original factory when the test is finished