chore: remove excess internal comments (#10827)

This commit is contained in:
jrandolf 2023-08-31 16:39:58 +02:00 committed by GitHub
parent 538bb73ea7
commit 92f38ff5c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 8 additions and 152 deletions

View File

@ -54,9 +54,6 @@ import {TaskQueue} from './TaskQueue.js';
* @internal * @internal
*/ */
export class CDPBrowser extends BrowserBase { export class CDPBrowser extends BrowserBase {
/**
* @internal
*/
static async _create( static async _create(
product: 'firefox' | 'chrome' | undefined, product: 'firefox' | 'chrome' | undefined,
connection: Connection, connection: Connection,
@ -98,16 +95,10 @@ export class CDPBrowser extends BrowserBase {
#screenshotTaskQueue: TaskQueue; #screenshotTaskQueue: TaskQueue;
#targetManager: TargetManager; #targetManager: TargetManager;
/**
* @internal
*/
override get _targets(): Map<string, CDPTarget> { override get _targets(): Map<string, CDPTarget> {
return this.#targetManager.getAvailableTargets(); return this.#targetManager.getAvailableTargets();
} }
/**
* @internal
*/
constructor( constructor(
product: 'chrome' | 'firefox' | undefined, product: 'chrome' | 'firefox' | undefined,
connection: Connection, connection: Connection,
@ -163,9 +154,6 @@ export class CDPBrowser extends BrowserBase {
this.emit(BrowserEmittedEvents.Disconnected); this.emit(BrowserEmittedEvents.Disconnected);
}; };
/**
* @internal
*/
override async _attach(): Promise<void> { override async _attach(): Promise<void> {
this.#connection.on( this.#connection.on(
ConnectionEmittedEvents.Disconnected, ConnectionEmittedEvents.Disconnected,
@ -190,9 +178,6 @@ export class CDPBrowser extends BrowserBase {
await this.#targetManager.initialize(); await this.#targetManager.initialize();
} }
/**
* @internal
*/
override _detach(): void { override _detach(): void {
this.#connection.off( this.#connection.off(
ConnectionEmittedEvents.Disconnected, ConnectionEmittedEvents.Disconnected,
@ -224,9 +209,6 @@ export class CDPBrowser extends BrowserBase {
return this.#process ?? null; return this.#process ?? null;
} }
/**
* @internal
*/
_targetManager(): TargetManager { _targetManager(): TargetManager {
return this.#targetManager; return this.#targetManager;
} }
@ -243,9 +225,6 @@ export class CDPBrowser extends BrowserBase {
}); });
} }
/**
* @internal
*/
override _getIsPageTargetCallback(): IsPageTargetCallback | undefined { override _getIsPageTargetCallback(): IsPageTargetCallback | undefined {
return this.#isPageTargetCallback; return this.#isPageTargetCallback;
} }
@ -304,9 +283,6 @@ export class CDPBrowser extends BrowserBase {
return this.#defaultContext; return this.#defaultContext;
} }
/**
* @internal
*/
override async _disposeContext(contextId?: string): Promise<void> { override async _disposeContext(contextId?: string): Promise<void> {
if (!contextId) { if (!contextId) {
return; return;
@ -452,9 +428,6 @@ export class CDPBrowser extends BrowserBase {
return this.#defaultContext.newPage(); return this.#defaultContext.newPage();
} }
/**
* @internal
*/
override async _createPageInContext(contextId?: string): Promise<Page> { override async _createPageInContext(contextId?: string): Promise<Page> {
const {targetId} = await this.#connection.send('Target.createTarget', { const {targetId} = await this.#connection.send('Target.createTarget', {
url: 'about:blank', url: 'about:blank',
@ -553,9 +526,6 @@ export class CDPBrowserContext extends BrowserContext {
#browser: CDPBrowser; #browser: CDPBrowser;
#id?: string; #id?: string;
/**
* @internal
*/
constructor(connection: Connection, browser: CDPBrowser, contextId?: string) { constructor(connection: Connection, browser: CDPBrowser, contextId?: string) {
super(); super();
this.#connection = connection; this.#connection = connection;

View File

@ -53,9 +53,6 @@ export class CustomQueryHandlerRegistry {
[registerScript: string, Handler: typeof QueryHandler] [registerScript: string, Handler: typeof QueryHandler]
>(); >();
/**
* @internal
*/
get(name: string): typeof QueryHandler | undefined { get(name: string): typeof QueryHandler | undefined {
const handler = this.#handlers.get(name); const handler = this.#handlers.get(name);
return handler ? handler[1] : undefined; return handler ? handler[1] : undefined;
@ -79,8 +76,6 @@ export class CustomQueryHandlerRegistry {
* @param name - Name to register under. * @param name - Name to register under.
* @param queryHandler - {@link CustomQueryHandler | Custom query handler} to * @param queryHandler - {@link CustomQueryHandler | Custom query handler} to
* register. * register.
*
* @internal
*/ */
register(name: string, handler: CustomQueryHandler): void { register(name: string, handler: CustomQueryHandler): void {
assert( assert(
@ -141,8 +136,6 @@ export class CustomQueryHandlerRegistry {
* given name. * given name.
* *
* @throws `Error` if there is no handler under the given name. * @throws `Error` if there is no handler under the given name.
*
* @internal
*/ */
unregister(name: string): void { unregister(name: string): void {
const handler = this.#handlers.get(name); const handler = this.#handlers.get(name);
@ -155,8 +148,6 @@ export class CustomQueryHandlerRegistry {
/** /**
* Gets the names of all {@link CustomQueryHandler | custom query handlers}. * Gets the names of all {@link CustomQueryHandler | custom query handlers}.
*
* @internal
*/ */
names(): string[] { names(): string[] {
return [...this.#handlers.keys()]; return [...this.#handlers.keys()];
@ -164,8 +155,6 @@ export class CustomQueryHandlerRegistry {
/** /**
* Unregisters all custom query handlers. * Unregisters all custom query handlers.
*
* @internal
*/ */
clear(): void { clear(): void {
for (const [registerScript] of this.#handlers) { for (const [registerScript] of this.#handlers) {

View File

@ -26,9 +26,6 @@ import {CDPSession} from './Connection.js';
export class CDPDialog extends Dialog { export class CDPDialog extends Dialog {
#client: CDPSession; #client: CDPSession;
/**
* @internal
*/
constructor( constructor(
client: CDPSession, client: CDPSession,
type: Protocol.Page.DialogType, type: Protocol.Page.DialogType,
@ -39,9 +36,6 @@ export class CDPDialog extends Dialog {
this.#client = client; this.#client = client;
} }
/**
* @internal
*/
override async sendCommand(options: { override async sendCommand(options: {
accept: boolean; accept: boolean;
text?: string; text?: string;

View File

@ -52,16 +52,10 @@ export class CDPElementHandle<
this.#frame = frame; this.#frame = frame;
} }
/**
* @internal
*/
executionContext(): ExecutionContext { executionContext(): ExecutionContext {
return this.handle.executionContext(); return this.handle.executionContext();
} }
/**
* @internal
*/
get client(): CDPSession { get client(): CDPSession {
return this.handle.client; return this.handle.client;
} }

View File

@ -240,16 +240,10 @@ export class CDPFrame extends Frame {
return this.worlds[MAIN_WORLD].executionContext(); return this.worlds[MAIN_WORLD].executionContext();
} }
/**
* @internal
*/
override mainRealm(): IsolatedWorld { override mainRealm(): IsolatedWorld {
return this.worlds[MAIN_WORLD]; return this.worlds[MAIN_WORLD];
} }
/**
* @internal
*/
override isolatedRealm(): IsolatedWorld { override isolatedRealm(): IsolatedWorld {
return this.worlds[PUPPETEER_WORLD]; return this.worlds[PUPPETEER_WORLD];
} }

View File

@ -75,9 +75,7 @@ export class FrameManager extends EventEmitter {
#contextIdToContext = new Map<string, ExecutionContext>(); #contextIdToContext = new Map<string, ExecutionContext>();
#isolatedWorlds = new Set<string>(); #isolatedWorlds = new Set<string>();
#client: CDPSession; #client: CDPSession;
/**
* @internal
*/
_frameTree = new FrameTree<CDPFrame>(); _frameTree = new FrameTree<CDPFrame>();
/** /**
@ -299,9 +297,6 @@ export class FrameManager extends EventEmitter {
void this.initialize(target._session()!); void this.initialize(target._session()!);
} }
/**
* @internal
*/
_deviceRequestPromptManager(client: CDPSession): DeviceRequestPromptManager { _deviceRequestPromptManager(client: CDPSession): DeviceRequestPromptManager {
let manager = this.#deviceRequestPromptManagerMap.get(client); let manager = this.#deviceRequestPromptManagerMap.get(client);
if (manager === undefined) { if (manager === undefined) {

View File

@ -46,22 +46,13 @@ export class CDPKeyboard extends Keyboard {
#client: CDPSession; #client: CDPSession;
#pressedKeys = new Set<string>(); #pressedKeys = new Set<string>();
/**
* @internal
*/
_modifiers = 0; _modifiers = 0;
/**
* @internal
*/
constructor(client: CDPSession) { constructor(client: CDPSession) {
super(); super();
this.#client = client; this.#client = client;
} }
/**
* @internal
*/
updateClient(client: CDPSession): void { updateClient(client: CDPSession): void {
this.#client = client; this.#client = client;
} }
@ -288,18 +279,12 @@ export class CDPMouse extends Mouse {
#client: CDPSession; #client: CDPSession;
#keyboard: CDPKeyboard; #keyboard: CDPKeyboard;
/**
* @internal
*/
constructor(client: CDPSession, keyboard: CDPKeyboard) { constructor(client: CDPSession, keyboard: CDPKeyboard) {
super(); super();
this.#client = client; this.#client = client;
this.#keyboard = keyboard; this.#keyboard = keyboard;
} }
/**
* @internal
*/
updateClient(client: CDPSession): void { updateClient(client: CDPSession): void {
this.#client = client; this.#client = client;
} }
@ -576,18 +561,12 @@ export class CDPTouchscreen extends Touchscreen {
#client: CDPSession; #client: CDPSession;
#keyboard: CDPKeyboard; #keyboard: CDPKeyboard;
/**
* @internal
*/
constructor(client: CDPSession, keyboard: CDPKeyboard) { constructor(client: CDPSession, keyboard: CDPKeyboard) {
super(); super();
this.#client = client; this.#client = client;
this.#keyboard = keyboard; this.#keyboard = keyboard;
} }
/**
* @internal
*/
updateClient(client: CDPSession): void { updateClient(client: CDPSession): void {
this.#client = client; this.#client = client;
} }

View File

@ -95,9 +95,6 @@ import {WebWorker} from './WebWorker.js';
* @internal * @internal
*/ */
export class CDPPage extends Page { export class CDPPage extends Page {
/**
* @internal
*/
static async _create( static async _create(
client: CDPSession, client: CDPSession,
target: CDPTarget, target: CDPTarget,
@ -211,9 +208,6 @@ export class CDPPage extends Page {
['Page.fileChooserOpened', this.#onFileChooser.bind(this)], ['Page.fileChooserOpened', this.#onFileChooser.bind(this)],
]); ]);
/**
* @internal
*/
constructor( constructor(
client: CDPSession, client: CDPSession,
target: CDPTarget, target: CDPTarget,
@ -379,9 +373,6 @@ export class CDPPage extends Page {
this.#fileChooserDeferreds.clear(); this.#fileChooserDeferreds.clear();
} }
/**
* @internal
*/
_client(): CDPSession { _client(): CDPSession {
return this.#client; return this.#client;
} }

View File

@ -50,17 +50,8 @@ export class CDPTarget extends Target {
| ((isAutoAttachEmulated: boolean) => Promise<CDPSession>) | ((isAutoAttachEmulated: boolean) => Promise<CDPSession>)
| undefined; | undefined;
/**
* @internal
*/
_initializedDeferred = Deferred.create<InitializationStatus>(); _initializedDeferred = Deferred.create<InitializationStatus>();
/**
* @internal
*/
_isClosedDeferred = Deferred.create<void>(); _isClosedDeferred = Deferred.create<void>();
/**
* @internal
*/
_targetId: string; _targetId: string;
/** /**
@ -89,23 +80,14 @@ export class CDPTarget extends Target {
} }
} }
/**
* @internal
*/
_subtype(): string | undefined { _subtype(): string | undefined {
return this.#targetInfo.subtype; return this.#targetInfo.subtype;
} }
/**
* @internal
*/
_session(): CDPSession | undefined { _session(): CDPSession | undefined {
return this.#session; return this.#session;
} }
/**
* @internal
*/
protected _sessionFactory(): ( protected _sessionFactory(): (
isAutoAttachEmulated: boolean isAutoAttachEmulated: boolean
) => Promise<CDPSession> { ) => Promise<CDPSession> {
@ -151,9 +133,6 @@ export class CDPTarget extends Target {
} }
} }
/**
* @internal
*/
_targetManager(): TargetManager { _targetManager(): TargetManager {
if (!this.#targetManager) { if (!this.#targetManager) {
throw new Error('targetManager is not initialized'); throw new Error('targetManager is not initialized');
@ -161,9 +140,6 @@ export class CDPTarget extends Target {
return this.#targetManager; return this.#targetManager;
} }
/**
* @internal
*/
_getTargetInfo(): Protocol.Target.TargetInfo { _getTargetInfo(): Protocol.Target.TargetInfo {
return this.#targetInfo; return this.#targetInfo;
} }
@ -190,24 +166,15 @@ export class CDPTarget extends Target {
return this.browser()._targets.get(openerId); return this.browser()._targets.get(openerId);
} }
/**
* @internal
*/
_targetInfoChanged(targetInfo: Protocol.Target.TargetInfo): void { _targetInfoChanged(targetInfo: Protocol.Target.TargetInfo): void {
this.#targetInfo = targetInfo; this.#targetInfo = targetInfo;
this._checkIfInitialized(); this._checkIfInitialized();
} }
/**
* @internal
*/
_initialize(): void { _initialize(): void {
this._initializedDeferred.resolve(InitializationStatus.SUCCESS); this._initializedDeferred.resolve(InitializationStatus.SUCCESS);
} }
/**
* @internal
*/
protected _checkIfInitialized(): void { protected _checkIfInitialized(): void {
if (!this._initializedDeferred.resolved()) { if (!this._initializedDeferred.resolved()) {
this._initializedDeferred.resolve(InitializationStatus.SUCCESS); this._initializedDeferred.resolve(InitializationStatus.SUCCESS);
@ -224,9 +191,6 @@ export class PageTarget extends CDPTarget {
#screenshotTaskQueue: TaskQueue; #screenshotTaskQueue: TaskQueue;
#ignoreHTTPSErrors: boolean; #ignoreHTTPSErrors: boolean;
/**
* @internal
*/
constructor( constructor(
targetInfo: Protocol.Target.TargetInfo, targetInfo: Protocol.Target.TargetInfo,
session: CDPSession | undefined, session: CDPSession | undefined,

View File

@ -56,9 +56,6 @@ export class BidiElementHandle<
return this.handle.remoteValue(); return this.handle.remoteValue();
} }
/**
* @internal
*/
assertElementHasWorld(): asserts this { assertElementHasWorld(): asserts this {
// TODO: Should assert element has a Sandbox // TODO: Should assert element has a Sandbox
return; return;

View File

@ -287,9 +287,6 @@ const getBidiKeyValue = (key: KeyInput) => {
export class Keyboard extends BaseKeyboard { export class Keyboard extends BaseKeyboard {
#context: BrowsingContext; #context: BrowsingContext;
/**
* @internal
*/
constructor(context: BrowsingContext) { constructor(context: BrowsingContext) {
super(); super();
this.#context = context; this.#context = context;
@ -463,9 +460,6 @@ export class Mouse extends BaseMouse {
#context: BrowsingContext; #context: BrowsingContext;
#lastMovePoint?: Point; #lastMovePoint?: Point;
/**
* @internal
*/
constructor(context: BrowsingContext) { constructor(context: BrowsingContext) {
super(); super();
this.#context = context; this.#context = context;
@ -619,9 +613,6 @@ export class Mouse extends BaseMouse {
export class Touchscreen extends BaseTouchscreen { export class Touchscreen extends BaseTouchscreen {
#context: BrowsingContext; #context: BrowsingContext;
/**
* @internal
*/
constructor(context: BrowsingContext) { constructor(context: BrowsingContext) {
super(); super();
this.#context = context; this.#context = context;

View File

@ -86,17 +86,15 @@ describe('Frame specs', function () {
const frame1 = (await attachFrame(page, 'frame1', server.EMPTY_PAGE))!; const frame1 = (await attachFrame(page, 'frame1', server.EMPTY_PAGE))!;
await detachFrame(page, 'frame1'); await detachFrame(page, 'frame1');
let error!: Error; let error: Error | undefined;
await frame1 try {
.evaluate(() => { await frame1.evaluate(() => {
return 7 * 8; return 7 * 8;
})
.catch(error_ => {
return (error = error_);
}); });
expect(error.message).toContain( } catch (err) {
'Execution context is not available in detached frame' error = err as Error;
); }
expect(error?.message).toContain('Attempted to use detached Frame');
}); });
it('allows readonly array to be an argument', async () => { it('allows readonly array to be an argument', async () => {