Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: do not generate history entries on snapshot switch (#21283)

Pavel Feldmanc42a1205b106
diff --git a/packages/trace-viewer/src/ui/snapshotTab.tsx b/packages/trace-viewer/src/ui/snapshotTab.tsx
index 9aaa4d50ad..1446e4ad43 100644
--- a/packages/trace-viewer/src/ui/snapshotTab.tsx
+++ b/packages/trace-viewer/src/ui/snapshotTab.tsx
@@ -91,7 +91,12 @@ export const SnapshotTab: React.FunctionComponent<{
if (!iframeRef.current)
return;
try {
- iframeRef.current.src = snapshotUrl + (pointX === undefined ? '' : `&pointX=${pointX}&pointY=${pointY}`);
+ const newUrl = snapshotUrl + (pointX === undefined ? '' : `&pointX=${pointX}&pointY=${pointY}`);
+ // Try preventing history entry from being created.
+ if (iframeRef.current.contentWindow)
+ iframeRef.current.contentWindow.location.replace(newUrl);
+ else
+ iframeRef.current.src = newUrl;
} catch (e) {
}
})();