Bug 1428253 - Resume the test at next tick after the resolve of openTabSelectedPromise. r=:Gijs.
authorBevis Tseng <btseng@mozilla.com>
Tue, 16 Jan 2018 14:04:36 +0800
changeset 453890 37c38f403e4d34de41a568136e7b7fb45dd38fb5
parent 453889 c33945be1657a720fc1ec79124e0e85df0dffeaa
child 453891 89c02d32a35ce468f8d441059b413d654e4384e0
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1428253
milestone59.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 1428253 - Resume the test at next tick after the resolve of openTabSelectedPromise. r=:Gijs. With the conformant promising scheduling, the promise callback can be performed eariler at the returning from a event listener if possible instead of the end of current task. The resolving of "selected" change of the openedTab becomes part of the process of RemotePrompt.openTabPrompt() where the 'DOMWillOpenModalDialog' event is fired. We should resume the test at next tick to ensure that the openTabPrompt() is done before removing the openedTab.
browser/base/content/test/tabPrompts/browser_openPromptInBackgroundTab.js
--- a/browser/base/content/test/tabPrompts/browser_openPromptInBackgroundTab.js
+++ b/browser/base/content/test/tabPrompts/browser_openPromptInBackgroundTab.js
@@ -70,10 +70,16 @@ add_task(async function() {
 
   // This is sync in non-e10s, but in e10s we need to wait for this, so yield anyway.
   // Note that the switchTab promise doesn't actually guarantee anything about *which*
   // tab ends up as selected when its event fires, so using that here wouldn't work.
   await openedTabSelectedPromise;
   // should be switched back
   ok(openedTab.selected, "Ta-dah, the other tab should now be selected again!");
 
+  // In e10s, with the conformant promise scheduling, we have to wait for next tick
+  // to ensure that the prompt is open before removing the opened tab, because the
+  // promise callback of 'openedTabSelectedPromise' could be done at the middle of
+  // RemotePrompt.openTabPrompt() while 'DOMModalDialogClosed' event is fired.
+  await TestUtils.waitForTick();
+
   await BrowserTestUtils.removeTab(openedTab);
 });