Bug 1336335 - fix intermittent failure in browser_invalid_uri_back_forward_manipulation.js by using proper util to wait for an error page load, r?johannh draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 20 Feb 2017 16:33:32 +0000
changeset 487088 3fa8935bdc675d8d6af18829b94445e0ddac6785
parent 487087 d0462b0948e0b1147dcce615bddcc46379bdadb2
child 546376 254c782f7a02c0f88b450b9c59687d16350ed194
push id46124
push usergijskruitbosch@gmail.com
push dateMon, 20 Feb 2017 16:33:55 +0000
reviewersjohannh
bugs1336335
milestone54.0a1
Bug 1336335 - fix intermittent failure in browser_invalid_uri_back_forward_manipulation.js by using proper util to wait for an error page load, r?johannh MozReview-Commit-ID: AYfyAmEGyOx
browser/base/content/test/general/browser_invalid_uri_back_forward_manipulation.js
--- a/browser/base/content/test/general/browser_invalid_uri_back_forward_manipulation.js
+++ b/browser/base/content/test/general/browser_invalid_uri_back_forward_manipulation.js
@@ -8,22 +8,17 @@
  * canGoForward.
  */
 add_task(function* checkBackFromInvalidURI() {
   yield pushPrefs(["keyword.enabled", false]);
   let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:robots", true);
   gURLBar.value = "::2600";
   gURLBar.focus();
 
-  let promiseErrorPageLoaded = new Promise(resolve => {
-    tab.linkedBrowser.addEventListener("DOMContentLoaded", function onLoad() {
-      tab.linkedBrowser.removeEventListener("DOMContentLoaded", onLoad, false, true);
-      resolve();
-    }, false, true);
-  });
+  let promiseErrorPageLoaded = BrowserTestUtils.waitForErrorPage(tab.linkedBrowser);
   EventUtils.synthesizeKey("VK_RETURN", {});
   yield promiseErrorPageLoaded;
 
   ok(gBrowser.webNavigation.canGoBack, "Should be able to go back");
   if (gBrowser.webNavigation.canGoBack) {
     // Can't use DOMContentLoaded here because the page is bfcached. Can't use pageshow for
     // the error page because it doesn't seem to fire for those.
     let promiseOtherPageLoaded = BrowserTestUtils.waitForEvent(tab.linkedBrowser, "pageshow", false,