From 110351aaf5b2b6f7fc3ff4e5af990b3de5cf9195 Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Tue, 30 Apr 2024 08:23:25 +0200 Subject: [PATCH] chore: pass down config form CDP connection to BiDi (#12366) --- packages/puppeteer-core/src/bidi/BidiOverCdp.ts | 7 ++++++- packages/puppeteer-core/src/cdp/Connection.ts | 12 +++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/puppeteer-core/src/bidi/BidiOverCdp.ts b/packages/puppeteer-core/src/bidi/BidiOverCdp.ts index 6f58d3e6a93..1f9dc7a98a7 100644 --- a/packages/puppeteer-core/src/bidi/BidiOverCdp.ts +++ b/packages/puppeteer-core/src/bidi/BidiOverCdp.ts @@ -47,7 +47,12 @@ export async function connectBidiOverCdp( // Forwards a BiDi event sent by BidiServer to Puppeteer. pptrTransport.onmessage(JSON.stringify(message)); }); - const pptrBiDiConnection = new BidiConnection(cdp.url(), pptrTransport); + const pptrBiDiConnection = new BidiConnection( + cdp.url(), + pptrTransport, + cdp.delay, + cdp.timeout + ); const bidiServer = await BidiMapper.BidiServer.createAndStart( transportBiDi, cdpConnectionAdapter, diff --git a/packages/puppeteer-core/src/cdp/Connection.ts b/packages/puppeteer-core/src/cdp/Connection.ts index 9495650f7b5..05eb6ba9a30 100644 --- a/packages/puppeteer-core/src/cdp/Connection.ts +++ b/packages/puppeteer-core/src/cdp/Connection.ts @@ -26,11 +26,6 @@ import {CdpCDPSession} from './CDPSession.js'; const debugProtocolSend = debug('puppeteer:protocol:SEND ►'); const debugProtocolReceive = debug('puppeteer:protocol:RECV ◀'); -/** - * @public - */ -export type {ConnectionTransport, ProtocolMapping}; - /** * @public */ @@ -64,6 +59,13 @@ export class Connection extends EventEmitter { return session.connection(); } + /** + * @internal + */ + get delay(): number { + return this.#delay; + } + get timeout(): number { return this.#timeout; }