Bug 921310 - Don't collect extra data for restoring tabs (r=ttaubert)

This commit is contained in:
Bill McCloskey 2013-09-27 17:58:06 -07:00
parent 52b2bbf886
commit acded981e0

View File

@ -4336,6 +4336,14 @@ let TabState = {
return Promise.resolve(TabStateCache.get(tab)); return Promise.resolve(TabStateCache.get(tab));
} }
// If the tab hasn't been restored yet, just return the data we
// have saved for it.
let browser = tab.linkedBrowser;
if (!browser.currentURI || (browser.__SS_data && browser.__SS_tabStillLoading)) {
let tabData = new TabData(this._collectBaseTabData(tab));
return Promise.resolve(tabData);
}
let promise = Task.spawn(function task() { let promise = Task.spawn(function task() {
// Collected session history data asynchronously. // Collected session history data asynchronously.
let history = yield Messenger.send(tab, "SessionStore:collectSessionHistory"); let history = yield Messenger.send(tab, "SessionStore:collectSessionHistory");
@ -4355,8 +4363,9 @@ let TabState = {
tabData.storage = storage; tabData.storage = storage;
} }
// Put tabData into cache when reading scroll and text data succeeds. // Save text and scroll data.
if (this._updateTextAndScrollDataForTab(tab, tabData)) { this._updateTextAndScrollDataForTab(tab, tabData);
// If we're still the latest async collection for the given tab and // If we're still the latest async collection for the given tab and
// the cache hasn't been filled by collect() in the meantime, let's // the cache hasn't been filled by collect() in the meantime, let's
// fill the cache with the data we received. // fill the cache with the data we received.
@ -4364,7 +4373,6 @@ let TabState = {
TabStateCache.set(tab, tabData); TabStateCache.set(tab, tabData);
this._pendingCollections.delete(tab); this._pendingCollections.delete(tab);
} }
}
throw new Task.Result(tabData); throw new Task.Result(tabData);
}.bind(this)); }.bind(this));