mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1170226 - Restore correct shistory index when setting up pending tabs r=billm
This commit is contained in:
parent
ec6faf1fd9
commit
c924ea409f
@ -193,11 +193,6 @@ ContentRestoreInternal.prototype = {
|
|||||||
if (loadArguments) {
|
if (loadArguments) {
|
||||||
// A load has been redirected to a new process so get history into the
|
// 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.
|
// same state it was before the load started then trigger the load.
|
||||||
let activeIndex = tabData.index - 1;
|
|
||||||
if (activeIndex > 0) {
|
|
||||||
// Go to the right history entry, but don't load anything yet.
|
|
||||||
history.getEntryAtIndex(activeIndex, true);
|
|
||||||
}
|
|
||||||
let referrer = loadArguments.referrer ?
|
let referrer = loadArguments.referrer ?
|
||||||
Utils.makeURI(loadArguments.referrer) : null;
|
Utils.makeURI(loadArguments.referrer) : null;
|
||||||
let referrerPolicy = ('referrerPolicy' in loadArguments
|
let referrerPolicy = ('referrerPolicy' in loadArguments
|
||||||
@ -210,12 +205,6 @@ ContentRestoreInternal.prototype = {
|
|||||||
// If the user typed a URL into the URL bar and hit enter right before
|
// If the user typed a URL into the URL bar and hit enter right before
|
||||||
// we crashed, we want to start loading that page again. A non-zero
|
// we crashed, we want to start loading that page again. A non-zero
|
||||||
// userTypedClear value means that the load had started.
|
// userTypedClear value means that the load had started.
|
||||||
let activeIndex = tabData.index - 1;
|
|
||||||
if (activeIndex > 0) {
|
|
||||||
// Go to the right history entry, but don't load anything yet.
|
|
||||||
history.getEntryAtIndex(activeIndex, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load userTypedValue and fix up the URL if it's partial/broken.
|
// Load userTypedValue and fix up the URL if it's partial/broken.
|
||||||
webNavigation.loadURI(tabData.userTypedValue,
|
webNavigation.loadURI(tabData.userTypedValue,
|
||||||
Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP,
|
Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP,
|
||||||
@ -231,7 +220,6 @@ ContentRestoreInternal.prototype = {
|
|||||||
// In order to work around certain issues in session history, we need to
|
// In order to work around certain issues in session history, we need to
|
||||||
// force session history to update its internal index and call reload
|
// force session history to update its internal index and call reload
|
||||||
// instead of gotoIndex. See bug 597315.
|
// instead of gotoIndex. See bug 597315.
|
||||||
history.getEntryAtIndex(activeIndex, true);
|
|
||||||
history.reloadCurrentEntry();
|
history.reloadCurrentEntry();
|
||||||
} else {
|
} else {
|
||||||
// If there's nothing to restore, we should still blank the page.
|
// If there's nothing to restore, we should still blank the page.
|
||||||
|
@ -265,6 +265,12 @@ let SessionHistoryInternal = {
|
|||||||
let persist = "persist" in entry ? entry.persist : true;
|
let persist = "persist" in entry ? entry.persist : true;
|
||||||
history.addEntry(this.deserializeEntry(entry, idMap, docIdentMap), persist);
|
history.addEntry(this.deserializeEntry(entry, idMap, docIdentMap), persist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Select the right history entry.
|
||||||
|
let index = tabData.index - 1;
|
||||||
|
if (index < history.count && history.index != index) {
|
||||||
|
history.getEntryAtIndex(index, true);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,6 +94,7 @@ skip-if = buildapp == 'mulet'
|
|||||||
[browser_merge_closed_tabs.js]
|
[browser_merge_closed_tabs.js]
|
||||||
[browser_page_title.js]
|
[browser_page_title.js]
|
||||||
[browser_pageStyle.js]
|
[browser_pageStyle.js]
|
||||||
|
[browser_pending_tabs.js]
|
||||||
[browser_privatetabs.js]
|
[browser_privatetabs.js]
|
||||||
[browser_replace_load.js]
|
[browser_replace_load.js]
|
||||||
[browser_restore_redirect.js]
|
[browser_restore_redirect.js]
|
||||||
|
32
browser/components/sessionstore/test/browser_pending_tabs.js
Normal file
32
browser/components/sessionstore/test/browser_pending_tabs.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
const TAB_STATE = {
|
||||||
|
entries: [{ url: "about:mozilla" }, { url: "about:robots" }],
|
||||||
|
index: 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
add_task(function* () {
|
||||||
|
// Create a background tab.
|
||||||
|
let tab = gBrowser.addTab("about:blank");
|
||||||
|
let browser = tab.linkedBrowser;
|
||||||
|
yield promiseBrowserLoaded(browser);
|
||||||
|
|
||||||
|
// The tab shouldn't be restored right away.
|
||||||
|
Services.prefs.setBoolPref("browser.sessionstore.restore_on_demand", true);
|
||||||
|
|
||||||
|
// Prepare the tab state.
|
||||||
|
let promise = promiseTabRestoring(tab);
|
||||||
|
ss.setTabState(tab, JSON.stringify(TAB_STATE));
|
||||||
|
ok(tab.hasAttribute("pending"), "tab is pending");
|
||||||
|
yield promise;
|
||||||
|
|
||||||
|
// Flush to ensure the parent has all data.
|
||||||
|
yield TabStateFlusher.flush(browser);
|
||||||
|
|
||||||
|
// Check that the shistory index is the one we restored.
|
||||||
|
let tabState = TabState.collect(tab);
|
||||||
|
is(tabState.index, TAB_STATE.index, "correct shistory index");
|
||||||
|
|
||||||
|
// Cleanup.
|
||||||
|
gBrowser.removeTab(tab);
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user