Bug 1416251 - Remove conditional catch consumers in mobile/android/. r=nechen

This commit is contained in:
Tooru Fujisawa 2017-11-29 19:58:31 +09:00
parent fd27c36b82
commit 2efac753f7
2 changed files with 12 additions and 3 deletions

View File

@ -4477,14 +4477,20 @@ Tab.prototype = {
let originHost = "";
try {
originHost = Services.io.newURI(appOrigin).host;
} catch (e if (e.result == Cr.NS_ERROR_FAILURE)) {
} catch (e) {
if (e.result != Cr.NS_ERROR_FAILURE) {
throw e;
}
// NS_ERROR_FAILURE can be thrown by nsIURI.host if the URI scheme does not possess a host -
// in this case we just act as if we have an empty host.
}
let locationHost = "";
try {
locationHost = aLocationURI.host;
} catch (e if (e.result == Cr.NS_ERROR_FAILURE)) {
} catch (e) {
if (e.result != Cr.NS_ERROR_FAILURE) {
throw e;
}
// Ditto.
}
if (originHost != locationHost || originHost == "") {

View File

@ -265,7 +265,10 @@ function writeStat(snippetId, timestamp) {
} finally {
yield file.close();
}
} catch (ex if ex instanceof OS.File.Error && ex.becauseNoSuchFile) {
} catch (ex) {
if (!(ex instanceof OS.File.Error && ex.becauseNoSuchFile)) {
throw ex;
}
// If the file doesn't exist yet, create it.
yield OS.File.writeAtomic(gStatsPath, data, { tmpPath: gStatsPath + ".tmp" });
}