mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: remove unnecessary constructor parameters (#8837)
This commit is contained in:
parent
202ffce0aa
commit
5fba0dc932
@ -211,18 +211,8 @@ export class Frame {
|
|||||||
updateClient(client: CDPSession): void {
|
updateClient(client: CDPSession): void {
|
||||||
this.#client = client;
|
this.#client = client;
|
||||||
this.worlds = {
|
this.worlds = {
|
||||||
[MAIN_WORLD]: new IsolatedWorld(
|
[MAIN_WORLD]: new IsolatedWorld(this),
|
||||||
client,
|
[PUPPETEER_WORLD]: new IsolatedWorld(this),
|
||||||
this._frameManager,
|
|
||||||
this,
|
|
||||||
this._frameManager.timeoutSettings
|
|
||||||
),
|
|
||||||
[PUPPETEER_WORLD]: new IsolatedWorld(
|
|
||||||
client,
|
|
||||||
this._frameManager,
|
|
||||||
this,
|
|
||||||
this._frameManager.timeoutSettings
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,10 +121,7 @@ export interface IsolatedWorldChart {
|
|||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export class IsolatedWorld {
|
export class IsolatedWorld {
|
||||||
#frameManager: FrameManager;
|
|
||||||
#client: CDPSession;
|
|
||||||
#frame: Frame;
|
#frame: Frame;
|
||||||
#timeoutSettings: TimeoutSettings;
|
|
||||||
#documentPromise: Promise<ElementHandle<Document>> | null = null;
|
#documentPromise: Promise<ElementHandle<Document>> | null = null;
|
||||||
#contextPromise: DeferredPromise<ExecutionContext> = createDeferredPromise();
|
#contextPromise: DeferredPromise<ExecutionContext> = createDeferredPromise();
|
||||||
#detached = false;
|
#detached = false;
|
||||||
@ -148,21 +145,25 @@ export class IsolatedWorld {
|
|||||||
return `${name}_${contextId}`;
|
return `${name}_${contextId}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(
|
constructor(frame: Frame) {
|
||||||
client: CDPSession,
|
|
||||||
frameManager: FrameManager,
|
|
||||||
frame: Frame,
|
|
||||||
timeoutSettings: TimeoutSettings
|
|
||||||
) {
|
|
||||||
// Keep own reference to client because it might differ from the FrameManager's
|
// Keep own reference to client because it might differ from the FrameManager's
|
||||||
// client for OOP iframes.
|
// client for OOP iframes.
|
||||||
this.#client = client;
|
|
||||||
this.#frameManager = frameManager;
|
|
||||||
this.#frame = frame;
|
this.#frame = frame;
|
||||||
this.#timeoutSettings = timeoutSettings;
|
|
||||||
this.#client.on('Runtime.bindingCalled', this.#onBindingCalled);
|
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 {
|
frame(): Frame {
|
||||||
return this.#frame;
|
return this.#frame;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user