Bug 1507209 - Don't fire 'onLoadError' if Firefox wouldn't show an error page r=smaug
authorJames Willcox <snorp@snorp.net>
Thu, 15 Nov 2018 17:55:55 +0000
changeset 504768 9fa6d8be9e0167bbb9345f3e18d4f3c07e5a2c79
parent 504767 a0b8137e55edab833c4d0c472cb1a7f8f13f7840
child 504769 9df7b65b7e2ed026534155b1d21c6613154a3757
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1507209
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1507209 - Don't fire 'onLoadError' if Firefox wouldn't show an error page r=smaug Differential Revision: https://phabricator.services.mozilla.com/D11911
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -4272,32 +4272,16 @@ nsDocShell::DisplayLoadError(nsresult aE
   nsAutoString formatStrs[kMaxFormatStrArgs];
   uint32_t formatStrCount = 0;
   bool addHostPort = false;
   nsresult rv = NS_OK;
   nsAutoString messageStr;
   nsAutoCString cssClass;
   nsAutoCString errorPage;
 
-  if (mLoadURIDelegate) {
-    nsCOMPtr<nsIURI> errorPageURI;
-    rv = mLoadURIDelegate->HandleLoadError(aURI, aError,
-                                           NS_ERROR_GET_MODULE(aError),
-                                           getter_AddRefs(errorPageURI));
-    if (NS_FAILED(rv)) {
-      *aDisplayedErrorPage = false;
-      return NS_OK;
-    }
-
-    if (errorPageURI) {
-      *aDisplayedErrorPage = NS_SUCCEEDED(LoadErrorPage(errorPageURI, aURI, aFailedChannel));
-      return NS_OK;
-    }
-  }
-
   errorPage.AssignLiteral("neterror");
 
   // Turn the error code into a human readable error message.
   if (NS_ERROR_UNKNOWN_PROTOCOL == aError) {
     NS_ENSURE_ARG_POINTER(aURI);
 
     // Extract the schemes into a comma delimited list.
     nsAutoCString scheme;
@@ -4603,16 +4587,32 @@ nsDocShell::DisplayLoadError(nsresult aE
     }
   }
 
   // Test if the error should be displayed
   if (!error) {
     return NS_OK;
   }
 
+  if (mLoadURIDelegate) {
+    nsCOMPtr<nsIURI> errorPageURI;
+    rv = mLoadURIDelegate->HandleLoadError(aURI, aError,
+                                           NS_ERROR_GET_MODULE(aError),
+                                           getter_AddRefs(errorPageURI));
+    if (NS_FAILED(rv)) {
+      *aDisplayedErrorPage = false;
+      return NS_OK;
+    }
+
+    if (errorPageURI) {
+      *aDisplayedErrorPage = NS_SUCCEEDED(LoadErrorPage(errorPageURI, aURI, aFailedChannel));
+      return NS_OK;
+    }
+  }
+
   if (!errorDescriptionID) {
     errorDescriptionID = error;
   }
 
   // Test if the error needs to be formatted
   if (!messageStr.IsEmpty()) {
     // already obtained message
   } else {