Bug 1669833 - Removed else after the return statement. r=jfkthame

Differential Revision: https://phabricator.services.mozilla.com/D93873
This commit is contained in:
Akshat Dixit 2020-10-17 13:47:13 +00:00
parent c47fc76053
commit f71808cc4b

View File

@ -195,7 +195,8 @@ nsresult nsChromeRegistry::Canonify(nsCOMPtr<nsIURI>& aChromeURL) {
return NS_ERROR_INVALID_ARG;
}
return NS_MutateURI(aChromeURL).SetPathQueryRef(path).Finalize(aChromeURL);
} else {
}
// prevent directory traversals ("..")
// path is already unescaped once, but uris can get unescaped twice
const char* pos = path.BeginReading();
@ -210,14 +211,17 @@ nsresult nsChromeRegistry::Canonify(nsCOMPtr<nsIURI>& aChromeURL) {
case ':':
return NS_ERROR_DOM_BAD_URI;
case '.':
if (pos[1] == '.') return NS_ERROR_DOM_BAD_URI;
if (pos[1] == '.') {
return NS_ERROR_DOM_BAD_URI;
}
break;
case '%':
// chrome: URIs with double-escapes are trying to trick us.
// watch for %2e, and %25 in case someone triple unescapes
if (pos[1] == '2' &&
(pos[2] == 'e' || pos[2] == 'E' || pos[2] == '5'))
(pos[2] == 'e' || pos[2] == 'E' || pos[2] == '5')) {
return NS_ERROR_DOM_BAD_URI;
}
break;
case '?':
case '#':
@ -226,7 +230,6 @@ nsresult nsChromeRegistry::Canonify(nsCOMPtr<nsIURI>& aChromeURL) {
}
++pos;
}
}
return NS_OK;
}