Bug 1089913 - Consult Fennec session store for zombie tabs. r=ochameau
authorJ. Ryan Stinnett <jryans@gmail.com>
Tue, 28 Oct 2014 07:09:00 -0400
changeset 212974 56849e75ceadfae8c8c20e7edbda96a203622287
parent 212973 2ffc91152d91c4eab63878ebf7aa117f0ac4e6ad
child 212975 11ac1ea74328ad5a245bef8054b014cd39696fb2
push id51106
push userryanvm@gmail.com
push dateWed, 29 Oct 2014 20:52:00 +0000
treeherdermozilla-inbound@8512443e6e4f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1089913
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1089913 - Consult Fennec session store for zombie tabs. r=ochameau
toolkit/devtools/server/actors/webbrowser.js
--- a/toolkit/devtools/server/actors/webbrowser.js
+++ b/toolkit/devtools/server/actors/webbrowser.js
@@ -1576,32 +1576,57 @@ Object.defineProperty(BrowserTabActor.pr
     return null;
   },
   enumerable: true,
   configurable: true
 });
 
 Object.defineProperty(BrowserTabActor.prototype, "title", {
   get: function() {
+    // On Fennec, we can check the session store data for zombie tabs
+    if (this._browser.__SS_restore) {
+      let sessionStore = this._browser.__SS_data;
+      // Get the last selected entry
+      let entry = sessionStore.entries[sessionStore.index - 1];
+      return entry.title;
+    }
     let title = this.contentDocument.title || this._browser.contentTitle;
     // If contentTitle is empty (e.g. on a not-yet-restored tab), but there is a
     // tabbrowser (i.e. desktop Firefox, but not Fennec), we can use the label
     // as the title.
     if (!title && this._tabbrowser) {
       let tab = this._tabbrowser._getTabForContentWindow(this.window);
       if (tab) {
         title = tab.label;
       }
     }
     return title;
   },
   enumerable: true,
   configurable: false
 });
 
+Object.defineProperty(BrowserTabActor.prototype, "url", {
+  get: function() {
+    // On Fennec, we can check the session store data for zombie tabs
+    if (this._browser.__SS_restore) {
+      let sessionStore = this._browser.__SS_data;
+      // Get the last selected entry
+      let entry = sessionStore.entries[sessionStore.index - 1];
+      return entry.url;
+    }
+    if (this.webNavigation.currentURI) {
+      return this.webNavigation.currentURI.spec;
+    }
+    return null;
+  },
+  enumerable: true,
+  configurable: true
+});
+
 Object.defineProperty(BrowserTabActor.prototype, "browser", {
   get: function() {
     return this._browser;
   },
   enumerable: true,
   configurable: false
 });