Skip to content

Commit

Permalink
chore: use CdpPage instead of Page in CDP frames (#11157)
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagowfx committed Oct 13, 2023
1 parent 9541e97 commit d99f9d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions packages/puppeteer-core/src/cdp/Frame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type {Protocol} from 'devtools-protocol';
import type {CDPSession} from '../api/CDPSession.js';
import {Frame, FrameEvent, throwIfDetached} from '../api/Frame.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 {assert} from '../util/assert.js';
import {Deferred} from '../util/Deferred.js';
Expand All @@ -37,6 +37,7 @@ import {
LifecycleWatcher,
type PuppeteerLifeCycleEvent,
} from './LifecycleWatcher.js';
import type {CdpPage} from './Page.js';

/**
* @internal
Expand Down Expand Up @@ -112,7 +113,7 @@ export class CdpFrame extends Frame {
}
}

override page(): Page {
override page(): CdpPage {
return this._frameManager.page();
}

Expand Down
8 changes: 4 additions & 4 deletions packages/puppeteer-core/src/cdp/FrameManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import type {Protocol} from 'devtools-protocol';

import {type CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
import {FrameEvent} from '../api/Frame.js';
import type {Page} from '../api/Page.js';
import {EventEmitter, type EventType} from '../common/EventEmitter.js';
import type {TimeoutSettings} from '../common/TimeoutSettings.js';
import {debugError, PuppeteerURL, UTILITY_WORLD_NAME} from '../common/util.js';
Expand All @@ -36,6 +35,7 @@ import {FrameTree} from './FrameTree.js';
import type {IsolatedWorld} from './IsolatedWorld.js';
import {MAIN_WORLD, PUPPETEER_WORLD} from './IsolatedWorlds.js';
import {NetworkManager} from './NetworkManager.js';
import type {CdpPage} from './Page.js';
import type {CdpTarget} from './Target.js';

/**
Expand Down Expand Up @@ -77,7 +77,7 @@ const TIME_FOR_WAITING_FOR_SWAP = 100; // ms.
* @internal
*/
export class FrameManager extends EventEmitter<FrameManagerEvents> {
#page: Page;
#page: CdpPage;
#networkManager: NetworkManager;
#timeoutSettings: TimeoutSettings;
#contextIdToContext = new Map<string, ExecutionContext>();
Expand Down Expand Up @@ -114,7 +114,7 @@ export class FrameManager extends EventEmitter<FrameManagerEvents> {

constructor(
client: CDPSession,
page: Page,
page: CdpPage,
ignoreHTTPSErrors: boolean,
timeoutSettings: TimeoutSettings
) {
Expand Down Expand Up @@ -291,7 +291,7 @@ export class FrameManager extends EventEmitter<FrameManagerEvents> {
return this.#contextIdToContext.get(`${session.id()}:${contextId}`);
}

page(): Page {
page(): CdpPage {
return this.#page;
}

Expand Down

0 comments on commit d99f9d7

Please sign in to comment.