Bug 1626362 - Combine two load error page functions into one. r=nika

I don't think we need these to be done at different times, since the set of checks that happen before uri fixup are error codes that won't be affected by fixup.

Differential Revision: https://phabricator.services.mozilla.com/D80107
This commit is contained in:
Matt Woodrow 2020-06-25 04:32:06 +00:00
Родитель 0f894bda06
Коммит 5f0218a196
2 изменённых файлов: 4 добавлений и 16 удалений

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

@ -5808,13 +5808,6 @@ already_AddRefed<nsIURI> nsDocShell::AttemptURIFixup(
return nullptr;
}
bool nsDocShell::ShouldLoadErrorPageWithoutFixup(nsresult aStatus) {
return aStatus == NS_ERROR_FILE_NOT_FOUND ||
aStatus == NS_ERROR_FILE_ACCESS_DENIED ||
aStatus == NS_ERROR_CORRUPTED_CONTENT ||
aStatus == NS_ERROR_INVALID_CONTENT_ENCODING;
}
nsresult nsDocShell::FilterStatusForErrorPage(
nsresult aStatus, nsIChannel* aChannel, uint32_t aLoadType,
bool aIsTopFrame, bool aUseErrorPages, bool aIsInitialDocument,
@ -5848,7 +5841,10 @@ nsresult nsDocShell::FilterStatusForErrorPage(
aStatus == NS_ERROR_NET_INADEQUATE_SECURITY ||
aStatus == NS_ERROR_NET_HTTP2_SENT_GOAWAY ||
aStatus == NS_ERROR_NET_HTTP3_PROTOCOL_ERROR ||
aStatus == NS_ERROR_DOM_BAD_URI ||
aStatus == NS_ERROR_DOM_BAD_URI || aStatus == NS_ERROR_FILE_NOT_FOUND ||
aStatus == NS_ERROR_FILE_ACCESS_DENIED ||
aStatus == NS_ERROR_CORRUPTED_CONTENT ||
aStatus == NS_ERROR_INVALID_CONTENT_ENCODING ||
NS_ERROR_GET_MODULE(aStatus) == NS_ERROR_MODULE_SECURITY) {
// Errors to be shown for any frame
return aStatus;
@ -6022,12 +6018,6 @@ nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
// 5. Throw an error dialog box...
//
if (NS_FAILED(aStatus)) {
if (ShouldLoadErrorPageWithoutFixup(aStatus)) {
UnblockEmbedderLoadEventForFailure();
DisplayLoadError(aStatus, url, nullptr, aChannel);
return NS_OK;
}
// Handle iframe document not loading error because source was
// a tracking URL. We make a note of this iframe node by including
// it in a dedicated array of blocked tracking nodes under its parent

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

@ -442,8 +442,6 @@ class nsDocShell final : public nsDocLoader,
bool aNotifyKeywordSearchLoading = false,
nsIInputStream** aNewPostData = nullptr);
static bool ShouldLoadErrorPageWithoutFixup(nsresult aStatus);
// Takes aStatus and filters out results that should not display
// an error page.
// If this returns a failed result, then we should display an error