Bug 1533948, change BrowserTabChild to inherit from JSWindowActor, r=mconley
This commit is contained in:
@@ -599,7 +599,7 @@ class MozBrowser extends MozElements.MozElementMixin(XULFrameElement) {
|
||||
|
||||
set characterSet(val) {
|
||||
if (this.isRemoteBrowser) {
|
||||
this.messageManager.sendAsyncMessage("UpdateCharacterSet", { value: val });
|
||||
this.sendMessageToActor("UpdateCharacterSet", { value: val }, "BrowserTab");
|
||||
this._characterSet = val;
|
||||
} else {
|
||||
this.docShell.charset = val;
|
||||
@@ -1860,6 +1860,41 @@ class MozBrowser extends MozElements.MozElementMixin(XULFrameElement) {
|
||||
this.docShell.getContentBlockingLog() :
|
||||
Promise.reject("docshell isn't available");
|
||||
}
|
||||
|
||||
// Send an asynchronous message to the remote child via an actor.
|
||||
// Note: use this only for messages through an actor. For old-style
|
||||
// messages, use the message manager. If 'all' is true, then send
|
||||
// a message to all descendant processes.
|
||||
sendMessageToActor(messageName, args, actorName, all) {
|
||||
if (!this.frameLoader) {
|
||||
return;
|
||||
}
|
||||
|
||||
let windowGlobal = this.browsingContext.currentWindowGlobal;
|
||||
if (!windowGlobal) {
|
||||
// Workaround for bug 1523638 where about:blank is loaded in a tab.
|
||||
if (messageName == "Browser:AppTab") {
|
||||
setTimeout(() => { this.sendMessageToActor(messageName, args, actorName); }, 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
function sendToChildren(browsingContext, checkRoot) {
|
||||
let windowGlobal = browsingContext.currentWindowGlobal;
|
||||
if (windowGlobal && (!checkRoot || windowGlobal.isProcessRoot)) {
|
||||
windowGlobal.getActor(actorName).sendAsyncMessage(messageName, args);
|
||||
}
|
||||
|
||||
if (all) {
|
||||
let contexts = browsingContext.getChildren();
|
||||
for (let context of contexts) {
|
||||
sendToChildren(context, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sendToChildren(this.browsingContext, false);
|
||||
}
|
||||
}
|
||||
|
||||
MozXULElement.implementCustomInterface(MozBrowser, [Ci.nsIBrowser]);
|
||||
|
||||
Reference in New Issue
Block a user