Bug 1697866 - Add HTTPS-only specific error code and pass it to GeckoView, to handle HTTPS-only specific errors correctly r=agi,JulianWels,nika,ckerschb

Differential Revision: https://phabricator.services.mozilla.com/D120914
This commit is contained in:
owlishDeveloper
2021-09-23 01:41:47 +00:00
parent a6ef3b87c9
commit acdc3731fc
18 changed files with 323 additions and 76 deletions

View File

@@ -3679,15 +3679,17 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
// If the HTTPS-Only Mode upgraded this request and the upgrade might have
// caused this error, we replace the error-page with about:httpsonlyerror
if (nsHTTPSOnlyUtils::CouldBeHttpsOnlyError(aFailedChannel, aError)) {
bool isHttpsOnlyError =
nsHTTPSOnlyUtils::CouldBeHttpsOnlyError(aFailedChannel, aError);
if (isHttpsOnlyError) {
errorPage.AssignLiteral("httpsonlyerror");
}
if (nsCOMPtr<nsILoadURIDelegate> loadURIDelegate = GetLoadURIDelegate()) {
nsCOMPtr<nsIURI> errorPageURI;
rv = loadURIDelegate->HandleLoadError(aURI, aError,
NS_ERROR_GET_MODULE(aError),
getter_AddRefs(errorPageURI));
rv = loadURIDelegate->HandleLoadError(
aURI, (isHttpsOnlyError ? NS_ERROR_HTTPS_ONLY : aError),
NS_ERROR_GET_MODULE(aError), getter_AddRefs(errorPageURI));
// If the docshell is going away there's no point in showing an error page.
if (NS_FAILED(rv) || mIsBeingDestroyed) {
*aDisplayedErrorPage = false;