Bug 1588193 - Don't dispatch AboutNetErrorLoad until we're completely setup, r=johannh
☠☠ backed out by 5eaefee2f30d ☠ ☠
authorKashav Madan <kmadan@mozilla.com>
Tue, 05 Nov 2019 21:52:14 +0000
changeset 500756 c90bab12f4cb6fc5baaa43d3f3e14c681b9cd390
parent 500755 b3988d311be3e180e9b4d3afd678cc76bcbda158
child 500757 b10ec4058ec3aee7c9cde560a6afeeaca7bce2c9
push id114166
push userapavel@mozilla.com
push dateThu, 07 Nov 2019 10:04:01 +0000
treeherdermozilla-inbound@d271c572a9bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1588193
milestone72.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 1588193 - Don't dispatch AboutNetErrorLoad until we're completely setup, r=johannh BrowserTestUtils.waitForErrorPage may resolve slightly earlier than it did before, so we may arrive at an about:neterror page that hasn't been completely initialized. We should only dispatch the AboutNetErrorLoad event when we're done making changes to the page. Differential Revision: https://phabricator.services.mozilla.com/D51439
browser/base/content/aboutNetError.js
--- a/browser/base/content/aboutNetError.js
+++ b/browser/base/content/aboutNetError.js
@@ -260,20 +260,16 @@ function initPage() {
   }
 
   if (err == "cspBlocked" || err == "xfoBlocked") {
     // Remove the "Try again" button for XFO and CSP violations,
     // since it's almost certainly useless. (Bug 553180)
     document.getElementById("netErrorButtonContainer").style.display = "none";
   }
 
-  // Dispatch this event only for tests.
-  let event = new CustomEvent("AboutNetErrorLoad", { bubbles: true });
-  document.dispatchEvent(event);
-
   setNetErrorMessageFromCode();
   let learnMoreLink = document.getElementById("learnMoreLink");
   let baseURL = RPMGetFormatURLPref("app.support.baseURL");
   learnMoreLink.setAttribute("href", baseURL + "connection-not-secure");
 
   // Pinning errors are of type nssFailure2
   if (err == "nssFailure2") {
     setupErrorUI();
@@ -320,16 +316,21 @@ function initPage() {
     // again won't help.
     document.getElementById("netErrorButtonContainer").style.display = "none";
 
     var container = document.getElementById("errorLongDesc");
     for (var span of container.querySelectorAll("span.hostname")) {
       span.textContent = document.location.hostname;
     }
   }
+
+  // Dispatch this event only for tests. This should only be sent after we're
+  // done initializing the error page.
+  let event = new CustomEvent("AboutNetErrorLoad", { bubbles: true });
+  document.dispatchEvent(event);
 }
 
 function setupErrorUI() {
   document.getElementById("learnMoreContainer").style.display = "block";
 
   let checkbox = document.getElementById("automaticallyReportInFuture");
   checkbox.addEventListener("change", function({ target: { checked } }) {
     onSetAutomatic(checked);