Bug 1340875 - Send the URL and title of the history entry that was actually open when the tab was closed. r?sebastian draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Sun, 19 Feb 2017 15:05:39 +0100
changeset 486727 6c09f5f46d663fd5b873b825cac9274c3ed9c57c
parent 486170 7020030ddeb1c79d164a0042dc6f270c30bd69e7
child 546305 5560209b2faa7fe650cd4e270418e762a05603e4
push id46046
push usermozilla@buttercookie.de
push dateSun, 19 Feb 2017 14:26:18 +0000
reviewerssebastian
bugs1340875
milestone54.0a1
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
mobile/android/components/SessionStore.js
--- 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