Bug 1266475 - don't re-load about:blank when we're remoteness-switching anyway, r=mconley
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 21 Apr 2016 17:55:42 +0100
changeset 332196 6d26d2099e1a38a39f3010bd4d6abc79d63312ba
parent 332195 244de786f7140a642165d39b279e86ae1faa6895
child 332197 b813b1e6e7e3288a865965bb9beefbf9d36b4a67
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1266475
milestone48.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 1266475 - don't re-load about:blank when we're remoteness-switching anyway, r=mconley MozReview-Commit-ID: HwPrmjzCxHq
browser/base/content/test/urlbar/browser.ini
browser/base/content/test/urlbar/browser_urlbar_remoteness_switch.js
browser/components/sessionstore/ContentRestore.jsm
browser/components/sessionstore/content/content-sessionStore.js
--- a/browser/base/content/test/urlbar/browser.ini
+++ b/browser/base/content/test/urlbar/browser.ini
@@ -3,8 +3,11 @@
 support-files =
   file_blank_but_not_blank.html
 [browser_urlbar_locationchange_urlbar_edit_dos.js]
 support-files =
   file_urlbar_edit_dos.html
 [browser_urlbar_stop_pending.js]
 support-files =
   slow-page.sjs
+[browser_urlbar_remoteness_switch.js]
+run-if = e10s
+
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/urlbar/browser_urlbar_remoteness_switch.js
@@ -0,0 +1,39 @@
+"use strict";
+
+/**
+ * Verify that when loading and going back/forward through history between URLs
+ * loaded in the content process, and URLs loaded in the parent process, we
+ * don't set the URL for the tab to about:blank inbetween the loads.
+ */
+add_task(function*() {
+  let url = "http://www.example.com/foo.html";
+  yield BrowserTestUtils.withNewTab({gBrowser, url}, function*(browser) {
+    let wpl = {
+      onLocationChange(wpl, request, location, flags) {
+        if (location.schemeIs("about")) {
+          is(location.spec, "about:config", "Only about: location change should be for about:preferences");
+        } else {
+          is(location.spec, url, "Only non-about: location change should be for the http URL we're dealing with.");
+        }
+      },
+    };
+    gBrowser.addProgressListener(wpl);
+
+    let didLoad = BrowserTestUtils.browserLoaded(browser, null, function(loadedURL) {
+      return loadedURL == "about:config";
+    });
+    yield BrowserTestUtils.loadURI(browser, "about:config");
+    yield didLoad;
+
+    gBrowser.goBack();
+    yield BrowserTestUtils.browserLoaded(browser, null, function(loadedURL) {
+      return url == loadedURL;
+    });
+    gBrowser.goForward();
+    yield BrowserTestUtils.browserLoaded(browser, null, function(loadedURL) {
+      return loadedURL == "about:config";
+    });
+    gBrowser.removeProgressListener(wpl);
+  });
+});
+
--- a/browser/components/sessionstore/ContentRestore.jsm
+++ b/browser/components/sessionstore/ContentRestore.jsm
@@ -133,17 +133,17 @@ ContentRestoreInternal.prototype = {
       webNavigation.setCurrentURI(Utils.makeURI(uri));
     }
 
     SessionHistory.restore(this.docShell, tabData);
 
     // Add a listener to watch for reloads.
     let listener = new HistoryListener(this.docShell, () => {
       // On reload, restore tab contents.
-      this.restoreTabContent(null, callbacks.onLoadFinished);
+      this.restoreTabContent(null, false, callbacks.onLoadFinished);
     });
 
     webNavigation.sessionHistory.addSHistoryListener(listener);
     this._historyListener = listener;
 
     // Make sure to reset the capabilities and attributes in case this tab gets
     // reused.
     let disallow = new Set(tabData.disallow && tabData.disallow.split(","));
@@ -170,31 +170,31 @@ ContentRestoreInternal.prototype = {
       }
     });
   },
 
   /**
    * Start loading the current page. When the data has finished loading from the
    * network, finishCallback is called. Returns true if the load was successful.
    */
-  restoreTabContent: function (loadArguments, finishCallback) {
+  restoreTabContent: function (loadArguments, isRemotenessUpdate, finishCallback) {
     let tabData = this._tabData;
     this._tabData = null;
 
     let webNavigation = this.docShell.QueryInterface(Ci.nsIWebNavigation);
     let history = webNavigation.sessionHistory;
 
     // Listen for the tab to finish loading.
     this.restoreTabContentStarted(finishCallback);
 
     // Reset the current URI to about:blank. We changed it above for
     // switch-to-tab, but now it must go back to the correct value before the
     // load happens. Don't bother doing this if we're restoring immediately
     // due to a process switch.
-    if (!loadArguments) {
+    if (!isRemotenessUpdate) {
       webNavigation.setCurrentURI(Utils.makeURI("about:blank"));
     }
 
     try {
       if (loadArguments) {
         // A load has been redirected to a new process so get history into the
         // same state it was before the load started then trigger the load.
         let referrer = loadArguments.referrer ?
--- a/browser/components/sessionstore/content/content-sessionStore.js
+++ b/browser/components/sessionstore/content/content-sessionStore.js
@@ -166,17 +166,17 @@ var MessageListener = {
     // to temporarily synchronize them.
     sendSyncMessage("SessionStore:restoreHistoryComplete", {epoch});
   },
 
   restoreTabContent({loadArguments, isRemotenessUpdate}) {
     let epoch = gCurrentEpoch;
 
     // We need to pass the value of didStartLoad back to SessionStore.jsm.
-    let didStartLoad = gContentRestore.restoreTabContent(loadArguments, () => {
+    let didStartLoad = gContentRestore.restoreTabContent(loadArguments, isRemotenessUpdate, () => {
       // Tell SessionStore.jsm that it may want to restore some more tabs,
       // since it restores a max of MAX_CONCURRENT_TAB_RESTORES at a time.
       sendAsyncMessage("SessionStore:restoreTabContentComplete", {epoch, isRemotenessUpdate});
     });
 
     sendAsyncMessage("SessionStore:restoreTabContentStarted", {epoch});
 
     if (!didStartLoad) {