mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix(webdriver): emit CDP events (#12058)
This commit is contained in:
parent
e1a9b85bbe
commit
9afe4246bb
@ -471,6 +471,7 @@ export class BidiFrame extends Frame {
|
||||
targetId: this._id,
|
||||
flatten: true,
|
||||
});
|
||||
await this.browsingContext.subscribe([Bidi.ChromiumBidi.BiDiModule.Cdp]);
|
||||
return new BidiCdpSession(this, sessionId);
|
||||
}
|
||||
|
||||
|
@ -539,6 +539,14 @@ export class BrowsingContext extends EventEmitter<{
|
||||
});
|
||||
}
|
||||
|
||||
@throwIfDisposed<BrowsingContext>(context => {
|
||||
// SAFETY: Disposal implies this exists.
|
||||
return context.#reason!;
|
||||
})
|
||||
async subscribe(events: string[]): Promise<void> {
|
||||
await this.#session.subscribe(events, [this.id]);
|
||||
}
|
||||
|
||||
[disposeSymbol](): void {
|
||||
this.#reason ??=
|
||||
'Browsing context already closed, probably because the user context closed.';
|
||||
|
@ -163,9 +163,10 @@ export class Session
|
||||
// SAFETY: By definition of `disposed`, `#reason` is defined.
|
||||
return session.#reason!;
|
||||
})
|
||||
async subscribe(events: string[]): Promise<void> {
|
||||
async subscribe(events: string[], contexts?: string[]): Promise<void> {
|
||||
await this.send('session.subscribe', {
|
||||
events,
|
||||
contexts,
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user