Bug 1094208 - Part 1 of 3 - Fix browser_restore_isAppTab.js to work with the DOM Promise scheduling. r=mconley
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Thu, 13 Nov 2014 11:19:08 +0000
changeset 215607 7a19f76e912e0b8048a3192f0dc00397ab2abb9b
parent 215606 3c84bb853ee6d45cff6c1dbe68b7723381acd5c2
child 215608 d187d7f83b90d30e614fd1b1191475882fe6af1b
push id51796
push userryanvm@gmail.com
push dateThu, 13 Nov 2014 20:47:14 +0000
treeherdermozilla-inbound@a05b5362429f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1094208
milestone36.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 1094208 - Part 1 of 3 - Fix browser_restore_isAppTab.js to work with the DOM Promise scheduling. r=mconley
browser/base/content/test/general/browser_restore_isAppTab.js
--- a/browser/base/content/test/general/browser_restore_isAppTab.js
+++ b/browser/base/content/test/general/browser_restore_isAppTab.js
@@ -65,18 +65,22 @@ function loadFrameScript(browser) {
 }
 
 function isBrowserAppTab(browser) {
   return new Promise(resolve => {
     function listener({ data }) {
       browser.messageManager.removeMessageListener("Test:IsAppTab", listener);
       resolve(data.isAppTab);
     }
-    browser.messageManager.addMessageListener("Test:IsAppTab", listener);
-    browser.messageManager.sendAsyncMessage("Test:GetIsAppTab");
+    // It looks like same-process messages may be reordered by the message
+    // manager, so we need to wait one tick before sending the message.
+    executeSoon(function () {
+      browser.messageManager.addMessageListener("Test:IsAppTab", listener);
+      browser.messageManager.sendAsyncMessage("Test:GetIsAppTab");
+    });
   });
 }
 
 // Restarts the child process by crashing it then reloading the tab
 let restart = Task.async(function*(browser) {
   // If the tab isn't remote this would crash the main process so skip it
   if (!browser.isRemoteBrowser)
     return browser;