fix(browser): scope CDP events and fail closed

This commit is contained in:
morluto
2026-07-14 04:53:29 +00:00
parent 2c1ceabbf1
commit 5279d7755c
5 changed files with 106 additions and 38 deletions
+4 -3
View File
@@ -64,9 +64,10 @@ export const capturePage = async (
): Promise<WebPageInspection> => {
const allowedOrigins = new Set(context.input.allowed_origins);
const events = new CdpCaptureEvents(context.input, allowedOrigins);
const removeListener = context.connection.onEvent((event) =>
events.ingest(event),
);
const removeListener = context.connection.onEvent((event) => {
if (event.sessionId !== context.sessionId) return;
events.ingest(event);
});
const state: CaptureState = {
context,
events,