Update JugglerFrameChild.jsm
Signed-off-by: Radeonares32 <56337258+Radeonares32@users.noreply.github.com>
This commit is contained in:
parent
a6b320e362
commit
6e875b51ae
|
|
@ -7,32 +7,32 @@ const Ci = Components.interfaces;
|
|||
const helper = new Helper();
|
||||
|
||||
let sameProcessInstanceNumber = 0;
|
||||
|
||||
const topBrowingContextToAgents = new Map();
|
||||
|
||||
class JugglerFrameChild extends JSWindowActorChild {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this._eventListeners = [];
|
||||
}
|
||||
|
||||
handleEvent(aEvent) {
|
||||
const agents = this._agents();
|
||||
if (!agents)
|
||||
return;
|
||||
if (aEvent.type === 'DOMWillOpenModalDialog') {
|
||||
if (!agents) return;
|
||||
|
||||
switch (aEvent.type) {
|
||||
case 'DOMWillOpenModalDialog':
|
||||
agents.channel.pause();
|
||||
return;
|
||||
}
|
||||
if (aEvent.type === 'DOMModalDialogClosed') {
|
||||
break;
|
||||
case 'DOMModalDialogClosed':
|
||||
agents.channel.resumeSoon();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (aEvent.target === this.document) {
|
||||
agents.pageAgent.onWindowEvent(aEvent);
|
||||
agents.frameTree.onWindowEvent(aEvent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_agents() {
|
||||
|
|
@ -46,13 +46,9 @@ class JugglerFrameChild extends JSWindowActorChild {
|
|||
this._agents()?.pageAgent.onWindowEvent(event);
|
||||
}));
|
||||
|
||||
if (this.document.documentURI.startsWith('moz-extension://'))
|
||||
return;
|
||||
|
||||
// Child frame events will be forwarded to related top-level agents.
|
||||
if (this.browsingContext.parent)
|
||||
return;
|
||||
if (this._isMozExtension()) return;
|
||||
|
||||
if (!this.browsingContext.parent) {
|
||||
let agents = topBrowingContextToAgents.get(this.browsingContext);
|
||||
if (!agents) {
|
||||
agents = initialize(this.browsingContext, this.docShell);
|
||||
|
|
@ -61,26 +57,27 @@ class JugglerFrameChild extends JSWindowActorChild {
|
|||
agents.channel.bindToActor(this);
|
||||
agents.actor = this;
|
||||
}
|
||||
}
|
||||
|
||||
didDestroy() {
|
||||
helper.removeListeners(this._eventListeners);
|
||||
|
||||
if (this.browsingContext.parent)
|
||||
return;
|
||||
if (this.browsingContext.parent) return;
|
||||
|
||||
const agents = topBrowingContextToAgents.get(this.browsingContext);
|
||||
// The agents are already re-bound to a new actor.
|
||||
if (agents.actor !== this)
|
||||
return;
|
||||
if (agents.actor !== this) return;
|
||||
|
||||
topBrowingContextToAgents.delete(this.browsingContext);
|
||||
|
||||
agents.channel.resetTransport();
|
||||
agents.pageAgent.dispose();
|
||||
agents.frameTree.dispose();
|
||||
}
|
||||
|
||||
receiveMessage() { }
|
||||
_isMozExtension() {
|
||||
return this.document.documentURI.startsWith('moz-extension://');
|
||||
}
|
||||
|
||||
receiveMessage() {}
|
||||
}
|
||||
|
||||
var EXPORTED_SYMBOLS = ['JugglerFrameChild'];
|
||||
|
|
|
|||
Loading…
Reference in a new issue