Bug 1434768 - Part 3: Rewrite JS consumers of .sessionHistory, r=bz

This commit is contained in:
Nika Layzell 2018-02-01 17:17:00 -05:00
parent 8822e43271
commit 4464c02334
39 changed files with 76 additions and 71 deletions

View File

@ -64,6 +64,7 @@ addMessageListener("Browser:HideSessionRestoreButton", function(message) {
});
// XXX(nika): Should we try to call this in the parent process instead?
addMessageListener("Browser:Reload", function(message) {
/* First, we'll try to use the session history object to reload so
* that framesets are handled properly. If we're in a special
@ -73,9 +74,9 @@ addMessageListener("Browser:Reload", function(message) {
let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
try {
let sh = webNav.sessionHistory;
if (sh)
webNav = sh.QueryInterface(Ci.nsIWebNavigation);
if (webNav.sessionHistory) {
webNav = webNav.sessionHistory;
}
} catch (e) {
}

View File

@ -19,7 +19,7 @@ function get_remote_history(browser) {
};
for (let i = 0; i < sessionHistory.count; i++) {
let entry = sessionHistory.getEntryAtIndex(i, false);
let entry = sessionHistory.legacySHistory.getEntryAtIndex(i, false);
result.entries.push({
uri: entry.URI.spec,
title: entry.title

View File

@ -93,6 +93,5 @@ function PanelBrowserStop() {
function PanelBrowserReload() {
getPanelBrowser().webNavigation
.sessionHistory
.QueryInterface(Ci.nsIWebNavigation)
.reload(Ci.nsIWebNavigation.LOAD_FLAGS_NONE);
}

View File

@ -164,7 +164,7 @@ ContentRestoreInternal.prototype = {
this.restoreTabContent(null, false, callbacks.onLoadFinished);
});
webNavigation.sessionHistory.addSHistoryListener(listener);
webNavigation.sessionHistory.legacySHistory.addSHistoryListener(listener);
this._historyListener = listener;
// Make sure to reset the capabilities and attributes in case this tab gets
@ -203,7 +203,7 @@ ContentRestoreInternal.prototype = {
this._tabData = null;
let webNavigation = this.docShell.QueryInterface(Ci.nsIWebNavigation);
let history = webNavigation.sessionHistory;
let history = webNavigation.sessionHistory.legacySHistory;
// Listen for the tab to finish loading.
this.restoreTabContentStarted(finishCallback);
@ -365,7 +365,7 @@ ContentRestoreInternal.prototype = {
*/
function HistoryListener(docShell, callback) {
let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
webNavigation.sessionHistory.addSHistoryListener(this);
webNavigation.sessionHistory.legacySHistory.addSHistoryListener(this);
this.webNavigation = webNavigation;
this.callback = callback;
@ -377,7 +377,7 @@ HistoryListener.prototype = {
]),
uninstall() {
let shistory = this.webNavigation.sessionHistory;
let shistory = this.webNavigation.sessionHistory.legacySHistory;
if (shistory) {
shistory.removeSHistoryListener(this);
}

View File

@ -320,8 +320,8 @@ var SessionHistoryListener = {
// waiting to add the listener later because these notifications are cheap.
// We will likely only collect once since we are batching collection on
// a delay.
docShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory.
addSHistoryListener(this);
docShell.QueryInterface(Ci.nsIWebNavigation).
sessionHistory.legacySHistory.addSHistoryListener(this);
// Collect data if we start with a non-empty shistory.
if (!SessionHistory.isEmpty(docShell)) {
@ -342,7 +342,7 @@ var SessionHistoryListener = {
uninit() {
let sessionHistory = docShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory;
if (sessionHistory) {
sessionHistory.removeSHistoryListener(this);
sessionHistory.legacySHistory.removeSHistoryListener(this);
}
},

View File

@ -24,7 +24,7 @@ function test() {
promiseTabState(tab, tabState).then(() => {
let sessionHistory = browser.sessionHistory;
let entry = sessionHistory.getEntryAtIndex(0, false);
let entry = sessionHistory.legacySHistory.getEntryAtIndex(0, false);
entry.QueryInterface(Ci.nsISHContainer);
whenChildCount(entry, 1, function() {

View File

@ -24,14 +24,14 @@ function test() {
promiseTabState(tab, tabState).then(() => {
let sessionHistory = browser.sessionHistory;
let entry = sessionHistory.getEntryAtIndex(0, false);
let entry = sessionHistory.legacySHistory.getEntryAtIndex(0, false);
entry.QueryInterface(Ci.nsISHContainer);
whenChildCount(entry, 1, function() {
whenChildCount(entry, 2, function() {
promiseBrowserLoaded(browser).then(() => {
let newSessionHistory = browser.sessionHistory;
let newEntry = newSessionHistory.getEntryAtIndex(0, false);
let newEntry = newSessionHistory.legacySHistory.getEntryAtIndex(0, false);
whenChildCount(newEntry, 0, function() {
// Make sure that we reset the state.

View File

@ -35,7 +35,7 @@ function restoreClosedTabWithValue(rval) {
function promiseNewLocationAndHistoryEntryReplaced(browser, snippet) {
return ContentTask.spawn(browser, snippet, async function(codeSnippet) {
let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
let shistory = webNavigation.sessionHistory;
let shistory = webNavigation.sessionHistory.legacySHistory;
// Evaluate the snippet that the changes the location.
// eslint-disable-next-line no-eval
@ -70,7 +70,7 @@ function promiseHistoryEntryReplacedNonRemote(browser) {
let {listeners} = promiseHistoryEntryReplacedNonRemote;
return new Promise(resolve => {
let shistory = browser.webNavigation.sessionHistory;
let shistory = browser.webNavigation.sessionHistory.legacySHistory;
let listener = {
OnHistoryReplaceEntry() {

View File

@ -109,7 +109,7 @@ add_task(async function test_remove_uninteresting_window() {
docShell.setCurrentURI(Services.io.newURI("about:blank"));
let {sessionHistory} = docShell.QueryInterface(Ci.nsIWebNavigation);
sessionHistory.PurgeHistory(sessionHistory.count);
sessionHistory.legacySHistory.PurgeHistory(sessionHistory.count);
});
// Once this windowClosed Promise resolves, we should have finished

View File

@ -8,7 +8,7 @@ add_task(async function duplicateTab() {
let docshell = content.window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
let shEntry = docshell.sessionHistory.getEntryAtIndex(0, false);
let shEntry = docshell.sessionHistory.legacySHistory.getEntryAtIndex(0, false);
is(shEntry.docshellID.toString(), docshell.historyID.toString());
});
@ -19,7 +19,7 @@ add_task(async function duplicateTab() {
let docshell = content.window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
let shEntry = docshell.sessionHistory.getEntryAtIndex(0, false);
let shEntry = docshell.sessionHistory.legacySHistory.getEntryAtIndex(0, false);
is(shEntry.docshellID.toString(), docshell.historyID.toString());
});
@ -39,7 +39,7 @@ add_task(async function contentToChromeNavigate() {
.QueryInterface(Ci.nsIDocShell);
let sh = docshell.sessionHistory;
is(sh.count, 1);
is(sh.getEntryAtIndex(0, false).docshellID.toString(), docshell.historyID.toString());
is(sh.legacySHistory.getEntryAtIndex(0, false).docshellID.toString(), docshell.historyID.toString());
});
// Force the browser to navigate to the chrome process.
@ -58,8 +58,8 @@ add_task(async function contentToChromeNavigate() {
let sh = docShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory;
is(sh.count, 2);
is(sh.getEntryAtIndex(0, false).docshellID.toString(), docShell.historyID.toString());
is(sh.getEntryAtIndex(1, false).docshellID.toString(), docShell.historyID.toString());
is(sh.legacySHistory.getEntryAtIndex(0, false).docshellID.toString(), docShell.historyID.toString());
is(sh.legacySHistory.getEntryAtIndex(1, false).docshellID.toString(), docShell.historyID.toString());
BrowserTestUtils.removeTab(tab);
});

View File

@ -15,7 +15,7 @@ const TAB_STATE = {
function checkTabContents(browser) {
return ContentTask.spawn(browser, null, async function() {
let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
let history = webNavigation.sessionHistory.QueryInterface(Ci.nsISHistoryInternal);
let history = webNavigation.sessionHistory;
Assert.ok(history && history.count == 1 && content.document.documentURI == "about:mozilla",
"expected tab contents found");
});

View File

@ -42,7 +42,7 @@ var testSwitchToTab = async function(url, options) {
// Check that we didn't lose any history entries.
await ContentTask.spawn(browser, null, async function() {
let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
let history = webNavigation.sessionHistory.QueryInterface(Ci.nsISHistoryInternal);
let history = webNavigation.sessionHistory;
Assert.equal(history && history.count, 3, "three history entries");
});

View File

@ -5,7 +5,7 @@ const URL = "http://example.com/browser_switch_remoteness_";
function countHistoryEntries(browser, expected) {
return ContentTask.spawn(browser, { expected }, async function(args) {
let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
let history = webNavigation.sessionHistory.QueryInterface(Ci.nsISHistoryInternal);
let history = webNavigation.sessionHistory;
Assert.equal(history && history.count, args.expected,
"correct number of shistory entries");
});

View File

@ -54,7 +54,7 @@ var historyListener = {
var {sessionHistory} = docShell.QueryInterface(Ci.nsIWebNavigation);
if (sessionHistory) {
sessionHistory.addSHistoryListener(historyListener);
sessionHistory.legacySHistory.addSHistoryListener(historyListener);
}
/**

View File

@ -14,11 +14,11 @@ add_task(async function runTests() {
ok(browser.canGoBack, "we can go back");
await whenPageShown(browser, () => browser.goBack());
await checkListeners("goback", "back to the first shentry");
await checkListeners("gotoindex", "back to the first shentry");
ok(browser.canGoForward, "we can go forward");
await whenPageShown(browser, () => browser.goForward());
await checkListeners("goforward", "forward to the second shentry");
await checkListeners("gotoindex", "forward to the second shentry");
await whenPageShown(browser, () => browser.reload());
await checkListeners("reload", "current shentry reloaded");

View File

@ -23,7 +23,7 @@ add_task(async function test() {
.getInterface(Ci.nsIWebNavigation)
.sessionHistory;
is(shistory.getEntryAtIndex(shistory.index, false).title,
is(shistory.legacySHistory.getEntryAtIndex(shistory.index, false).title,
oldTitle, 'SHEntry title after pushstate.');
});
});

View File

@ -30,7 +30,7 @@ add_task(async function test() {
testDone.resolve();
}, true);
history.removeSHistoryListener(listener);
history.legacySHistory.removeSHistoryListener(listener);
delete content._testListener;
content.setTimeout(() => { content.location.reload(); }, 0);
}
@ -55,7 +55,7 @@ add_task(async function test() {
Ci.nsISupportsWeakReference])
};
history.addSHistoryListener(listener);
history.legacySHistory.addSHistoryListener(listener);
// Since listener implements nsISupportsWeakReference, we are
// responsible for keeping it alive so that the GC doesn't clear
// it before the test completes. We do this by anchoring the listener

View File

@ -50,13 +50,13 @@ let testAPI = {
init() {
this.shistory = docShell.QueryInterface(Ci.nsIWebNavigation).sessionHistory;
for (let listener of this.listeners) {
this.shistory.addSHistoryListener(listener);
this.shistory.legacySHistory.addSHistoryListener(listener);
}
},
cleanup() {
for (let listener of this.listeners) {
this.shistory.removeSHistoryListener(listener);
this.shistory.legacySHistory.removeSHistoryListener(listener);
}
this.shistory = null;
sendAsyncMessage("bug422543:cleanup:return", {});
@ -76,7 +76,7 @@ let testAPI = {
},
notifyReload() {
let internal = this.shistory.QueryInterface(Ci.nsISHistoryInternal);
let internal = this.shistory.legacySHistory.QueryInterface(Ci.nsISHistoryInternal);
let rval =
internal.notifyOnHistoryReload(content.document.documentURIObject, 0);
sendAsyncMessage("bug422543:notifyReload:return", { rval });

View File

@ -35,7 +35,7 @@
// Work around bug 467960
var history = gBrowser.webNavigation.sessionHistory;
history.PurgeHistory(history.count);
history.legacySHistory.PurgeHistory(history.count);
window.close();
window.opener.wrappedJSObject.SimpleTest.finish();

View File

@ -34,7 +34,7 @@
gBrowser.removeEventListener("pageshow", eventListener, true);
// Work around bug 467960
var history = gBrowser.webNavigation.sessionHistory;
history.PurgeHistory(history.count);
history.legacySHistory.PurgeHistory(history.count);
window.close();
window.opener.wrappedJSObject.SimpleTest.finish();

View File

@ -59,7 +59,7 @@
var history = gBrowser.webNavigation.sessionHistory;
if (history.count == gExpected.length) {
for (var i=0; i<history.count; i++) {
var shEntry = history.getEntryAtIndex(i,false).
var shEntry = history.legacySHistory.getEntryAtIndex(i,false).
QueryInterface(Ci.nsISHEntry);
is(!!shEntry.contentViewer, gExpected[i], "content viewer "+i+", test "+gTestCount);
}
@ -71,9 +71,9 @@
if (j == i)
continue;
let shentry1 = history.getEntryAtIndex(i, false)
let shentry1 = history.legacySHistory.getEntryAtIndex(i, false)
.QueryInterface(Ci.nsISHEntry);
let shentry2 = history.getEntryAtIndex(j, false)
let shentry2 = history.legacySHistory.getEntryAtIndex(j, false)
.QueryInterface(Ci.nsISHEntry);
ok(!shentry1.sharesDocumentWith(shentry2),
'Test ' + gTestCount + ': shentry[' + i + "] shouldn't " +

View File

@ -35,7 +35,7 @@
// Work around bug 467960
var history = gBrowser.webNavigation.sessionHistory;
history.PurgeHistory(history.count);
history.legacySHistory.PurgeHistory(history.count);
window.close();
window.opener.wrappedJSObject.SimpleTest.finish();

View File

@ -341,7 +341,7 @@ function pageEventListener(event) {
function finish() {
// Work around bug 467960.
var history = TestWindow.getBrowser().webNavigation.sessionHistory;
history.PurgeHistory(history.count);
history.legacySHistory.PurgeHistory(history.count);
// If the test changed the value of max_total_viewers via a call to
// enableBFCache(), then restore it now.

View File

@ -40,7 +40,7 @@
opener.is(shistory.index, 0, 'check history index');
opener.ok(webNav.canGoForward, 'check canGoForward');
window.history.forward();
opener.is(shistory.requestedIndex, 1, 'check requestedIndex');
opener.is(shistory.legacySHistory.requestedIndex, 1, 'check requestedIndex');
},
function() {
opener.is(shistory.count, 2, 'check history length');

View File

@ -17,7 +17,7 @@
opener.info("file_bug1300461_back.html");
opener.is(shistory.count, 2, 'check history length');
opener.is(shistory.index, 1, 'check history index');
opener.is(shistory.requestedIndex, -1, 'check requestedIndex');
opener.is(shistory.legacySHistory.requestedIndex, -1, 'check requestedIndex');
opener.ok(webNav.canGoBack, 'check canGoBack');
if (opener.testCount == 1) {
opener.info('replaceState to redirect.html');

View File

@ -12,7 +12,7 @@
.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
.getInterface(SpecialPowers.Ci.nsIWebNavigation)
.sessionHistory;
let shPrivate = shistory.QueryInterface(SpecialPowers.Ci.nsISHistoryInternal);
let shPrivate = shistory.legacySHistory.QueryInterface(SpecialPowers.Ci.nsISHistoryInternal);
shPrivate.evictAllContentViewers();
history.back();
}

View File

@ -49,7 +49,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1375833
ok(newFrameDocShellId, "sanity check for docshell ID");
is(newFrameDocShellId, frameDocShellId, "check docshell ID remains after reload");
let entry = shistory.getEntryAtIndex(shistory.index, false);
let entry = shistory.legacySHistory.getEntryAtIndex(shistory.index, false);
let frameEntry = SpecialPowers.wrap(entry)
.QueryInterface(SpecialPowers.Ci.nsISHContainer)
.GetChildAt(0);

View File

@ -75,8 +75,8 @@ function* runTest() {
.getInterface(SpecialPowers.Ci.nsIWebNavigation)
.sessionHistory;
// Get the title of the inner popup's current SHEntry
var sheTitle = sh.getEntryAtIndex(sh.index, false).title;
// Get the title of the inner popup's current SHEntry
var sheTitle = sh.legacySHistory.getEntryAtIndex(sh.index, false).title;
is(sheTitle, "Changed", "SHEntry's title should change when we change.");
popup.close();

View File

@ -106,10 +106,10 @@ function dumpSHistory(theWindow)
dump(" count: " + sh.count + "\n");
dump(" index: " + sh.index + "\n");
dump(" requestedIndex: " + sh.requestedIndex + "\n");
dump(" requestedIndex: " + sh.legacySHistory.requestedIndex + "\n");
for (let i = 0; i < sh.count; i++) {
let shentry = sh.getEntryAtIndex(i, false);
let shentry = sh.legacySHistory.getEntryAtIndex(i, false);
dump(" " + i + ": " + shentry.URI.spec + '\n');
shentry.QueryInterface(SpecialPowers.Ci.nsISHContainer);
for (let j = 0; j < shentry.childCount; j++) {

View File

@ -139,7 +139,9 @@ BrowserElementChild.prototype = {
let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
if (!webNavigation.sessionHistory) {
// XXX(nika): We might need to start this up some other way?
// XXX(nika): I don't think this code should ever be hit? We should run
// TabChild::Init before we run this code which will perform this setup
// for us.
docShell.initSessionHistory();
}
@ -919,7 +921,7 @@ BrowserElementChild.prototype = {
try {
if (history && history.count) {
history.PurgeHistory(history.count);
history.legacySHistory.PurgeHistory(history.count);
}
} catch(e) {}

View File

@ -43,7 +43,7 @@ function getPopupURL() {
.getInterface(Ci.nsIWebNavigation)
.sessionHistory;
return sh.getEntryAtIndex(sh.index, false).URI.spec;
return sh.legacySHistory.getEntryAtIndex(sh.index, false).URI.spec;
}
var wyciwygURL;

View File

@ -177,7 +177,7 @@ function getSHTitle(sh, offset)
offset = 0;
// False instructs the SHistory not to modify its current index.
return sh.getEntryAtIndex(sh.index + offset, false).title;
return sh.legacySHistory.getEntryAtIndex(sh.index + offset, false).title;
}
// Tests that win's location ends with str

View File

@ -1884,7 +1884,7 @@ var BrowserApp = {
try {
let sh = webNav.sessionHistory;
if (sh)
webNav = sh.QueryInterface(Ci.nsIWebNavigation);
webNav = sh.legacySHistory.QueryInterface(Ci.nsIWebNavigation);
} catch (e) {}
webNav.reload(flags);
break;
@ -2240,7 +2240,7 @@ var BrowserApp = {
}
let browser = this.selectedBrowser;
let hist = browser.sessionHistory;
let hist = browser.sessionHistory.legacySHistory;
for (let i = toIndex; i >= fromIndex; i--) {
let entry = hist.getEntryAtIndex(i, false);
let item = {
@ -3718,7 +3718,7 @@ Tab.prototype = {
this.filter = Cc["@mozilla.org/appshell/component/browser-status-filter;1"].createInstance(Ci.nsIWebProgress);
this.filter.addProgressListener(this, flags)
this.browser.addProgressListener(this.filter, flags);
this.browser.sessionHistory.addSHistoryListener(this);
this.browser.sessionHistory.legacySHistory.addSHistoryListener(this);
this.browser.addEventListener("DOMContentLoaded", this, true);
this.browser.addEventListener("DOMFormHasPassword", this, true);
@ -3842,7 +3842,7 @@ Tab.prototype = {
this.browser.removeProgressListener(this.filter);
this.filter.removeProgressListener(this);
this.filter = null;
this.browser.sessionHistory.removeSHistoryListener(this);
this.browser.sessionHistory.legacySHistory.removeSHistoryListener(this);
this.browser.removeEventListener("DOMContentLoaded", this, true);
this.browser.removeEventListener("DOMFormHasPassword", this, true);

View File

@ -22,7 +22,7 @@ class TestNavBar(PuppeteerMixin, MarionetteTestCase):
# TODO: check why self.puppeteer.places.remove_all_history() does not work here
self.marionette.execute_script("""
let count = gBrowser.sessionHistory.count;
gBrowser.sessionHistory.PurgeHistory(count);
gBrowser.sessionHistory.legacySHistory.PurgeHistory(count);
""")
def test_elements(self):

View File

@ -102,7 +102,7 @@ var ReaderMode = {
let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
let sh = webNav.sessionHistory;
if (webNav.canGoForward) {
let forwardEntry = sh.getEntryAtIndex(sh.index + 1, false);
let forwardEntry = sh.legacySHistory.getEntryAtIndex(sh.index + 1, false);
let forwardURL = forwardEntry.URI.spec;
if (forwardURL && (forwardURL == readerURL || !readerURL)) {
webNav.goForward();
@ -123,7 +123,7 @@ var ReaderMode = {
let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
let sh = webNav.sessionHistory;
if (webNav.canGoBack) {
let prevEntry = sh.getEntryAtIndex(sh.index - 1, false);
let prevEntry = sh.legacySHistory.getEntryAtIndex(sh.index - 1, false);
let prevURL = prevEntry.URI.spec;
if (prevURL && (prevURL == originalURL || !originalURL)) {
webNav.goBack();

View File

@ -270,6 +270,7 @@ var ViewSourceContent = {
shEntry.cacheKey = shEntrySource.cacheKey;
docShell.QueryInterface(Ci.nsIWebNavigation)
.sessionHistory
.legacySHistory
.QueryInterface(Ci.nsISHistoryInternal)
.addEntry(shEntry, true);
},

View File

@ -1277,10 +1277,11 @@ addMessageListener("Browser:PurgeSessionHistory", function BrowserPurgeHistory()
// place the entry at current index at the end of the history list, so it won't get removed
if (sessionHistory.index < sessionHistory.count - 1) {
let indexEntry = sessionHistory.getEntryAtIndex(sessionHistory.index, false);
sessionHistory.QueryInterface(Ci.nsISHistoryInternal);
let legacy = sessionHistory.legacySHistory;
legacy.QueryInterface(Ci.nsISHistoryInternal);
let indexEntry = legacy.getEntryAtIndex(sessionHistory.index, false);
indexEntry.QueryInterface(Ci.nsISHEntry);
sessionHistory.addEntry(indexEntry, true);
legacy.addEntry(indexEntry, true);
}
let purge = sessionHistory.count;
@ -1289,7 +1290,7 @@ addMessageListener("Browser:PurgeSessionHistory", function BrowserPurgeHistory()
}
if (purge > 0) {
sessionHistory.PurgeHistory(purge);
sessionHistory.legacySHistory.PurgeHistory(purge);
}
});

View File

@ -224,9 +224,9 @@ var E10SUtils = {
// Allow history load if loaded in this process before.
let webNav = aDocShell.QueryInterface(Ci.nsIWebNavigation);
let sessionHistory = webNav.sessionHistory;
let requestedIndex = sessionHistory.requestedIndex;
let requestedIndex = sessionHistory.legacySHistory.requestedIndex;
if (requestedIndex >= 0) {
if (sessionHistory.getEntryAtIndex(requestedIndex, false).loadedInThisProcess) {
if (sessionHistory.legacySHistory.getEntryAtIndex(requestedIndex, false).loadedInThisProcess) {
return true;
}
@ -265,7 +265,7 @@ var E10SUtils = {
: null,
reloadInFreshProcess: !!aFreshProcess,
},
historyIndex: sessionHistory.requestedIndex,
historyIndex: sessionHistory.legacySHistory.requestedIndex,
});
return false;
},

View File

@ -72,7 +72,7 @@ var SessionHistoryInternal = {
collect(docShell, aFromIdx = -1) {
let loadContext = docShell.QueryInterface(Ci.nsILoadContext);
let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
let history = webNavigation.sessionHistory.QueryInterface(Ci.nsISHistoryInternal);
let history = webNavigation.sessionHistory;
let data = {entries: [], userContextId: loadContext.originAttributes.userContextId };
// We want to keep track how many entries we *could* have collected and
@ -83,7 +83,8 @@ var SessionHistoryInternal = {
if (history && history.count > 0) {
// Loop over the transaction linked list directly so we can get the
// persist property for each transaction.
for (let txn = history.rootTransaction; txn; entryCount++, txn = txn.next) {
for (let txn = history.legacySHistory.QueryInterface(Ci.nsISHistoryInternal).rootTransaction;
txn; entryCount++, txn = txn.next) {
if (entryCount <= aFromIdx) {
skippedCount++;
continue;
@ -317,7 +318,7 @@ var SessionHistoryInternal = {
*/
restore(docShell, tabData) {
let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
let history = webNavigation.sessionHistory;
let history = webNavigation.sessionHistory.legacySHistory;
if (history.count > 0) {
history.PurgeHistory(history.count);
}