Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions packages/isomorphic/protocolMetainfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

// This file is generated by generate_channels.js, do not edit manually.

export type MethodMetainfo = { internal?: boolean, title?: string, slowMo?: boolean, snapshot?: boolean, pause?: boolean, isAutoWaiting?: boolean, input?: boolean, group?: string };
export type MethodMetainfo = { internal?: boolean, title?: string, slowMo?: boolean, snapshot?: boolean, pause?: boolean, isAutoWaiting?: boolean, input?: boolean, potentiallyClosesScope?: boolean, group?: string };

export const methodMetainfo = new Map<string, MethodMetainfo>([
['Android.devices', { internal: true, }],
Expand Down Expand Up @@ -51,22 +51,22 @@ export const methodMetainfo = new Map<string, MethodMetainfo>([
['APIRequestContext.fetchLog', { internal: true, }],
['APIRequestContext.storageState', { title: 'Get storage state', group: 'configuration', }],
['APIRequestContext.disposeAPIResponse', { internal: true, }],
['APIRequestContext.dispose', { internal: true, }],
['APIRequestContext.dispose', { internal: true, potentiallyClosesScope: true, }],
['Artifact.pathAfterFinished', { internal: true, }],
['Artifact.saveAs', { internal: true, }],
['Artifact.saveAsStream', { internal: true, }],
['Artifact.failure', { internal: true, }],
['Artifact.stream', { internal: true, }],
['Artifact.cancel', { internal: true, }],
['Artifact.delete', { internal: true, }],
['Artifact.delete', { internal: true, potentiallyClosesScope: true, }],
['Stream.read', { internal: true, }],
['Stream.close', { internal: true, }],
['WritableStream.write', { internal: true, }],
['WritableStream.close', { internal: true, }],
['Browser.startServer', { title: 'Start server', }],
['Browser.stopServer', { title: 'Stop server', }],
['Browser.close', { title: 'Close browser', pause: true, }],
['Browser.killForTests', { internal: true, }],
['Browser.close', { title: 'Close browser', pause: true, potentiallyClosesScope: true, }],
['Browser.killForTests', { internal: true, potentiallyClosesScope: true, }],
['Browser.defaultUserAgentForTest', { internal: true, }],
['Browser.newContext', { title: 'Create context', }],
['Browser.newContextForReuse', { internal: true, }],
Expand All @@ -78,7 +78,7 @@ export const methodMetainfo = new Map<string, MethodMetainfo>([
['BrowserContext.addInitScript', { title: 'Add init script', group: 'configuration', }],
['BrowserContext.clearCookies', { title: 'Clear cookies', group: 'configuration', }],
['BrowserContext.clearPermissions', { title: 'Clear permissions', group: 'configuration', }],
['BrowserContext.close', { title: 'Close context', pause: true, }],
['BrowserContext.close', { title: 'Close context', pause: true, potentiallyClosesScope: true, }],
['BrowserContext.cookies', { title: 'Get cookies', group: 'getter', }],
['BrowserContext.exposeBinding', { title: 'Expose binding', group: 'configuration', }],
['BrowserContext.grantPermissions', { title: 'Grant permissions', group: 'configuration', }],
Expand Down Expand Up @@ -111,7 +111,7 @@ export const methodMetainfo = new Map<string, MethodMetainfo>([
['BrowserType.launchPersistentContext', { title: 'Launch persistent context', }],
['BrowserType.connectOverCDP', { title: 'Connect over CDP', }],
['BrowserType.connectToWorker', { title: 'Connect to worker', }],
['Disposable.dispose', { internal: true, }],
['Disposable.dispose', { internal: true, potentiallyClosesScope: true, }],
['Electron.launch', { title: 'Launch electron', }],
['ElectronApplication.browserWindow', { internal: true, }],
['ElectronApplication.evaluateExpression', { title: 'Evaluate', }],
Expand All @@ -124,7 +124,7 @@ export const methodMetainfo = new Map<string, MethodMetainfo>([
['Frame.ariaSnapshot', { title: 'Aria snapshot', group: 'getter', }],
['Frame.blur', { title: 'Blur', slowMo: true, snapshot: true, pause: true, }],
['Frame.check', { title: 'Check', slowMo: true, snapshot: true, pause: true, input: true, isAutoWaiting: true, }],
['Frame.click', { title: 'Click', slowMo: true, snapshot: true, pause: true, input: true, isAutoWaiting: true, }],
['Frame.click', { title: 'Click', slowMo: true, snapshot: true, pause: true, input: true, isAutoWaiting: true, potentiallyClosesScope: true, }],
['Frame.content', { title: 'Get content', snapshot: true, pause: true, }],
['Frame.dragAndDrop', { title: 'Drag and drop', slowMo: true, snapshot: true, pause: true, input: true, isAutoWaiting: true, }],
['Frame.drop', { title: 'Drop files or data onto an element', slowMo: true, snapshot: true, pause: true, input: true, isAutoWaiting: true, }],
Expand Down Expand Up @@ -166,8 +166,8 @@ export const methodMetainfo = new Map<string, MethodMetainfo>([
['Frame.waitForFunction', { title: 'Wait for function', snapshot: true, pause: true, }],
['Frame.waitForSelector', { title: 'Wait for selector', snapshot: true, }],
['Frame.expect', { title: 'Expect "{expression}"', snapshot: true, pause: true, }],
['JSHandle.dispose', { internal: true, }],
['ElementHandle.dispose', { internal: true, }],
['JSHandle.dispose', { internal: true, potentiallyClosesScope: true, }],
['ElementHandle.dispose', { internal: true, potentiallyClosesScope: true, }],
['JSHandle.evaluateExpression', { title: 'Evaluate', snapshot: true, pause: true, }],
['ElementHandle.evaluateExpression', { title: 'Evaluate', snapshot: true, pause: true, }],
['JSHandle.evaluateExpressionHandle', { title: 'Evaluate', snapshot: true, pause: true, }],
Expand Down Expand Up @@ -243,7 +243,7 @@ export const methodMetainfo = new Map<string, MethodMetainfo>([
['Response.httpVersion', { internal: true, }],
['Response.sizes', { internal: true, }],
['Page.addInitScript', { title: 'Add init script', group: 'configuration', }],
['Page.close', { title: 'Close page', pause: true, }],
['Page.close', { title: 'Close page', pause: true, potentiallyClosesScope: true, }],
['Page.runBeforeUnload', { title: 'Run beforeunload', pause: true, }],
['Page.clearConsoleMessages', { title: 'Clear console messages', }],
['Page.consoleMessages', { title: 'Get console messages', group: 'getter', }],
Expand Down Expand Up @@ -312,7 +312,7 @@ export const methodMetainfo = new Map<string, MethodMetainfo>([
['JsonPipe.send', { internal: true, }],
['JsonPipe.close', { internal: true, }],
['CDPSession.send', { title: 'Send CDP command', group: 'configuration', }],
['CDPSession.detach', { title: 'Detach CDP session', group: 'configuration', }],
['CDPSession.detach', { title: 'Detach CDP session', potentiallyClosesScope: true, group: 'configuration', }],
['BindingCall.reject', { internal: true, }],
['BindingCall.resolve', { internal: true, }],
['Debugger.requestPause', { title: 'Pause on next call', group: 'configuration', }],
Expand All @@ -329,7 +329,7 @@ export const methodMetainfo = new Map<string, MethodMetainfo>([
['Tracing.tracingStop', { title: 'Stop tracing', group: 'configuration', }],
['Tracing.harStart', { internal: true, }],
['Tracing.harExport', { internal: true, }],
['Worker.disconnect', { title: 'Disconnect from worker', }],
['Worker.disconnect', { title: 'Disconnect from worker', potentiallyClosesScope: true, }],
['Worker.evaluateExpression', { title: 'Evaluate', }],
['Worker.evaluateExpressionHandle', { title: 'Evaluate', }],
['Worker.updateSubscription', { internal: true, }]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export class ArtifactDispatcher extends Dispatcher<Artifact, channels.ArtifactCh
}

async delete(params: channels.ArtifactDeleteParams, progress: Progress): Promise<void> {
progress.metadata.potentiallyClosesScope = true;
await this._object.delete(progress);
this._dispose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ export class BrowserContextDispatcher extends Dispatcher<BrowserContext, channel
}

async close(params: channels.BrowserContextCloseParams, progress: Progress): Promise<void> {
progress.metadata.potentiallyClosesScope = true;
await this._context.close(progress, params);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,12 @@ export class BrowserDispatcher extends Dispatcher<Browser, channels.BrowserChann
async close(params: channels.BrowserCloseParams, progress: Progress): Promise<void> {
if (this._options.ignoreStopAndKill)
return;
progress.metadata.potentiallyClosesScope = true;
await this._object.close(progress, params);
}

async killForTests(params: channels.BrowserKillForTestsParams, progress: Progress): Promise<void> {
if (this._options.ignoreStopAndKill)
return;
progress.metadata.potentiallyClosesScope = true;
await this._object.killForTests(progress);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export class CDPSessionDispatcher extends Dispatcher<CDPSession, channels.CDPSes
}

async detach(_: any, progress: Progress): Promise<void> {
progress.metadata.potentiallyClosesScope = true;
await this._object.detach(progress);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ export class Dispatcher<Type extends SdkObject, ChannelType, ParentScopeType ext
private _disposeRecursively(error: Error) {
assert(!this._disposed, `${this._guid} is disposed more than once`);
for (const controller of this._activeProgressControllers) {
if (!controller.metadata.potentiallyClosesScope)
const metainfo = getMetainfo({ type: controller.metadata.type, method: controller.metadata.method });
if (!metainfo?.potentiallyClosesScope)
controller.abort(error).catch(() => {});
}
this._onDispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export class DisposableDispatcher extends Dispatcher<DisposableObject, channels.
}

async dispose(_: any, progress: Progress) {
progress.metadata.potentiallyClosesScope = true;
await progress.race(this._object.dispose());
this._dispose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ export class FrameDispatcher extends Dispatcher<Frame, channels.FrameChannel, Br
}

async click(params: channels.FrameClickParams, progress: Progress): Promise<void> {
progress.metadata.potentiallyClosesScope = true;
return await this._frame.click(progress, params.selector, params);
}

Expand Down Expand Up @@ -274,7 +273,6 @@ export class FrameDispatcher extends Dispatcher<Frame, channels.FrameChannel, Br
}

async expect(params: channels.FrameExpectParams, progress: Progress): Promise<channels.FrameExpectResult> {
progress.metadata.potentiallyClosesScope = true;
let expectedValue = params.expectedValue ? parseArgument(params.expectedValue) : undefined;
if (params.expression === 'to.match.aria' && expectedValue)
expectedValue = parseAriaSnapshotUnsafe(yaml, expectedValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export class JSHandleDispatcher<ParentScope extends JSHandleDispatcherParentScop
}

async dispose(_: any, progress: Progress) {
progress.metadata.potentiallyClosesScope = true;
this._object.dispose();
this._dispose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ export class APIRequestContextDispatcher extends Dispatcher<APIRequestContext, c
}

async dispose(params: channels.APIRequestContextDisposeParams, progress: Progress): Promise<void> {
progress.metadata.potentiallyClosesScope = true;
await progress.race(this._object.dispose(params));
this._dispose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ export class PageDispatcher extends Dispatcher<Page, channels.PageChannel, Brows
}

async close(params: channels.PageCloseParams, progress: Progress): Promise<void> {
progress.metadata.potentiallyClosesScope = true;
await this._page.close(progress, params);
}

Expand Down Expand Up @@ -522,7 +521,6 @@ export class WorkerDispatcher extends Dispatcher<Worker, channels.WorkerChannel,
}

async disconnect(params: channels.WorkerDisconnectParams, progress: Progress): Promise<void> {
progress.metadata.potentiallyClosesScope = true;
await this._object.disconnect(progress, params);
}

Expand Down
2 changes: 2 additions & 0 deletions packages/protocol/spec/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ APIRequestContext:
internal: true
parameters:
reason: string?
flags:
potentiallyClosesScope: true

APIResponse:
type: object
Expand Down
2 changes: 2 additions & 0 deletions packages/protocol/spec/artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Artifact:

delete:
internal: true
flags:
potentiallyClosesScope: true

Stream:
type: interface
Expand Down
3 changes: 3 additions & 0 deletions packages/protocol/spec/browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ Browser:
reason: string?
flags:
pause: true
potentiallyClosesScope: true

killForTests:
internal: true
flags:
potentiallyClosesScope: true

defaultUserAgentForTest:
internal: true
Expand Down
1 change: 1 addition & 0 deletions packages/protocol/spec/browserContext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ BrowserContext:
reason: string?
flags:
pause: true
potentiallyClosesScope: true

cookies:
title: Get cookies
Expand Down
2 changes: 2 additions & 0 deletions packages/protocol/spec/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Disposable:

dispose:
internal: true
flags:
potentiallyClosesScope: true

WaitInfo:
type: object
Expand Down
1 change: 1 addition & 0 deletions packages/protocol/spec/frame.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ Frame:
pause: true
input: true
isAutoWaiting: true
potentiallyClosesScope: true

content:
title: Get content
Expand Down
2 changes: 2 additions & 0 deletions packages/protocol/spec/handles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ JSHandle:

dispose:
internal: true
flags:
potentiallyClosesScope: true

evaluateExpression:
title: Evaluate
Expand Down
1 change: 1 addition & 0 deletions packages/protocol/spec/page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Page:
reason: string?
flags:
pause: true
potentiallyClosesScope: true

runBeforeUnload:
title: Run beforeunload
Expand Down
2 changes: 2 additions & 0 deletions packages/protocol/spec/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ CDPSession:
detach:
title: Detach CDP session
group: configuration
flags:
potentiallyClosesScope: true

events:

Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/spec/worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Worker:
parameters:
reason: string?
flags:
pausesBeforeAction: true
potentiallyClosesScope: true

evaluateExpression:
title: Evaluate
Expand Down
1 change: 0 additions & 1 deletion packages/protocol/src/callMetadata.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,4 @@ export type CallMetadata = {
objectId?: string;
pageId?: string;
frameId?: string;
potentiallyClosesScope?: boolean;
};
5 changes: 3 additions & 2 deletions utils/generate_channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ for (const [name, item] of Object.entries(protocol)) {
const pauseProp = method.flags?.pause ? ` pause: ${method.flags.pause},` : '';
const inputProp = method.flags?.input ? ` input: ${method.flags.input},` : '';
const isAutoWaitingProp = method.flags?.isAutoWaiting ? ` isAutoWaiting: ${method.flags.isAutoWaiting},` : '';
methodMetainfo.push(`['${className + '.' + methodName}', {${internalProp}${titleProp}${slowMoProp}${snapshotProp}${pauseProp}${inputProp}${isAutoWaitingProp}${groupProp} }]`);
const potentiallyClosesScopeProp = method.flags?.potentiallyClosesScope ? ` potentiallyClosesScope: ${method.flags.potentiallyClosesScope},` : '';
methodMetainfo.push(`['${className + '.' + methodName}', {${internalProp}${titleProp}${slowMoProp}${snapshotProp}${pauseProp}${inputProp}${isAutoWaitingProp}${potentiallyClosesScopeProp}${groupProp} }]`);
}

const parameters = objectType(method.parameters || {}, '');
Expand Down Expand Up @@ -365,7 +366,7 @@ for (const [name, item] of Object.entries(protocol)) {
}
}

metainfo_ts.push(`export type MethodMetainfo = { internal?: boolean, title?: string, slowMo?: boolean, snapshot?: boolean, pause?: boolean, isAutoWaiting?: boolean, input?: boolean, group?: string };
metainfo_ts.push(`export type MethodMetainfo = { internal?: boolean, title?: string, slowMo?: boolean, snapshot?: boolean, pause?: boolean, isAutoWaiting?: boolean, input?: boolean, potentiallyClosesScope?: boolean, group?: string };

export const methodMetainfo = new Map<string, MethodMetainfo>([
${methodMetainfo.join(`,\n `)}
Expand Down
Loading