mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1886852 - Avoid registering unnecessary MessageManager listeners when SHIP is enabled, r=smaug, a=dsmith
Differential Revision: https://phabricator.services.mozilla.com/D205377
This commit is contained in:
parent
78e298b5f3
commit
79bc6fa50f
@ -1422,6 +1422,13 @@ var SessionStoreInternal = {
|
|||||||
* and thus enables communication with OOP tabs.
|
* and thus enables communication with OOP tabs.
|
||||||
*/
|
*/
|
||||||
receiveMessage(aMessage) {
|
receiveMessage(aMessage) {
|
||||||
|
if (Services.appinfo.sessionHistoryInParent) {
|
||||||
|
throw new Error(
|
||||||
|
`received unexpected message '${aMessage.name}' with ` +
|
||||||
|
`sessionHistoryInParent enabled`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// If we got here, that means we're dealing with a frame message
|
// If we got here, that means we're dealing with a frame message
|
||||||
// manager message, so the target will be a <xul:browser>.
|
// manager message, so the target will be a <xul:browser>.
|
||||||
var browser = aMessage.target;
|
var browser = aMessage.target;
|
||||||
@ -1600,14 +1607,14 @@ var SessionStoreInternal = {
|
|||||||
// internal data about the window.
|
// internal data about the window.
|
||||||
aWindow.__SSi = this._generateWindowID();
|
aWindow.__SSi = this._generateWindowID();
|
||||||
|
|
||||||
let mm = aWindow.getGroupMessageManager("browsers");
|
|
||||||
MESSAGES.forEach(msg => {
|
|
||||||
let listenWhenClosed = CLOSED_MESSAGES.has(msg);
|
|
||||||
mm.addMessageListener(msg, this, listenWhenClosed);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Load the frame script after registering listeners.
|
|
||||||
if (!Services.appinfo.sessionHistoryInParent) {
|
if (!Services.appinfo.sessionHistoryInParent) {
|
||||||
|
let mm = aWindow.getGroupMessageManager("browsers");
|
||||||
|
MESSAGES.forEach(msg => {
|
||||||
|
let listenWhenClosed = CLOSED_MESSAGES.has(msg);
|
||||||
|
mm.addMessageListener(msg, this, listenWhenClosed);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Load the frame script after registering listeners.
|
||||||
mm.loadFrameScript(
|
mm.loadFrameScript(
|
||||||
"chrome://browser/content/content-sessionStore.js",
|
"chrome://browser/content/content-sessionStore.js",
|
||||||
true,
|
true,
|
||||||
@ -2083,8 +2090,10 @@ var SessionStoreInternal = {
|
|||||||
// Cache the window state until it is completely gone.
|
// Cache the window state until it is completely gone.
|
||||||
DyingWindowCache.set(aWindow, winData);
|
DyingWindowCache.set(aWindow, winData);
|
||||||
|
|
||||||
let mm = aWindow.getGroupMessageManager("browsers");
|
if (!Services.appinfo.sessionHistoryInParent) {
|
||||||
MESSAGES.forEach(msg => mm.removeMessageListener(msg, this));
|
let mm = aWindow.getGroupMessageManager("browsers");
|
||||||
|
MESSAGES.forEach(msg => mm.removeMessageListener(msg, this));
|
||||||
|
}
|
||||||
|
|
||||||
this._saveableClosedWindowData.delete(winData);
|
this._saveableClosedWindowData.delete(winData);
|
||||||
delete aWindow.__SSi;
|
delete aWindow.__SSi;
|
||||||
|
Loading…
Reference in New Issue
Block a user