Bug 1598516 - Handle malformed uri load error with an error page. r=kmag

Previously this error occurred synchronously during AsyncOpen, and we handled it there.
With DocumentChannel we don't find out until it's handled in the parent, so the error is returned to the docshell via a failed status on the request.

Differential Revision: https://phabricator.services.mozilla.com/D54248

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Woodrow 2019-11-25 20:22:57 +00:00
Родитель f1d25c550d
Коммит 03ee2f1377
1 изменённых файлов: 7 добавлений и 0 удалений

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

@ -3685,6 +3685,9 @@ NS_IMETHODIMP
nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
const char16_t* aURL, nsIChannel* aFailedChannel,
bool* aDisplayedErrorPage) {
MOZ_LOG(gDocShellLeakLog, LogLevel::Debug,
("DOCSHELL %p DisplayLoadError %s\n", this,
aURI ? aURI->GetSpecOrDefault().get() : ""));
// If we have a cross-process parent document, we must notify it that we no
// longer block its load event. This is necessary for OOP sub-documents
// because error documents do not result in a call to
@ -6220,6 +6223,9 @@ nsDocShell::OnContentBlockingEvent(nsIWebProgress* aWebProgress,
nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
nsIChannel* aChannel, nsresult aStatus) {
MOZ_LOG(gDocShellLeakLog, LogLevel::Debug,
("DOCSHELL %p EndPageLoad status: %" PRIx32 "\n", this,
static_cast<uint32_t>(aStatus)));
if (!aChannel) {
return NS_ERROR_NULL_POINTER;
}
@ -6564,6 +6570,7 @@ nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
aStatus == NS_ERROR_PROXY_CONNECTION_REFUSED ||
aStatus == NS_ERROR_PROXY_AUTHENTICATION_FAILED ||
aStatus == NS_ERROR_PROXY_TOO_MANY_REQUESTS ||
aStatus == NS_ERROR_MALFORMED_URI ||
aStatus == NS_ERROR_BLOCKED_BY_POLICY) &&
(isTopFrame || UseErrorPages())) {
DisplayLoadError(aStatus, url, nullptr, aChannel);