Bug 1336763 - Wait for the browser to say it can go back before going back in browser_grouped_shistory_dead_navigate.js test. r?mystor draft
authorMike Conley <mconley@mozilla.com>
Thu, 27 Apr 2017 15:07:55 -0400
changeset 570387 13d2aef113377682f79c861a66a715b6e24f144d
parent 570386 774f46bc9638562c49c7226c075c68109b1b2c27
child 626473 9c1f917261cc991be20d8bfd851111901d5f0aca
push id56469
push usermconley@mozilla.com
push dateFri, 28 Apr 2017 19:52:42 +0000
reviewersmystor
bugs1336763
milestone55.0a1
Bug 1336763 - Wait for the browser to say it can go back before going back in browser_grouped_shistory_dead_navigate.js test. r?mystor This test was accidentally taking advantage of the fact that closing a tab will result in a nested event loop while waiting for the permitUnload messages to be sent back and forth from the content process. This meant that the message that tells the parent that the browser (which is having its history set) can now go back had a chance to be received by the parent. With the patches in bug 1336763, we're no longer spinning the event loop if the closing tab doesn't have a beforeunload event handler in it, so we need to wait for the browser to report that it can go back before actually sending it back in order to avoid a test failure. MozReview-Commit-ID: Lpl55iErrvf
docshell/test/browser/browser_grouped_shistory_dead_navigate.js
--- a/docshell/test/browser/browser_grouped_shistory_dead_navigate.js
+++ b/docshell/test/browser/browser_grouped_shistory_dead_navigate.js
@@ -23,16 +23,17 @@ add_task(function* () {
       isPrerendered: true,
     });
     yield BrowserTestUtils.browserLoaded(tab2.linkedBrowser);
     browser1.frameLoader.appendPartialSHistoryAndSwap(tab2.linkedBrowser.frameLoader);
     yield awaitProcessChange(browser1);
 
     // Close tab2 such that the back frameloader is dead
     yield BrowserTestUtils.removeTab(tab2);
+    yield BrowserTestUtils.waitForCondition(() => browser1.canGoBack);
     browser1.goBack();
     yield BrowserTestUtils.browserLoaded(browser1);
     yield ContentTask.spawn(browser1, null, function() {
       is(content.window.location + "", "data:text/html,a");
       let webNav = content.window.QueryInterface(Ci.nsIInterfaceRequestor)
             .getInterface(Ci.nsIWebNavigation);
       is(webNav.canGoForward, true, "canGoForward is correct");
       is(webNav.canGoBack, false, "canGoBack is correct");