Bug 1499429 - 1. Notify child process of session transfer; r=esawin

Notify child process when we have a session transfer so the child
process can update accordingly.

Differential Revision: https://phabricator.services.mozilla.com/D8994
This commit is contained in:
Jim Chen 2018-11-06 00:12:06 -05:00
parent 6f7b03e600
commit e0b3022b2c
2 changed files with 14 additions and 8 deletions

View File

@ -28,18 +28,15 @@ class GeckoViewContentChild extends GeckoViewChildModule {
Utils: "resource://gre/modules/sessionstore/Utils.jsm",
});
this.messageManager.addMessageListener("GeckoView:SaveState",
this);
this.messageManager.addMessageListener("GeckoView:RestoreState",
this);
this.messageManager.addMessageListener("GeckoView:DOMFullscreenEntered",
this);
this.messageManager.addMessageListener("GeckoView:DOMFullscreenExited",
this);
this.messageManager.addMessageListener("GeckoView:ZoomToInput",
this);
this.messageManager.addMessageListener("GeckoView:SetActive",
this);
this.messageManager.addMessageListener("GeckoView:RestoreState", this);
this.messageManager.addMessageListener("GeckoView:SaveState", this);
this.messageManager.addMessageListener("GeckoView:SetActive", this);
this.messageManager.addMessageListener("GeckoView:UpdateInitData", this);
this.messageManager.addMessageListener("GeckoView:ZoomToInput", this);
const options = {
mozSystemGroup: true,
@ -245,6 +242,12 @@ class GeckoViewContentChild extends GeckoViewChildModule {
content.windowUtils.mediaSuspend = aMsg.data.active ? Ci.nsISuspendedTypes.NONE_SUSPENDED : Ci.nsISuspendedTypes.SUSPENDED_PAUSE;
}
break;
case "GeckoView:UpdateInitData":
// Provide a hook for native code to detect a transfer.
Services.obs.notifyObservers(
docShell, "geckoview-content-global-transferred");
break;
}
}

View File

@ -194,6 +194,9 @@ var ModuleManager = {
module.enabled = initData.modules[name];
}
}
// Notify child of the transfer.
this._browser.messageManager.sendAsyncMessage(aEvent);
break;
}