mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-16 07:33:35 +03:00
0c4bed191f
Internal commit reference:
e994525a6d
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
"use strict";
|
|
|
|
const { TargetRegistry } = ChromeUtils.import('chrome://juggler/content/TargetRegistry.js');
|
|
const { Helper } = ChromeUtils.import('chrome://juggler/content/Helper.js');
|
|
|
|
const helper = new Helper();
|
|
|
|
var EXPORTED_SYMBOLS = ['JugglerFrameParent'];
|
|
|
|
class JugglerFrameParent extends JSWindowActorParent {
|
|
constructor() {
|
|
super();
|
|
}
|
|
|
|
receiveMessage() { }
|
|
|
|
async actorCreated() {
|
|
// Actors are registered per the WindowGlobalParent / WindowGlobalChild pair. We are only
|
|
// interested in those WindowGlobalParent actors that are matching current browsingContext
|
|
// window global.
|
|
// See https://github.com/mozilla/gecko-dev/blob/cd2121e7d83af1b421c95e8c923db70e692dab5f/testing/mochitest/BrowserTestUtils/BrowserTestUtilsParent.sys.mjs#L15
|
|
if (!this.manager?.isCurrentGlobal)
|
|
return;
|
|
|
|
// Only interested in main frames for now.
|
|
if (this.browsingContext.parent)
|
|
return;
|
|
|
|
this._target = TargetRegistry.instance()?.targetForBrowserId(this.browsingContext.browserId);
|
|
if (!this._target)
|
|
return;
|
|
|
|
this.actorName = `browser::page[${this._target.id()}]/${this.browsingContext.browserId}/${this.browsingContext.id}/${this._target.nextActorSequenceNumber()}`;
|
|
this._target.setActor(this);
|
|
}
|
|
|
|
didDestroy() {
|
|
if (!this._target)
|
|
return;
|
|
this._target.removeActor(this);
|
|
}
|
|
}
|