Bug 1266475 - don't re-load about:blank when we're remoteness-switching anyway, r=mconley

MozReview-Commit-ID: HwPrmjzCxHq

--HG--
extra : rebase_source : 0526ffa60cc63cad9aaaa16b0f0bf2faa69234f2
extra : amend_source : 5a0135c6daf192d12dd1b24570a33ea6afb29310
This commit is contained in:
Gijs Kruitbosch 2016-04-21 17:55:42 +01:00
Родитель c5e089ec4e
Коммит b6a127aa5c
4 изменённых файлов: 46 добавлений и 4 удалений

Просмотреть файл

@ -8,3 +8,6 @@ support-files =
[browser_urlbar_stop_pending.js]
support-files =
slow-page.sjs
[browser_urlbar_remoteness_switch.js]
run-if = e10s

Просмотреть файл

@ -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);
});
});

Просмотреть файл

@ -138,7 +138,7 @@ ContentRestoreInternal.prototype = {
// 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);
@ -175,7 +175,7 @@ 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;
@ -189,7 +189,7 @@ ContentRestoreInternal.prototype = {
// 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"));
}

Просмотреть файл

@ -171,7 +171,7 @@ var MessageListener = {
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});