Bug 909048 - Collect text and scroll data from content script (r=ttaubert)

This commit is contained in:
Bill McCloskey 2013-10-18 10:09:25 -07:00
parent 0a18fb29f4
commit 29c96a73fb
2 changed files with 12 additions and 4 deletions

View File

@ -20,6 +20,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "SessionHistory",
"resource:///modules/sessionstore/SessionHistory.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "SessionStorage",
"resource:///modules/sessionstore/SessionStorage.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TextAndScrollData",
"resource:///modules/sessionstore/TextAndScrollData.jsm");
/**
* Listens for and handles content events that we need for the
@ -89,6 +91,14 @@ let MessageListener = {
switch (name) {
case "SessionStore:collectSessionHistory":
let history = SessionHistory.read(docShell);
if ("index" in history) {
let tabIndex = history.index - 1;
// Don't include private data. It's only needed when duplicating
// tabs, which collects data synchronously.
TextAndScrollData.updateFrame(history.entries[tabIndex],
content,
docShell.isAppTab);
}
sendAsyncMessage(name, {id: id, data: history});
break;
case "SessionStore:collectSessionStorage":

View File

@ -4216,7 +4216,8 @@ let TabState = {
}
let promise = Task.spawn(function task() {
// Collected session history data asynchronously.
// Collect session history data asynchronously. Also collects
// text and scroll data.
let history = yield Messenger.send(tab, "SessionStore:collectSessionHistory");
// Collected session storage data asynchronously.
@ -4251,9 +4252,6 @@ let TabState = {
tabData.pageStyle = pageStyle;
}
// Save text and scroll data.
this._updateTextAndScrollDataForTab(tab, tabData);
// 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
// fill the cache with the data we received.