Skip to content

Commit

Permalink
reuse isTopFrame
Browse files Browse the repository at this point in the history
  • Loading branch information
Skn0tt committed Oct 18, 2024
1 parent 5aae14e commit 455be13
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/trace-viewer/src/sw/snapshotRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,12 @@ function snapshotScript(...targetIds: (string | undefined)[]) {
document.styleSheets[0].disabled = true;

const search = new URL(window.location.href).searchParams;
const isTopFrame = window.location.pathname.match(/\/page@[a-z0-9]+$/);

if (search.get('pointX') && search.get('pointY')) {
const pointX = +search.get('pointX')!;
const pointY = +search.get('pointY')!;
const hasInputTarget = search.has('hasInputTarget');
const isTopFrame = window.location.pathname.match(/\/page@[a-z0-9]+$/);
const hasTargetElements = targetElements.length > 0;
const roots = document.documentElement ? [document.documentElement] : [];
for (const target of (hasTargetElements ? targetElements : roots)) {
Expand Down Expand Up @@ -439,7 +439,7 @@ function snapshotScript(...targetIds: (string | undefined)[]) {
}


if (window.parent.parent !== window.parent) {
if (isTopFrame) {
for (const canvas of canvasElements) {
const context = canvas.getContext('2d')!;
drawCheckerboard(context, canvas);
Expand Down

0 comments on commit 455be13

Please sign in to comment.