mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: use CdpPage instead of Page in CDP frames (#11157)
This commit is contained in:
parent
9541e97c85
commit
d99f9d752b
@ -19,7 +19,7 @@ import type {Protocol} from 'devtools-protocol';
|
|||||||
import type {CDPSession} from '../api/CDPSession.js';
|
import type {CDPSession} from '../api/CDPSession.js';
|
||||||
import {Frame, FrameEvent, throwIfDetached} from '../api/Frame.js';
|
import {Frame, FrameEvent, throwIfDetached} from '../api/Frame.js';
|
||||||
import type {HTTPResponse} from '../api/HTTPResponse.js';
|
import type {HTTPResponse} from '../api/HTTPResponse.js';
|
||||||
import type {Page, WaitTimeoutOptions} from '../api/Page.js';
|
import type {WaitTimeoutOptions} from '../api/Page.js';
|
||||||
import {setPageContent} from '../common/util.js';
|
import {setPageContent} from '../common/util.js';
|
||||||
import {assert} from '../util/assert.js';
|
import {assert} from '../util/assert.js';
|
||||||
import {Deferred} from '../util/Deferred.js';
|
import {Deferred} from '../util/Deferred.js';
|
||||||
@ -37,6 +37,7 @@ import {
|
|||||||
LifecycleWatcher,
|
LifecycleWatcher,
|
||||||
type PuppeteerLifeCycleEvent,
|
type PuppeteerLifeCycleEvent,
|
||||||
} from './LifecycleWatcher.js';
|
} from './LifecycleWatcher.js';
|
||||||
|
import type {CdpPage} from './Page.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@ -112,7 +113,7 @@ export class CdpFrame extends Frame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override page(): Page {
|
override page(): CdpPage {
|
||||||
return this._frameManager.page();
|
return this._frameManager.page();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ import type {Protocol} from 'devtools-protocol';
|
|||||||
|
|
||||||
import {type CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
|
import {type CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
|
||||||
import {FrameEvent} from '../api/Frame.js';
|
import {FrameEvent} from '../api/Frame.js';
|
||||||
import type {Page} from '../api/Page.js';
|
|
||||||
import {EventEmitter, type EventType} from '../common/EventEmitter.js';
|
import {EventEmitter, type EventType} from '../common/EventEmitter.js';
|
||||||
import type {TimeoutSettings} from '../common/TimeoutSettings.js';
|
import type {TimeoutSettings} from '../common/TimeoutSettings.js';
|
||||||
import {debugError, PuppeteerURL, UTILITY_WORLD_NAME} from '../common/util.js';
|
import {debugError, PuppeteerURL, UTILITY_WORLD_NAME} from '../common/util.js';
|
||||||
@ -36,6 +35,7 @@ import {FrameTree} from './FrameTree.js';
|
|||||||
import type {IsolatedWorld} from './IsolatedWorld.js';
|
import type {IsolatedWorld} from './IsolatedWorld.js';
|
||||||
import {MAIN_WORLD, PUPPETEER_WORLD} from './IsolatedWorlds.js';
|
import {MAIN_WORLD, PUPPETEER_WORLD} from './IsolatedWorlds.js';
|
||||||
import {NetworkManager} from './NetworkManager.js';
|
import {NetworkManager} from './NetworkManager.js';
|
||||||
|
import type {CdpPage} from './Page.js';
|
||||||
import type {CdpTarget} from './Target.js';
|
import type {CdpTarget} from './Target.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,7 +77,7 @@ const TIME_FOR_WAITING_FOR_SWAP = 100; // ms.
|
|||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export class FrameManager extends EventEmitter<FrameManagerEvents> {
|
export class FrameManager extends EventEmitter<FrameManagerEvents> {
|
||||||
#page: Page;
|
#page: CdpPage;
|
||||||
#networkManager: NetworkManager;
|
#networkManager: NetworkManager;
|
||||||
#timeoutSettings: TimeoutSettings;
|
#timeoutSettings: TimeoutSettings;
|
||||||
#contextIdToContext = new Map<string, ExecutionContext>();
|
#contextIdToContext = new Map<string, ExecutionContext>();
|
||||||
@ -114,7 +114,7 @@ export class FrameManager extends EventEmitter<FrameManagerEvents> {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
client: CDPSession,
|
client: CDPSession,
|
||||||
page: Page,
|
page: CdpPage,
|
||||||
ignoreHTTPSErrors: boolean,
|
ignoreHTTPSErrors: boolean,
|
||||||
timeoutSettings: TimeoutSettings
|
timeoutSettings: TimeoutSettings
|
||||||
) {
|
) {
|
||||||
@ -291,7 +291,7 @@ export class FrameManager extends EventEmitter<FrameManagerEvents> {
|
|||||||
return this.#contextIdToContext.get(`${session.id()}:${contextId}`);
|
return this.#contextIdToContext.get(`${session.id()}:${contextId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
page(): Page {
|
page(): CdpPage {
|
||||||
return this.#page;
|
return this.#page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user