Bug 1318767 - Part 4: Add a test for navigating into dead PartialSHistories, r=ehsan
authorMichael Layzell <michael@thelayzells.com>
Wed, 14 Dec 2016 16:11:29 +0800
changeset 325805 3360b8d2f04bc8439c101c3fa892eecd7465e073
parent 325804 44a95445e11d8eff6ca5c10f1b2b913a9f44eeb0
child 325806 e92988d277ae11130bf5e6774bc0c1bbaf1521b4
push id84804
push userechen@mozilla.com
push dateWed, 14 Dec 2016 09:57:26 +0000
treeherdermozilla-inbound@3360b8d2f04b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1318767
milestone53.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 1318767 - Part 4: Add a test for navigating into dead PartialSHistories, r=ehsan MozReview-Commit-ID: LT8NeCdf3fm
docshell/test/browser/browser.ini
docshell/test/browser/browser_grouped_shistory_dead_navigate.js
--- a/docshell/test/browser/browser.ini
+++ b/docshell/test/browser/browser.ini
@@ -86,8 +86,10 @@ support-files =
 [browser_tab_touch_events.js]
 [browser_timelineMarkers-01.js]
 [browser_timelineMarkers-02.js]
 skip-if = true # Bug 1220415
 [browser_timelineMarkers-03.js]
 [browser_timelineMarkers-04.js]
 [browser_timelineMarkers-05.js]
 [browser_ua_emulation.js]
+[browser_grouped_shistory_dead_navigate.js]
+skip-if = !e10s
new file mode 100644
--- /dev/null
+++ b/docshell/test/browser/browser_grouped_shistory_dead_navigate.js
@@ -0,0 +1,44 @@
+add_task(function* () {
+  yield SpecialPowers.pushPrefEnv({
+    set: [["browser.groupedhistory.enabled", true]]
+  });
+
+  // Wait for a process change and then fulfil the promise.
+  function awaitProcessChange(browser) {
+    return new Promise(resolve => {
+      browser.addEventListener("BrowserChangedProcess", function bcp(e) {
+        browser.removeEventListener("BrowserChangedProcess", bcp);
+        ok(true, "The browser changed process!");
+        resolve();
+      });
+    });
+  }
+
+  yield BrowserTestUtils.withNewTab({ gBrowser, url: "data:text/html,a" }, function* (browser1) {
+    // Set up the grouped SHEntry setup
+    let tab2 = gBrowser.loadOneTab("data:text/html,b", {
+      referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT,
+      allowThirdPartyFixup: true,
+      relatedToCurrent: true,
+      isPrerendered: true,
+    });
+    yield BrowserTestUtils.browserLoaded(tab2.linkedBrowser);
+    browser1.frameLoader.appendPartialSessionHistoryAndSwap(
+      tab2.linkedBrowser.frameLoader);
+    yield awaitProcessChange(browser1);
+
+    // Close tab2 such that the back frameloader is dead
+    yield BrowserTestUtils.removeTab(tab2);
+    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");
+    });
+    is(browser1.frameLoader.groupedSessionHistory, null,
+       "browser1's session history is now complete");
+  });
+});