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
This commit is contained in:
Kashav Madan
2019-11-06 15:35:18 +00:00
parent 399f0f0909
commit 586bea6aca

View File

@@ -265,10 +265,6 @@ function initPage() {
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");
@@ -325,6 +321,11 @@ function initPage() {
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() {