From 8ed0970932904ec24866263419774cd500bb891d Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Wed, 22 Apr 2020 10:27:31 +0000 Subject: [PATCH] Bug 1607984 - P15. Wait for the load to start before setting the event handler. r=Jamie addA11yLoadEvent gets the contentWindow and wait for the document from that window to fire the load event. Enabling the DocumentChannel for parent process load (or here in non-e10s mode) we have one extra event loop before the load starts. So the window passed to addAllyLoadEvent would have been of the about:blank page. The current code was based on an observable behaviour which was that the load was occuring synchronously. DocumentChannel broke that assumption. Differential Revision: https://phabricator.services.mozilla.com/D70799 --- accessible/tests/mochitest/browser.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/accessible/tests/mochitest/browser.js b/accessible/tests/mochitest/browser.js index a396cd26b3bd..74256d434059 100644 --- a/accessible/tests/mochitest/browser.js +++ b/accessible/tests/mochitest/browser.js @@ -135,6 +135,11 @@ function openBrowserWindowIntl() { function startBrowserTests() { if (gBrowserContext.startURL) { + // Make sure the window is the one loading our URL. + if (currentBrowser().contentWindow.location != gBrowserContext.startURL) { + setTimeout(startBrowserTests, 0); + return; + } // wait for load addA11yLoadEvent(gBrowserContext.testFunc, currentBrowser().contentWindow); } else {