diff --git a/packages/playwright-core/src/server/browserContext.ts b/packages/playwright-core/src/server/browserContext.ts index abc26fb66c..f556f83716 100644 --- a/packages/playwright-core/src/server/browserContext.ts +++ b/packages/playwright-core/src/server/browserContext.ts @@ -196,7 +196,7 @@ export abstract class BrowserContext extends SdkObject { } async resetForReuseImpl(progress: Progress, params: channels.BrowserNewContextForReuseParams | null) { - await progress.race(this.tracing.resetForReuse()); + await this.tracing.resetForReuse(progress); if (params) { for (const key of paramsThatAllowContextReuse) diff --git a/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts b/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts index 8263870039..58d785705e 100644 --- a/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts @@ -19,8 +19,8 @@ import { CDPSession } from '../chromium/crConnection'; import type { BrowserContextDispatcher } from './browserContextDispatcher'; import type { BrowserDispatcher } from './browserDispatcher'; -import type { CallMetadata } from '../instrumentation'; import type * as channels from '@protocol/channels'; +import type { Progress } from '@protocol/progress'; export class CDPSessionDispatcher extends Dispatcher implements channels.CDPSessionChannel { _type_CDPSession = true; @@ -31,12 +31,12 @@ export class CDPSessionDispatcher extends Dispatcher this._dispose()); } - async send(params: channels.CDPSessionSendParams): Promise { - return { result: await this._object.send(params.method as any, params.params) }; + async send(params: channels.CDPSessionSendParams, progress: Progress): Promise { + return { result: await progress.race(this._object.send(params.method as any, params.params)) }; } - async detach(_: any, metadata: CallMetadata): Promise { - metadata.potentiallyClosesScope = true; + async detach(_: any, progress: Progress): Promise { + progress.metadata.potentiallyClosesScope = true; await this._object.detach(); } } diff --git a/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts b/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts index b86872b133..52a29691a2 100644 --- a/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts @@ -20,6 +20,7 @@ import { PageDispatcher } from './pageDispatcher'; import type { Dialog } from '../dialog'; import type { BrowserContextDispatcher } from './browserContextDispatcher'; import type * as channels from '@protocol/channels'; +import type { Progress } from '@protocol/progress'; export class DialogDispatcher extends Dispatcher implements channels.DialogChannel { _type_Dialog = true; @@ -35,11 +36,11 @@ export class DialogDispatcher extends Dispatcher { - await this._object.accept(params.promptText); + async accept(params: channels.DialogAcceptParams, progress: Progress): Promise { + await progress.race(this._object.accept(params.promptText)); } - async dismiss(): Promise { - await this._object.dismiss(); + async dismiss(params: channels.DialogDismissParams, progress: Progress): Promise { + await progress.race(this._object.dismiss()); } } diff --git a/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts b/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts index a35aa9171a..4bd068f373 100644 --- a/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts @@ -22,8 +22,8 @@ import type * as js from '../javascript'; import type { ElectronApplicationDispatcher } from './electronDispatcher'; import type { FrameDispatcher } from './frameDispatcher'; import type { PageDispatcher, WorkerDispatcher } from './pageDispatcher'; -import type { CallMetadata } from '../instrumentation'; import type * as channels from '@protocol/channels'; +import type { Progress } from '@protocol/progress'; export type JSHandleDispatcherParentScope = PageDispatcher | FrameDispatcher | WorkerDispatcher | ElectronApplicationDispatcher; @@ -42,24 +42,25 @@ export class JSHandleDispatcher this._dispatchEvent('previewUpdated', { preview })); } - async evaluateExpression(params: channels.JSHandleEvaluateExpressionParams): Promise { - return { value: serializeResult(await this._object.evaluateExpression(params.expression, { isFunction: params.isFunction }, parseArgument(params.arg))) }; + async evaluateExpression(params: channels.JSHandleEvaluateExpressionParams, progress: Progress): Promise { + const jsHandle = await progress.race(this._object.evaluateExpression(params.expression, { isFunction: params.isFunction }, parseArgument(params.arg))); + return { value: serializeResult(jsHandle) }; } - async evaluateExpressionHandle(params: channels.JSHandleEvaluateExpressionHandleParams): Promise { - const jsHandle = await this._object.evaluateExpressionHandle(params.expression, { isFunction: params.isFunction }, parseArgument(params.arg)); + async evaluateExpressionHandle(params: channels.JSHandleEvaluateExpressionHandleParams, progress: Progress): Promise { + const jsHandle = await progress.race(this._object.evaluateExpressionHandle(params.expression, { isFunction: params.isFunction }, parseArgument(params.arg))); // If "jsHandle" is an ElementHandle, it belongs to the same frame as "this". return { handle: ElementHandleDispatcher.fromJSOrElementHandle(this.parentScope() as FrameDispatcher, jsHandle) }; } - async getProperty(params: channels.JSHandleGetPropertyParams): Promise { - const jsHandle = await this._object.getProperty(params.name); + async getProperty(params: channels.JSHandleGetPropertyParams, progress: Progress): Promise { + const jsHandle = await progress.race(this._object.getProperty(params.name)); // If "jsHandle" is an ElementHandle, it belongs to the same frame as "this". return { handle: ElementHandleDispatcher.fromJSOrElementHandle(this.parentScope() as FrameDispatcher, jsHandle) }; } - async getPropertyList(): Promise { - const map = await this._object.getProperties(); + async getPropertyList(params: channels.JSHandleGetPropertyListParams, progress: Progress): Promise { + const map = await progress.race(this._object.getProperties()); const properties = []; for (const [name, value] of map) { // If "jsHandle" is an ElementHandle, it belongs to the same frame as "this". @@ -68,12 +69,12 @@ export class JSHandleDispatcher { - return { value: serializeResult(await this._object.jsonValue()) }; + async jsonValue(params: channels.JSHandleJsonValueParams, progress: Progress): Promise { + return { value: serializeResult(await progress.race(this._object.jsonValue())) }; } - async dispose(_: any, metadata: CallMetadata) { - metadata.potentiallyClosesScope = true; + async dispose(_: any, progress: Progress) { + progress.metadata.potentiallyClosesScope = true; this._object.dispose(); this._dispose(); } diff --git a/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts b/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts index 522df815be..f60e50cd92 100644 --- a/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts @@ -19,6 +19,7 @@ import { SdkObject } from '../instrumentation'; import type { LocalUtilsDispatcher } from './localUtilsDispatcher'; import type * as channels from '@protocol/channels'; +import type { Progress } from '@protocol/progress'; export class JsonPipeDispatcher extends Dispatcher implements channels.JsonPipeChannel { _type_JsonPipe = true; @@ -26,11 +27,11 @@ export class JsonPipeDispatcher extends Dispatcher { + async send(params: channels.JsonPipeSendParams, progress: Progress): Promise { this.emit('message', params.message); } - async close(): Promise { + async close(params: channels.JsonPipeCloseParams, progress: Progress): Promise { this.emit('close'); if (!this._disposed) { this._dispatchEvent('closed', {}); diff --git a/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts b/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts index a80aa49456..3d46190884 100644 --- a/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts @@ -34,6 +34,7 @@ import type { AndroidDevice } from '../android/android'; import type { Browser } from '../browser'; import type { Playwright } from '../playwright'; import type * as channels from '@protocol/channels'; +import type { Progress } from '@protocol/progress'; export type PlaywrightDispatcherOptions = { socksProxy?: SocksProxy; @@ -85,7 +86,7 @@ export class PlaywrightDispatcher extends Dispatcher { + async newRequest(params: channels.PlaywrightNewRequestParams, progress: Progress): Promise { const request = new GlobalAPIRequestContext(this._object, params); return { request: APIRequestContextDispatcher.from(this.parentScope(), request) }; } @@ -112,23 +113,23 @@ class SocksSupportDispatcher extends Dispatcher { + async socksConnected(params: channels.SocksSupportSocksConnectedParams, progress: Progress): Promise { this._socksProxy?.socketConnected(params); } - async socksFailed(params: channels.SocksSupportSocksFailedParams): Promise { + async socksFailed(params: channels.SocksSupportSocksFailedParams, progress: Progress): Promise { this._socksProxy?.socketFailed(params); } - async socksData(params: channels.SocksSupportSocksDataParams): Promise { + async socksData(params: channels.SocksSupportSocksDataParams, progress: Progress): Promise { this._socksProxy?.sendSocketData(params); } - async socksError(params: channels.SocksSupportSocksErrorParams): Promise { + async socksError(params: channels.SocksSupportSocksErrorParams, progress: Progress): Promise { this._socksProxy?.sendSocketError(params); } - async socksEnd(params: channels.SocksSupportSocksEndParams): Promise { + async socksEnd(params: channels.SocksSupportSocksEndParams, progress: Progress): Promise { this._socksProxy?.sendSocketEnd(params); } diff --git a/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts b/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts index 82b5319c59..2d7da4fa66 100644 --- a/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts @@ -21,6 +21,7 @@ import { SdkObject } from '../instrumentation'; import type { ArtifactDispatcher } from './artifactDispatcher'; import type * as channels from '@protocol/channels'; import type * as stream from 'stream'; +import type { Progress } from '@protocol/progress'; class StreamSdkObject extends SdkObject { readonly stream: stream.Readable; @@ -42,7 +43,7 @@ export class StreamDispatcher extends Dispatcher this._ended = true); } - async read(params: channels.StreamReadParams): Promise { + async read(params: channels.StreamReadParams, progress: Progress): Promise { const stream = this._object.stream; if (this._ended) return { binary: Buffer.from('') }; @@ -52,16 +53,17 @@ export class StreamDispatcher extends Dispatcher { + stream.off('readable', done); + stream.off('end', done); + stream.off('error', done); + }); } const buffer = stream.read(Math.min(stream.readableLength, params.size || stream.readableLength)); return { binary: buffer || Buffer.from('') }; } - async close() { + async close(params: channels.StreamCloseParams, progress: Progress): Promise { this._object.stream.destroy(); } } diff --git a/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts b/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts index 42a9804b36..2e295246d6 100644 --- a/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts @@ -20,8 +20,8 @@ import { Dispatcher } from './dispatcher'; import type { BrowserContextDispatcher } from './browserContextDispatcher'; import type { APIRequestContextDispatcher } from './networkDispatchers'; import type { Tracing } from '../trace/recorder/tracing'; -import type { CallMetadata } from '@protocol/callMetadata'; import type * as channels from '@protocol/channels'; +import type { Progress } from '@protocol/progress'; export class TracingDispatcher extends Dispatcher implements channels.TracingChannel { _type_Tracing = true; @@ -35,30 +35,30 @@ export class TracingDispatcher extends Dispatcher { - await this._object.start(params); + async tracingStart(params: channels.TracingTracingStartParams, progress: Progress): Promise { + this._object.start(params); } - async tracingStartChunk(params: channels.TracingTracingStartChunkParams): Promise { - return await this._object.startChunk(params); + async tracingStartChunk(params: channels.TracingTracingStartChunkParams, progress: Progress): Promise { + return await this._object.startChunk(progress, params); } - async tracingGroup(params: channels.TracingTracingGroupParams, metadata: CallMetadata): Promise { + async tracingGroup(params: channels.TracingTracingGroupParams, progress: Progress): Promise { const { name, location } = params; - await this._object.group(name, location, metadata); + this._object.group(name, location, progress.metadata); } - async tracingGroupEnd(params: channels.TracingTracingGroupEndParams): Promise { - await this._object.groupEnd(); + async tracingGroupEnd(params: channels.TracingTracingGroupEndParams, progress: Progress): Promise { + this._object.groupEnd(); } - async tracingStopChunk(params: channels.TracingTracingStopChunkParams): Promise { - const { artifact, entries } = await this._object.stopChunk(params); + async tracingStopChunk(params: channels.TracingTracingStopChunkParams, progress: Progress): Promise { + const { artifact, entries } = await this._object.stopChunk(progress, params); return { artifact: artifact ? ArtifactDispatcher.from(this, artifact) : undefined, entries }; } - async tracingStop(params: channels.TracingTracingStopParams): Promise { - await this._object.stop(); + async tracingStop(params: channels.TracingTracingStopParams, progress: Progress): Promise { + await this._object.stop(progress); } } diff --git a/packages/playwright-core/src/server/dispatchers/webSocketRouteDispatcher.ts b/packages/playwright-core/src/server/dispatchers/webSocketRouteDispatcher.ts index 2e59886335..6d2e5cc2ce 100644 --- a/packages/playwright-core/src/server/dispatchers/webSocketRouteDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/webSocketRouteDispatcher.ts @@ -104,32 +104,32 @@ export class WebSocketRouteDispatcher extends Dispatcher {}); + private async _evaluateAPIRequest(progress: Progress, request: ws.APIRequest) { + await progress.race(this._frame.evaluateExpression(`globalThis.__pwWebSocketDispatch(${JSON.stringify(request)})`).catch(() => {})); } override _onDispose() { diff --git a/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts b/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts index 1595cae757..052b21eec6 100644 --- a/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts @@ -21,6 +21,7 @@ import { SdkObject } from '../instrumentation'; import type { BrowserContextDispatcher } from './browserContextDispatcher'; import type * as channels from '@protocol/channels'; +import type { Progress } from '@protocol/progress'; class WritableStreamSdkObject extends SdkObject { readonly streamOrDirectory: fs.WriteStream | string; @@ -40,27 +41,27 @@ export class WritableStreamDispatcher extends Dispatcher { + async write(params: channels.WritableStreamWriteParams, progress: Progress): Promise { if (typeof this._object.streamOrDirectory === 'string') throw new Error('Cannot write to a directory'); const stream = this._object.streamOrDirectory; - await new Promise((fulfill, reject) => { + await progress.race(new Promise((fulfill, reject) => { stream.write(params.binary, error => { if (error) reject(error); else fulfill(); }); - }); + })); } - async close() { + async close(params: channels.WritableStreamCloseParams, progress: Progress): Promise { if (typeof this._object.streamOrDirectory === 'string') throw new Error('Cannot close a directory'); const stream = this._object.streamOrDirectory; - await new Promise(fulfill => stream.end(fulfill)); + await progress.race(new Promise(fulfill => stream.end(fulfill))); if (this._object.lastModifiedMs) - await fs.promises.utimes(this.path(), new Date(this._object.lastModifiedMs), new Date(this._object.lastModifiedMs)); + await progress.race(fs.promises.utimes(this.path(), new Date(this._object.lastModifiedMs), new Date(this._object.lastModifiedMs))); } path(): string { diff --git a/packages/playwright-core/src/server/trace/recorder/snapshotter.ts b/packages/playwright-core/src/server/trace/recorder/snapshotter.ts index 82e1b99936..5d0139df07 100644 --- a/packages/playwright-core/src/server/trace/recorder/snapshotter.ts +++ b/packages/playwright-core/src/server/trace/recorder/snapshotter.ts @@ -70,7 +70,7 @@ export class Snapshotter { await this._context.safeNonStallingEvaluateInAllFrames(`window["${this._snapshotStreamer}"].reset()`, 'main'); } - async stop() { + stop() { this._started = false; } diff --git a/packages/playwright-core/src/server/trace/recorder/tracing.ts b/packages/playwright-core/src/server/trace/recorder/tracing.ts index 36d2048839..c23e665dfb 100644 --- a/packages/playwright-core/src/server/trace/recorder/tracing.ts +++ b/packages/playwright-core/src/server/trace/recorder/tracing.ts @@ -32,6 +32,7 @@ import { SerializedFS, removeFolders } from '../../utils/fileUtils'; import { HarTracer } from '../../har/harTracer'; import { SdkObject } from '../../instrumentation'; import { Page } from '../../page'; +import { isAbortError } from '../../progress'; import type { SnapshotterBlob, SnapshotterDelegate } from './snapshotter'; import type { NameValue } from '../../../utils/isomorphic/types'; @@ -46,6 +47,7 @@ import type { StackFrame, TracingTracingStopChunkParams } from '@protocol/channe import type * as har from '@trace/har'; import type { FrameSnapshot } from '@trace/snapshot'; import type * as trace from '@trace/trace'; +import type { Progress } from '@protocol/progress'; const version: trace.VERSION = 8; @@ -126,14 +128,15 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps return this._context instanceof BrowserContext ? this._context._browser.sdkLanguage() : this._context.attribution.playwright.options.sdkLanguage; } - async resetForReuse() { + async resetForReuse(progress: Progress) { // Discard previous chunk if any and ignore any errors there. - await this.stopChunk({ mode: 'discard' }).catch(() => {}); - await this.stop(); - await this._snapshotter?.resetForReuse(); + await this.stopChunk(progress, { mode: 'discard' }).catch(() => {}); + await this.stop(progress); + if (this._snapshotter) + await progress.race(this._snapshotter.resetForReuse()); } - async start(options: TracerOptions) { + start(options: TracerOptions) { if (this._isStopping) throw new Error('Cannot start tracing while stopping'); if (this._state) @@ -170,9 +173,9 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps this._harTracer.start({ omitScripts: !options.live }); } - async startChunk(options: { name?: string, title?: string } = {}): Promise<{ traceName: string }> { + async startChunk(progress: Progress, options: { name?: string, title?: string } = {}): Promise<{ traceName: string }> { if (this._state && this._state.recording) - await this.stopChunk({ mode: 'discard' }); + await this.stopChunk(progress, { mode: 'discard' }); if (!this._state) throw new Error('Must start tracing before starting a new chunk'); @@ -218,7 +221,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps return this._state?.groupStack.length ? this._state.groupStack[this._state.groupStack.length - 1] : undefined; } - async group(name: string, location: { file: string, line?: number, column?: number } | undefined, metadata: CallMetadata): Promise { + group(name: string, location: { file: string, line?: number, column?: number } | undefined, metadata: CallMetadata) { if (!this._state) return; const stackFrames: StackFrame[] = []; @@ -296,7 +299,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps state.networkFile = newNetworkFile; } - async stop() { + async stop(progress: Progress) { if (!this._state) return; if (this._isStopping) @@ -306,8 +309,9 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps this._closeAllGroups(); this._harTracer.stop(); this.flushHarEntries(); - await this._fs.syncAndGetError(); - this._state = undefined; + await progress.race(this._fs.syncAndGetError()).finally(() => { + this._state = undefined; + }); } async deleteTmpTracesDir() { @@ -337,7 +341,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps this.groupEnd(); } - async stopChunk(params: TracingTracingStopChunkParams): Promise<{ artifact?: Artifact, entries?: NameValue[] }> { + async stopChunk(progress: Progress, params: TracingTracingStopChunkParams): Promise<{ artifact?: Artifact, entries?: NameValue[] }> { if (this._isStopping) throw new Error(`Tracing is already stopping`); this._isStopping = true; @@ -357,7 +361,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps this._stopScreencast(); if (this._state.options.snapshots) - await this._snapshotter?.stop(); + this._snapshotter?.stop(); this.flushHarEntries(); @@ -391,7 +395,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps this._fs.zip(entries, zipFileName); // Make sure all file operations complete. - const error = await this._fs.syncAndGetError(); + const error = await progress.race(this._fs.syncAndGetError()).catch(e => e); this._isStopping = false; if (this._state) @@ -402,7 +406,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps if (error) { // This check is here because closing the browser removes the tracesDir and tracing // cannot access removed files. Clients are ready for the missing artifact. - if (this._context instanceof BrowserContext && !this._context._browser.isConnected()) + if (!isAbortError(error) && this._context instanceof BrowserContext && !this._context._browser.isConnected()) return {}; throw error; } diff --git a/packages/playwright-core/src/utils/isomorphic/protocolMetainfo.ts b/packages/playwright-core/src/utils/isomorphic/protocolMetainfo.ts index 0f7db29834..a322b9c1de 100644 --- a/packages/playwright-core/src/utils/isomorphic/protocolMetainfo.ts +++ b/packages/playwright-core/src/utils/isomorphic/protocolMetainfo.ts @@ -311,10 +311,20 @@ export const methodMetainfo = new Map([ + 'Playwright', + 'SocksSupport', 'BrowserContext', 'Page', 'Frame', 'Worker', + 'JSHandle', 'ElementHandle', - 'BindingCall' + 'WebSocketRoute', + 'BindingCall', + 'Dialog', + 'Tracing', + 'Stream', + 'WritableStream', + 'CDPSession', + 'JsonPipe' ]); diff --git a/packages/protocol/src/channels.d.ts b/packages/protocol/src/channels.d.ts index 459cc1feef..6e2a4b1662 100644 --- a/packages/protocol/src/channels.d.ts +++ b/packages/protocol/src/channels.d.ts @@ -638,7 +638,7 @@ export interface PlaywrightEventTarget { } export interface PlaywrightChannel extends PlaywrightEventTarget, Channel { _type_Playwright: boolean; - newRequest(params: PlaywrightNewRequestParams, metadata?: CallMetadata): Promise; + newRequest(params: PlaywrightNewRequestParams, progress?: Progress): Promise; } export type PlaywrightNewRequestParams = { baseURL?: string, @@ -839,11 +839,11 @@ export interface SocksSupportEventTarget { } export interface SocksSupportChannel extends SocksSupportEventTarget, Channel { _type_SocksSupport: boolean; - socksConnected(params: SocksSupportSocksConnectedParams, metadata?: CallMetadata): Promise; - socksFailed(params: SocksSupportSocksFailedParams, metadata?: CallMetadata): Promise; - socksData(params: SocksSupportSocksDataParams, metadata?: CallMetadata): Promise; - socksError(params: SocksSupportSocksErrorParams, metadata?: CallMetadata): Promise; - socksEnd(params: SocksSupportSocksEndParams, metadata?: CallMetadata): Promise; + socksConnected(params: SocksSupportSocksConnectedParams, progress?: Progress): Promise; + socksFailed(params: SocksSupportSocksFailedParams, progress?: Progress): Promise; + socksData(params: SocksSupportSocksDataParams, progress?: Progress): Promise; + socksError(params: SocksSupportSocksErrorParams, progress?: Progress): Promise; + socksEnd(params: SocksSupportSocksEndParams, progress?: Progress): Promise; } export type SocksSupportSocksRequestedEvent = { uid: string, @@ -3328,12 +3328,12 @@ export interface JSHandleEventTarget { } export interface JSHandleChannel extends JSHandleEventTarget, Channel { _type_JSHandle: boolean; - dispose(params?: JSHandleDisposeParams, metadata?: CallMetadata): Promise; - evaluateExpression(params: JSHandleEvaluateExpressionParams, metadata?: CallMetadata): Promise; - evaluateExpressionHandle(params: JSHandleEvaluateExpressionHandleParams, metadata?: CallMetadata): Promise; - getPropertyList(params?: JSHandleGetPropertyListParams, metadata?: CallMetadata): Promise; - getProperty(params: JSHandleGetPropertyParams, metadata?: CallMetadata): Promise; - jsonValue(params?: JSHandleJsonValueParams, metadata?: CallMetadata): Promise; + dispose(params?: JSHandleDisposeParams, progress?: Progress): Promise; + evaluateExpression(params: JSHandleEvaluateExpressionParams, progress?: Progress): Promise; + evaluateExpressionHandle(params: JSHandleEvaluateExpressionHandleParams, progress?: Progress): Promise; + getPropertyList(params?: JSHandleGetPropertyListParams, progress?: Progress): Promise; + getProperty(params: JSHandleGetPropertyParams, progress?: Progress): Promise; + jsonValue(params?: JSHandleJsonValueParams, progress?: Progress): Promise; } export type JSHandlePreviewUpdatedEvent = { preview: string, @@ -3909,12 +3909,12 @@ export interface WebSocketRouteEventTarget { } export interface WebSocketRouteChannel extends WebSocketRouteEventTarget, Channel { _type_WebSocketRoute: boolean; - connect(params?: WebSocketRouteConnectParams, metadata?: CallMetadata): Promise; - ensureOpened(params?: WebSocketRouteEnsureOpenedParams, metadata?: CallMetadata): Promise; - sendToPage(params: WebSocketRouteSendToPageParams, metadata?: CallMetadata): Promise; - sendToServer(params: WebSocketRouteSendToServerParams, metadata?: CallMetadata): Promise; - closePage(params: WebSocketRouteClosePageParams, metadata?: CallMetadata): Promise; - closeServer(params: WebSocketRouteCloseServerParams, metadata?: CallMetadata): Promise; + connect(params?: WebSocketRouteConnectParams, progress?: Progress): Promise; + ensureOpened(params?: WebSocketRouteEnsureOpenedParams, progress?: Progress): Promise; + sendToPage(params: WebSocketRouteSendToPageParams, progress?: Progress): Promise; + sendToServer(params: WebSocketRouteSendToServerParams, progress?: Progress): Promise; + closePage(params: WebSocketRouteClosePageParams, progress?: Progress): Promise; + closeServer(params: WebSocketRouteCloseServerParams, progress?: Progress): Promise; } export type WebSocketRouteMessageFromPageEvent = { message: string, @@ -4143,8 +4143,8 @@ export interface DialogEventTarget { } export interface DialogChannel extends DialogEventTarget, Channel { _type_Dialog: boolean; - accept(params: DialogAcceptParams, metadata?: CallMetadata): Promise; - dismiss(params?: DialogDismissParams, metadata?: CallMetadata): Promise; + accept(params: DialogAcceptParams, progress?: Progress): Promise; + dismiss(params?: DialogDismissParams, progress?: Progress): Promise; } export type DialogAcceptParams = { promptText?: string, @@ -4166,12 +4166,12 @@ export interface TracingEventTarget { } export interface TracingChannel extends TracingEventTarget, Channel { _type_Tracing: boolean; - tracingStart(params: TracingTracingStartParams, metadata?: CallMetadata): Promise; - tracingStartChunk(params: TracingTracingStartChunkParams, metadata?: CallMetadata): Promise; - tracingGroup(params: TracingTracingGroupParams, metadata?: CallMetadata): Promise; - tracingGroupEnd(params?: TracingTracingGroupEndParams, metadata?: CallMetadata): Promise; - tracingStopChunk(params: TracingTracingStopChunkParams, metadata?: CallMetadata): Promise; - tracingStop(params?: TracingTracingStopParams, metadata?: CallMetadata): Promise; + tracingStart(params: TracingTracingStartParams, progress?: Progress): Promise; + tracingStartChunk(params: TracingTracingStartChunkParams, progress?: Progress): Promise; + tracingGroup(params: TracingTracingGroupParams, progress?: Progress): Promise; + tracingGroupEnd(params?: TracingTracingGroupEndParams, progress?: Progress): Promise; + tracingStopChunk(params: TracingTracingStopChunkParams, progress?: Progress): Promise; + tracingStop(params?: TracingTracingStopParams, progress?: Progress): Promise; } export type TracingTracingStartParams = { name?: string, @@ -4292,8 +4292,8 @@ export interface StreamEventTarget { } export interface StreamChannel extends StreamEventTarget, Channel { _type_Stream: boolean; - read(params: StreamReadParams, metadata?: CallMetadata): Promise; - close(params?: StreamCloseParams, metadata?: CallMetadata): Promise; + read(params: StreamReadParams, progress?: Progress): Promise; + close(params?: StreamCloseParams, progress?: Progress): Promise; } export type StreamReadParams = { size?: number, @@ -4317,8 +4317,8 @@ export interface WritableStreamEventTarget { } export interface WritableStreamChannel extends WritableStreamEventTarget, Channel { _type_WritableStream: boolean; - write(params: WritableStreamWriteParams, metadata?: CallMetadata): Promise; - close(params?: WritableStreamCloseParams, metadata?: CallMetadata): Promise; + write(params: WritableStreamWriteParams, progress?: Progress): Promise; + close(params?: WritableStreamCloseParams, progress?: Progress): Promise; } export type WritableStreamWriteParams = { binary: Binary, @@ -4341,8 +4341,8 @@ export interface CDPSessionEventTarget { } export interface CDPSessionChannel extends CDPSessionEventTarget, Channel { _type_CDPSession: boolean; - send(params: CDPSessionSendParams, metadata?: CallMetadata): Promise; - detach(params?: CDPSessionDetachParams, metadata?: CallMetadata): Promise; + send(params: CDPSessionSendParams, progress?: Progress): Promise; + detach(params?: CDPSessionDetachParams, progress?: Progress): Promise; } export type CDPSessionEventEvent = { method: string, @@ -5019,8 +5019,8 @@ export interface JsonPipeEventTarget { } export interface JsonPipeChannel extends JsonPipeEventTarget, Channel { _type_JsonPipe: boolean; - send(params: JsonPipeSendParams, metadata?: CallMetadata): Promise; - close(params?: JsonPipeCloseParams, metadata?: CallMetadata): Promise; + send(params: JsonPipeSendParams, progress?: Progress): Promise; + close(params?: JsonPipeCloseParams, progress?: Progress): Promise; } export type JsonPipeMessageEvent = { message: any, diff --git a/packages/protocol/src/protocol.yml b/packages/protocol/src/protocol.yml index 63f30e3dbb..851b15e7ab 100644 --- a/packages/protocol/src/protocol.yml +++ b/packages/protocol/src/protocol.yml @@ -786,6 +786,7 @@ Root: Playwright: type: interface + progress: true initializer: chromium: BrowserType @@ -963,6 +964,7 @@ DebugController: SocksSupport: type: interface + progress: true commands: socksConnected: @@ -2745,6 +2747,7 @@ Worker: JSHandle: type: interface + progress: true initializer: preview: string @@ -3327,6 +3330,7 @@ Route: WebSocketRoute: type: interface + progress: true initializer: url: string @@ -3528,6 +3532,7 @@ BindingCall: Dialog: type: interface + progress: true initializer: page: Page? @@ -3547,6 +3552,7 @@ Dialog: Tracing: type: interface + progress: true commands: @@ -3646,6 +3652,7 @@ Artifact: Stream: type: interface + progress: true commands: @@ -3662,6 +3669,7 @@ Stream: WritableStream: type: interface + progress: true commands: @@ -3676,6 +3684,7 @@ WritableStream: CDPSession: type: interface + progress: true commands: @@ -4134,6 +4143,7 @@ AndroidElementInfo: JsonPipe: type: interface + progress: true commands: send: