chore: remove unnecessary constructor parameters (#8837)

This commit is contained in:
jrandolf 2022-08-24 17:04:54 +02:00 committed by GitHub
parent 202ffce0aa
commit 5fba0dc932
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 24 deletions

View File

@ -211,18 +211,8 @@ export class Frame {
updateClient(client: CDPSession): void {
this.#client = client;
this.worlds = {
[MAIN_WORLD]: new IsolatedWorld(
client,
this._frameManager,
this,
this._frameManager.timeoutSettings
),
[PUPPETEER_WORLD]: new IsolatedWorld(
client,
this._frameManager,
this,
this._frameManager.timeoutSettings
),
[MAIN_WORLD]: new IsolatedWorld(this),
[PUPPETEER_WORLD]: new IsolatedWorld(this),
};
}

View File

@ -121,10 +121,7 @@ export interface IsolatedWorldChart {
* @internal
*/
export class IsolatedWorld {
#frameManager: FrameManager;
#client: CDPSession;
#frame: Frame;
#timeoutSettings: TimeoutSettings;
#documentPromise: Promise<ElementHandle<Document>> | null = null;
#contextPromise: DeferredPromise<ExecutionContext> = createDeferredPromise();
#detached = false;
@ -148,21 +145,25 @@ export class IsolatedWorld {
return `${name}_${contextId}`;
};
constructor(
client: CDPSession,
frameManager: FrameManager,
frame: Frame,
timeoutSettings: TimeoutSettings
) {
constructor(frame: Frame) {
// Keep own reference to client because it might differ from the FrameManager's
// client for OOP iframes.
this.#client = client;
this.#frameManager = frameManager;
this.#frame = frame;
this.#timeoutSettings = timeoutSettings;
this.#client.on('Runtime.bindingCalled', this.#onBindingCalled);
}
get #client(): CDPSession {
return this.#frame._client();
}
get #frameManager(): FrameManager {
return this.#frame._frameManager;
}
get #timeoutSettings(): TimeoutSettings {
return this.#frameManager.timeoutSettings;
}
frame(): Frame {
return this.#frame;
}