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:
+13
-1
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user