Bug 910646 - Collect docShell capabilities from content script (r=ttaubert)

This commit is contained in:
Bill McCloskey 2013-09-27 17:58:53 -07:00
parent 8ec1eced95
commit 11d21760e3
2 changed files with 26 additions and 7 deletions

View File

@ -10,6 +10,8 @@ function debug(msg) {
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
XPCOMUtils.defineLazyModuleGetter(this, "DocShellCapabilities",
"resource:///modules/sessionstore/DocShellCapabilities.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "SessionHistory",
"resource:///modules/sessionstore/SessionHistory.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "SessionStorage",
@ -70,7 +72,8 @@ let MessageListener = {
MESSAGES: [
"SessionStore:collectSessionHistory",
"SessionStore:collectSessionStorage"
"SessionStore:collectSessionStorage",
"SessionStore:collectDocShellCapabilities"
],
init: function () {
@ -87,6 +90,10 @@ let MessageListener = {
let storage = SessionStorage.serialize(docShell);
sendAsyncMessage(name, {id: id, data: storage});
break;
case "SessionStore:collectDocShellCapabilities":
let disallow = DocShellCapabilities.collect(docShell);
sendAsyncMessage(name, {id: id, data: disallow});
break;
default:
debug("received unknown message '" + name + "'");
break;

View File

@ -4336,8 +4336,13 @@ let TabState = {
// Collected session storage data asynchronously.
let storage = yield Messenger.send(tab, "SessionStore:collectSessionStorage");
// Collect docShell capabilities asynchronously.
let disallow = yield Messenger.send(tab, "SessionStore:collectDocShellCapabilities");
// Collect basic tab data, without session history and storage.
let options = {omitSessionHistory: true, omitSessionStorage: true};
let options = {omitSessionHistory: true,
omitSessionStorage: true,
omitDocShellCapabilities: true};
let tabData = new TabData(this._collectBaseTabData(tab, options));
// Apply collected data.
@ -4348,6 +4353,10 @@ let TabState = {
tabData.storage = storage;
}
if (disallow.length > 0) {
tabData.disallow = disallow.join(",");
}
// Save text and scroll data.
this._updateTextAndScrollDataForTab(tab, tabData);
@ -4431,6 +4440,7 @@ let TabState = {
* storage data collection methods.
* {omitSessionHistory: true} to skip collecting session history data
* {omitSessionStorage: true} to skip collecting session storage data
* {omitDocShellCapabilities: true} to skip collecting docShell allow* attributes
*
* The omit* options have been introduced to enable us collecting
* those parts of the tab data asynchronously. We will request basic
@ -4488,11 +4498,13 @@ let TabState = {
delete tabData.pinned;
tabData.hidden = tab.hidden;
if (!options || !options.omitDocShellCapabilities) {
let disallow = DocShellCapabilities.collect(browser.docShell);
if (disallow.length > 0)
tabData.disallow = disallow.join(",");
else if (tabData.disallow)
delete tabData.disallow;
}
// Save tab attributes.
tabData.attributes = TabAttributes.get(tab);