Bug 1340875 - Send the URL and title of the history entry that was actually open when the tab was closed. r?sebastian
Currently, Recently Closed is displaying the last available history entry for each closed tab instead of the history entry that was actually being shown at the time the tab was closed.
The Java session parser that is responsible for displaying the last session's tabs when not automatically restoring is already doing the correct thing and therefore doesn't need changing.
MozReview-Commit-ID: DGaD52SzdpP
--- a/mobile/android/components/SessionStore.js
+++ b/mobile/android/components/SessionStore.js
@@ -1769,21 +1769,21 @@ SessionStore.prototype = {
}
let closedTabs = this._windows[aWindow.__SSID].closedTabs;
let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(aWindow.BrowserApp.selectedBrowser);
let tabs = closedTabs
.filter(tab => tab.isPrivate == isPrivate)
.map(function (tab) {
- // Get the url and title for the last entry in the session history.
- let lastEntry = tab.entries[tab.entries.length - 1];
+ // Get the url and title for the current entry in the session history.
+ let entry = tab.entries[tab.index - 1];
return {
- url: lastEntry.url,
- title: lastEntry.title || "",
+ url: entry.url,
+ title: entry.title || "",
data: JSON.stringify(tab),
};
});
log("sending " + tabs.length + " closed tabs to Java");
EventDispatcher.instance.sendRequest({
type: "ClosedTabs:Data",
tabs: tabs