fix(browser): distinguish duplicate screenshot frame events (#612)

* fix(browser): distinguish duplicate screenshot frame events

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>

* test(browser): preserve unknown with-scope loader bindings

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>

---------

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
This commit is contained in:
Rudy Mizrahi Celekli
2026-10-06 02:10:00 +08:00
committed by GitHub
parent 864205570a
commit 1bd641d39f
4 changed files with 67 additions and 3 deletions
+13 -1
View File
@@ -13,7 +13,7 @@ export const emitEvents = (
emitRuntimeEvents(socket, command, port, options);
emitWebMcpEvents(socket, command, port, options);
emitSessionTimeline(socket, command, port, options);
emitCaptureNavigation(socket, command, options);
emitCaptureNavigation(socket, command, port, options);
};
const emitWebMcpEvents = (
@@ -462,8 +462,20 @@ const emitRuntimeEvents = (
const emitCaptureNavigation = (
socket: WebSocket,
command: FakeCdpCommand,
port: number,
options: FakeOptions,
): void => {
if (
command.method === "Page.captureScreenshot" &&
options.screenshotDocumentLoader !== undefined
)
event(socket, "Page.frameNavigated", command.sessionId, {
frame: {
id: "frame-main",
url: `http://127.0.0.1:${String(port)}/app?token=frame-secret`,
loaderId: options.screenshotDocumentLoader,
},
});
const navigationUrl =
command.method === "DOMSnapshot.captureSnapshot"
? options.navigateDuringCaptureUrl
+1
View File
@@ -42,6 +42,7 @@ export interface FakeOptions {
readonly navigateDuringObservationUrl?: string;
readonly navigateDuringCaptureUrl?: string;
readonly navigateDuringScreenshotUrl?: string;
readonly screenshotDocumentLoader?: string;
readonly extraCollections?: boolean;
readonly foreignSessionEvents?: boolean;
readonly redirectToDisallowedOrigin?: boolean;