Bug 1313665 - Wait for Content:LocationChange before verify. r=smaug
authorSamael Wang <freesamael@gmail.com>
Tue, 01 Nov 2016 18:31:31 +0800
changeset 321457 3303f8ce11f9ea33eb67a760f8d03f531d1ae8b9
parent 321456 a0ff94cf57e7a15c359dd8b343b5f2f3f8fcd0b1
child 321458 3c814c9606ffc356e5c34571d1745e33781f445f
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewerssmaug
bugs1313665
milestone52.0a1
Bug 1313665 - Wait for Content:LocationChange before verify. r=smaug MozReview-Commit-ID: 2Sb24FCGG1o
dom/base/test/chrome/window_groupedSHistory.xul
--- a/dom/base/test/chrome/window_groupedSHistory.xul
+++ b/dom/base/test/chrome/window_groupedSHistory.xul
@@ -263,16 +263,22 @@ https://bugzilla.mozilla.org/show_bug.cg
     let promises = [];
     let pagehide1, pagehide2;
 
     // For swapping there should be a pagehide followed by a pageshow.
     promises.push(BrowserTestUtils.waitForMessage(b1.messageManager, 'test:pagehide', msg => pagehide1 = true));
     promises.push(BrowserTestUtils.waitForMessage(b2.messageManager, 'test:pagehide', msg => pagehide2 = true));
     promises.push(BrowserTestUtils.waitForMessage(b1.messageManager, 'test:pageshow', msg => pagehide1));
     promises.push(BrowserTestUtils.waitForMessage(b2.messageManager, 'test:pageshow', msg => pagehide2));
+
+    // For swapping remote browsers, we'll also receive Content:LocationChange
+    if (b1.isRemoteBrowser) {
+      promises.push(BrowserTestUtils.waitForMessage(b1.messageManager, 'Content:LocationChange'));
+    }
+
     promises.push(Promise.resolve().then(() => {
       let f1 = b1.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader;
       let f2 = b2.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader;
       f1.appendPartialSessionHistoryAndSwap(f2);
     }));
 
     return Promise.all(promises);
   }
@@ -281,16 +287,22 @@ https://bugzilla.mozilla.org/show_bug.cg
     let promises = [];
     let pagehide = false;
     let pageshowCount = 0;
 
     if (expectSwap) {
       // For swapping there should be a pagehide followed by a pageshow.
       promises.push(BrowserTestUtils.waitForMessage(browser.messageManager,
         'test:pagehide', msg => pagehide = true));
+
+      // For swapping remote browsers, we'll also receive Content:LocationChange
+      if (browser.isRemoteBrowser) {
+        promises.push(BrowserTestUtils.waitForMessage(browser.messageManager,
+          'Content:LocationChange'));
+      }
     }
     promises.push(BrowserTestUtils.waitForMessage(browser.messageManager,
       'test:pageshow', msg => {
         // Only count events after pagehide for swapping case.
         if (!expectSwap || pagehide) {
           return !--expectPageshowCount;
         }
         return false;