Fixed bug in tab encoding in Firefox.
authorjonathandicarlo@jonathan-dicarlos-macbook-pro.local
Tue, 10 Feb 2009 22:15:25 -0800
changeset 45241 d35dc060d4bd2199f32ba845eaa41e885e8e3afb
parent 45240 be0e051bd478c6df4374b5e58a010a890cba84aa
child 45242 d76843f30b71cac8bcb2ed65dce9e53dbbf3def0
child 45249 2971b26fd967627808ce17cfdedb522eca659d63
push idunknown
push userunknown
push dateunknown
Fixed bug in tab encoding in Firefox.
services/sync/modules/engines/tabs.js
--- a/services/sync/modules/engines/tabs.js
+++ b/services/sync/modules/engines/tabs.js
@@ -170,24 +170,27 @@ TabStore.prototype = {
       let window = session.windows[i];
       /* For some reason, session store uses one-based array index references,
         (f.e. in the "selectedWindow" and each tab's "index" properties), so we
         convert them to and from JavaScript's zero-based indexes as needed. */
       let windowID = i + 1;
 
       for (let j = 0; j < window.tabs.length; j++) {
         let tab = window.tabs[j];
-        let title = tab.contentDocument.title.innerHtml; // will this work?
-        this._log.debug("Wrapping a tab with title " + title);
+	let currentPage = tab.entries[tab.entries.length - 1];
+	/* TODO not always accurate -- if you've hit Back in this tab, then the current
+	 * page might not be the last entry.  Deal with this later.
+	 */
+        this._log.debug("Wrapping a tab with title " + currentPage.title);
         let urlHistory = [];
         let entries = tab.entries.slice(tab.entries.length - 10);
         for (let entry in entries) {
           urlHistory.push( entry.url );
         }
-        record.addTab(title, urlHistory);
+        record.addTab(currentPage.title, urlHistory);
       }
     }
   },
 
   _addFennecTabsToRecord: function TabStore__addFennecTabs(record) {
     let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
 	       .getService(Ci.nsIWindowMediator);
     let browserWindow = wm.getMostRecentWindow("navigator:browser");