Bug 990812 - Restrict sessionstore, tabview, and browser frame scripts to tabbrowser browsers r=adw

This commit is contained in:
Tim Taubert 2014-05-23 14:22:36 +02:00
parent a8c3787586
commit e4173a1a49
6 changed files with 12 additions and 9 deletions

View File

@ -784,7 +784,8 @@ var gBrowserInit = {
gPageStyleMenu.init();
LanguageDetectionListener.init();
messageManager.loadFrameScript("chrome://browser/content/content.js", true);
let mm = window.getGroupMessageManager("browsers");
mm.loadFrameScript("chrome://browser/content/content.js", true);
// initialize observers and listeners
// and give C++ access to gBrowser

View File

@ -34,7 +34,7 @@
<xul:hbox flex="1" class="browserSidebarContainer">
<xul:vbox flex="1" class="browserContainer">
<xul:stack flex="1" class="browserStack" anonid="browserStack">
<xul:browser anonid="initialBrowser" type="content-primary" message="true"
<xul:browser anonid="initialBrowser" type="content-primary" message="true" messagemanagergroup="browsers"
xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup,selectpopup"/>
</xul:stack>
</xul:vbox>
@ -1529,6 +1529,7 @@
"browser");
b.setAttribute("type", "content-targetable");
b.setAttribute("message", "true");
b.setAttribute("messagemanagergroup", "browsers");
b.setAttribute("contextmenu", this.getAttribute("contentcontextmenu"));
b.setAttribute("tooltip", this.getAttribute("contenttooltip"));

View File

@ -764,7 +764,7 @@ let SessionStoreInternal = {
// internal data about the window.
aWindow.__SSi = this._generateWindowID();
let mm = aWindow.messageManager;
let mm = aWindow.getGroupMessageManager("browsers");
MESSAGES.forEach(msg => mm.addMessageListener(msg, this));
// Load the frame script after registering listeners.
@ -1093,7 +1093,7 @@ let SessionStoreInternal = {
// Cache the window state until it is completely gone.
DyingWindowCache.set(aWindow, winData);
let mm = aWindow.messageManager;
let mm = aWindow.getGroupMessageManager("browsers");
MESSAGES.forEach(msg => mm.removeMessageListener(msg, this));
delete aWindow.__SSi;

View File

@ -76,7 +76,8 @@ add_task(function () {
// Create a new window to attach our frame script to.
let win = yield promiseNewWindowLoaded();
win.messageManager.loadFrameScript(FRAME_SCRIPT, true);
let mm = win.getGroupMessageManager("browsers");
mm.loadFrameScript(FRAME_SCRIPT, true);
// Create a new tab in the new window that will load the frame script.
let tab = win.gBrowser.addTab("about:mozilla");

View File

@ -174,7 +174,7 @@ let UI = {
});
// ___ setup DOMWillOpenModalDialog message handler
let mm = gWindow.messageManager;
let mm = gWindow.getGroupMessageManager("browsers");
let callback = this._onDOMWillOpenModalDialog.bind(this);
mm.addMessageListener("Panorama:DOMWillOpenModalDialog", callback);
@ -235,7 +235,7 @@ let UI = {
// ___ load frame script
let frameScript = "chrome://browser/content/tabview-content.js";
gWindow.messageManager.loadFrameScript(frameScript, true);
mm.loadFrameScript(frameScript, true);
// ___ Done
this._frameInitialized = true;

View File

@ -320,9 +320,9 @@ HiddenBrowser.prototype = {
// Swap docShells.
tabbrowser.swapNewTabWithBrowser(aTab, this._browser);
// Load all default frame scripts attached to the target window.
// Load all delayed frame scripts attached to the "browers" message manager.
let mm = aTab.linkedBrowser.messageManager;
let scripts = win.messageManager.getDelayedFrameScripts();
let scripts = win.getGroupMessageManager("browsers").getDelayedFrameScripts();
Array.forEach(scripts, ([script, runGlobal]) => mm.loadFrameScript(script, true, runGlobal));
// Remove the browser, it will be recreated by a timer.