mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: emit CDP event only on CdpSession (#11393)
This commit is contained in:
parent
8644744dce
commit
923434bd56
@ -221,6 +221,12 @@ export class BidiConnection extends EventEmitter<BidiEvents> {
|
||||
);
|
||||
return;
|
||||
case 'event':
|
||||
if (isCdpEvent(object)) {
|
||||
cdpSessions
|
||||
.get(object.params.session)
|
||||
?.emit(object.params.event, object.params.params);
|
||||
return;
|
||||
}
|
||||
this.#maybeEmitOnContext(object);
|
||||
// SAFETY: We know the method and parameter still match here.
|
||||
this.emit(
|
||||
@ -244,10 +250,6 @@ export class BidiConnection extends EventEmitter<BidiEvents> {
|
||||
event.params.source.context !== undefined
|
||||
) {
|
||||
context = this.#browsingContexts.get(event.params.source.context);
|
||||
} else if (isCdpEvent(event)) {
|
||||
cdpSessions
|
||||
.get(event.params.session)
|
||||
?.emit(event.params.event, event.params.params);
|
||||
}
|
||||
context?.emit(event.method, event.params);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user