Bug 1336763 - Don't wait for response from content process in browser_closeTab.js UITour test to avoid a timeout. r?MattN draft
authorMike Conley <mconley@mozilla.com>
Thu, 27 Apr 2017 15:04:46 -0400
changeset 570386 774f46bc9638562c49c7226c075c68109b1b2c27
parent 570385 7e5b695fbd4578d3a74888ac121c63d8841cf58b
child 570387 13d2aef113377682f79c861a66a715b6e24f144d
push id56469
push usermconley@mozilla.com
push dateFri, 28 Apr 2017 19:52:42 +0000
reviewersMattN
bugs1336763
milestone55.0a1
Bug 1336763 - Don't wait for response from content process in browser_closeTab.js UITour test to avoid a timeout. r?MattN The closeTab API call from UITour tells the parent process to close the current tab, and doing so might end up disconnecting the message manager. This means that the Promise that the ContentTask returns may never resolve. Instead of waiting for it to resolve, we just wait for the TabClose event in the parent process. MozReview-Commit-ID: Ci7ck9j4llK
browser/components/uitour/test/browser_closeTab.js
--- a/browser/components/uitour/test/browser_closeTab.js
+++ b/browser/components/uitour/test/browser_closeTab.js
@@ -7,12 +7,17 @@ var gContentAPI;
 var gContentWindow;
 
 add_task(setup_UITourTest);
 
 add_UITour_task(function* test_closeTab() {
   // Setting gTestTab to null indicates that the tab has already been closed,
   // and if this does not happen the test run will fail.
   let closePromise = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabClose");
-  yield gContentAPI.closeTab();
+  // In the e10s-case, having content request a tab close might mean
+  // that the ContentTask used to send this closeTab message won't
+  // get a response (since the message manager may have closed down).
+  // So we ignore the Promise that closeTab returns, and use the TabClose
+  // event to tell us when the tab has gone away.
+  gContentAPI.closeTab();
   yield closePromise;
   gTestTab = null;
 });