mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: remove excess internal comments (#10827)
This commit is contained in:
parent
538bb73ea7
commit
92f38ff5c9
@ -54,9 +54,6 @@ import {TaskQueue} from './TaskQueue.js';
|
||||
* @internal
|
||||
*/
|
||||
export class CDPBrowser extends BrowserBase {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
static async _create(
|
||||
product: 'firefox' | 'chrome' | undefined,
|
||||
connection: Connection,
|
||||
@ -98,16 +95,10 @@ export class CDPBrowser extends BrowserBase {
|
||||
#screenshotTaskQueue: TaskQueue;
|
||||
#targetManager: TargetManager;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
override get _targets(): Map<string, CDPTarget> {
|
||||
return this.#targetManager.getAvailableTargets();
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(
|
||||
product: 'chrome' | 'firefox' | undefined,
|
||||
connection: Connection,
|
||||
@ -163,9 +154,6 @@ export class CDPBrowser extends BrowserBase {
|
||||
this.emit(BrowserEmittedEvents.Disconnected);
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
override async _attach(): Promise<void> {
|
||||
this.#connection.on(
|
||||
ConnectionEmittedEvents.Disconnected,
|
||||
@ -190,9 +178,6 @@ export class CDPBrowser extends BrowserBase {
|
||||
await this.#targetManager.initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
override _detach(): void {
|
||||
this.#connection.off(
|
||||
ConnectionEmittedEvents.Disconnected,
|
||||
@ -224,9 +209,6 @@ export class CDPBrowser extends BrowserBase {
|
||||
return this.#process ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_targetManager(): TargetManager {
|
||||
return this.#targetManager;
|
||||
}
|
||||
@ -243,9 +225,6 @@ export class CDPBrowser extends BrowserBase {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
override _getIsPageTargetCallback(): IsPageTargetCallback | undefined {
|
||||
return this.#isPageTargetCallback;
|
||||
}
|
||||
@ -304,9 +283,6 @@ export class CDPBrowser extends BrowserBase {
|
||||
return this.#defaultContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
override async _disposeContext(contextId?: string): Promise<void> {
|
||||
if (!contextId) {
|
||||
return;
|
||||
@ -452,9 +428,6 @@ export class CDPBrowser extends BrowserBase {
|
||||
return this.#defaultContext.newPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
override async _createPageInContext(contextId?: string): Promise<Page> {
|
||||
const {targetId} = await this.#connection.send('Target.createTarget', {
|
||||
url: 'about:blank',
|
||||
@ -553,9 +526,6 @@ export class CDPBrowserContext extends BrowserContext {
|
||||
#browser: CDPBrowser;
|
||||
#id?: string;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(connection: Connection, browser: CDPBrowser, contextId?: string) {
|
||||
super();
|
||||
this.#connection = connection;
|
||||
|
@ -53,9 +53,6 @@ export class CustomQueryHandlerRegistry {
|
||||
[registerScript: string, Handler: typeof QueryHandler]
|
||||
>();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
get(name: string): typeof QueryHandler | undefined {
|
||||
const handler = this.#handlers.get(name);
|
||||
return handler ? handler[1] : undefined;
|
||||
@ -79,8 +76,6 @@ export class CustomQueryHandlerRegistry {
|
||||
* @param name - Name to register under.
|
||||
* @param queryHandler - {@link CustomQueryHandler | Custom query handler} to
|
||||
* register.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
register(name: string, handler: CustomQueryHandler): void {
|
||||
assert(
|
||||
@ -141,8 +136,6 @@ export class CustomQueryHandlerRegistry {
|
||||
* given name.
|
||||
*
|
||||
* @throws `Error` if there is no handler under the given name.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
unregister(name: string): void {
|
||||
const handler = this.#handlers.get(name);
|
||||
@ -155,8 +148,6 @@ export class CustomQueryHandlerRegistry {
|
||||
|
||||
/**
|
||||
* Gets the names of all {@link CustomQueryHandler | custom query handlers}.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
names(): string[] {
|
||||
return [...this.#handlers.keys()];
|
||||
@ -164,8 +155,6 @@ export class CustomQueryHandlerRegistry {
|
||||
|
||||
/**
|
||||
* Unregisters all custom query handlers.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
clear(): void {
|
||||
for (const [registerScript] of this.#handlers) {
|
||||
|
@ -26,9 +26,6 @@ import {CDPSession} from './Connection.js';
|
||||
export class CDPDialog extends Dialog {
|
||||
#client: CDPSession;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(
|
||||
client: CDPSession,
|
||||
type: Protocol.Page.DialogType,
|
||||
@ -39,9 +36,6 @@ export class CDPDialog extends Dialog {
|
||||
this.#client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
override async sendCommand(options: {
|
||||
accept: boolean;
|
||||
text?: string;
|
||||
|
@ -52,16 +52,10 @@ export class CDPElementHandle<
|
||||
this.#frame = frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
executionContext(): ExecutionContext {
|
||||
return this.handle.executionContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
get client(): CDPSession {
|
||||
return this.handle.client;
|
||||
}
|
||||
|
@ -240,16 +240,10 @@ export class CDPFrame extends Frame {
|
||||
return this.worlds[MAIN_WORLD].executionContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
override mainRealm(): IsolatedWorld {
|
||||
return this.worlds[MAIN_WORLD];
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
override isolatedRealm(): IsolatedWorld {
|
||||
return this.worlds[PUPPETEER_WORLD];
|
||||
}
|
||||
|
@ -75,9 +75,7 @@ export class FrameManager extends EventEmitter {
|
||||
#contextIdToContext = new Map<string, ExecutionContext>();
|
||||
#isolatedWorlds = new Set<string>();
|
||||
#client: CDPSession;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
||||
_frameTree = new FrameTree<CDPFrame>();
|
||||
|
||||
/**
|
||||
@ -299,9 +297,6 @@ export class FrameManager extends EventEmitter {
|
||||
void this.initialize(target._session()!);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_deviceRequestPromptManager(client: CDPSession): DeviceRequestPromptManager {
|
||||
let manager = this.#deviceRequestPromptManagerMap.get(client);
|
||||
if (manager === undefined) {
|
||||
|
@ -46,22 +46,13 @@ export class CDPKeyboard extends Keyboard {
|
||||
#client: CDPSession;
|
||||
#pressedKeys = new Set<string>();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_modifiers = 0;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(client: CDPSession) {
|
||||
super();
|
||||
this.#client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
updateClient(client: CDPSession): void {
|
||||
this.#client = client;
|
||||
}
|
||||
@ -288,18 +279,12 @@ export class CDPMouse extends Mouse {
|
||||
#client: CDPSession;
|
||||
#keyboard: CDPKeyboard;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(client: CDPSession, keyboard: CDPKeyboard) {
|
||||
super();
|
||||
this.#client = client;
|
||||
this.#keyboard = keyboard;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
updateClient(client: CDPSession): void {
|
||||
this.#client = client;
|
||||
}
|
||||
@ -576,18 +561,12 @@ export class CDPTouchscreen extends Touchscreen {
|
||||
#client: CDPSession;
|
||||
#keyboard: CDPKeyboard;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(client: CDPSession, keyboard: CDPKeyboard) {
|
||||
super();
|
||||
this.#client = client;
|
||||
this.#keyboard = keyboard;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
updateClient(client: CDPSession): void {
|
||||
this.#client = client;
|
||||
}
|
||||
|
@ -95,9 +95,6 @@ import {WebWorker} from './WebWorker.js';
|
||||
* @internal
|
||||
*/
|
||||
export class CDPPage extends Page {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
static async _create(
|
||||
client: CDPSession,
|
||||
target: CDPTarget,
|
||||
@ -211,9 +208,6 @@ export class CDPPage extends Page {
|
||||
['Page.fileChooserOpened', this.#onFileChooser.bind(this)],
|
||||
]);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(
|
||||
client: CDPSession,
|
||||
target: CDPTarget,
|
||||
@ -379,9 +373,6 @@ export class CDPPage extends Page {
|
||||
this.#fileChooserDeferreds.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_client(): CDPSession {
|
||||
return this.#client;
|
||||
}
|
||||
|
@ -50,17 +50,8 @@ export class CDPTarget extends Target {
|
||||
| ((isAutoAttachEmulated: boolean) => Promise<CDPSession>)
|
||||
| undefined;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_initializedDeferred = Deferred.create<InitializationStatus>();
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_isClosedDeferred = Deferred.create<void>();
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_targetId: string;
|
||||
|
||||
/**
|
||||
@ -89,23 +80,14 @@ export class CDPTarget extends Target {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_subtype(): string | undefined {
|
||||
return this.#targetInfo.subtype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_session(): CDPSession | undefined {
|
||||
return this.#session;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
protected _sessionFactory(): (
|
||||
isAutoAttachEmulated: boolean
|
||||
) => Promise<CDPSession> {
|
||||
@ -151,9 +133,6 @@ export class CDPTarget extends Target {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_targetManager(): TargetManager {
|
||||
if (!this.#targetManager) {
|
||||
throw new Error('targetManager is not initialized');
|
||||
@ -161,9 +140,6 @@ export class CDPTarget extends Target {
|
||||
return this.#targetManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_getTargetInfo(): Protocol.Target.TargetInfo {
|
||||
return this.#targetInfo;
|
||||
}
|
||||
@ -190,24 +166,15 @@ export class CDPTarget extends Target {
|
||||
return this.browser()._targets.get(openerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_targetInfoChanged(targetInfo: Protocol.Target.TargetInfo): void {
|
||||
this.#targetInfo = targetInfo;
|
||||
this._checkIfInitialized();
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_initialize(): void {
|
||||
this._initializedDeferred.resolve(InitializationStatus.SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
protected _checkIfInitialized(): void {
|
||||
if (!this._initializedDeferred.resolved()) {
|
||||
this._initializedDeferred.resolve(InitializationStatus.SUCCESS);
|
||||
@ -224,9 +191,6 @@ export class PageTarget extends CDPTarget {
|
||||
#screenshotTaskQueue: TaskQueue;
|
||||
#ignoreHTTPSErrors: boolean;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(
|
||||
targetInfo: Protocol.Target.TargetInfo,
|
||||
session: CDPSession | undefined,
|
||||
|
@ -56,9 +56,6 @@ export class BidiElementHandle<
|
||||
return this.handle.remoteValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
assertElementHasWorld(): asserts this {
|
||||
// TODO: Should assert element has a Sandbox
|
||||
return;
|
||||
|
@ -287,9 +287,6 @@ const getBidiKeyValue = (key: KeyInput) => {
|
||||
export class Keyboard extends BaseKeyboard {
|
||||
#context: BrowsingContext;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(context: BrowsingContext) {
|
||||
super();
|
||||
this.#context = context;
|
||||
@ -463,9 +460,6 @@ export class Mouse extends BaseMouse {
|
||||
#context: BrowsingContext;
|
||||
#lastMovePoint?: Point;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(context: BrowsingContext) {
|
||||
super();
|
||||
this.#context = context;
|
||||
@ -619,9 +613,6 @@ export class Mouse extends BaseMouse {
|
||||
export class Touchscreen extends BaseTouchscreen {
|
||||
#context: BrowsingContext;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(context: BrowsingContext) {
|
||||
super();
|
||||
this.#context = context;
|
||||
|
@ -86,17 +86,15 @@ describe('Frame specs', function () {
|
||||
|
||||
const frame1 = (await attachFrame(page, 'frame1', server.EMPTY_PAGE))!;
|
||||
await detachFrame(page, 'frame1');
|
||||
let error!: Error;
|
||||
await frame1
|
||||
.evaluate(() => {
|
||||
let error: Error | undefined;
|
||||
try {
|
||||
await frame1.evaluate(() => {
|
||||
return 7 * 8;
|
||||
})
|
||||
.catch(error_ => {
|
||||
return (error = error_);
|
||||
});
|
||||
expect(error.message).toContain(
|
||||
'Execution context is not available in detached frame'
|
||||
);
|
||||
} catch (err) {
|
||||
error = err as Error;
|
||||
}
|
||||
expect(error?.message).toContain('Attempted to use detached Frame');
|
||||
});
|
||||
|
||||
it('allows readonly array to be an argument', async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user