Skip to content

Commit

Permalink
fix: Ignore iframes where access is blocked by CORS
Browse files Browse the repository at this point in the history
Related #105

Prevents `Blocked a frame with origin ... from accessing a cross-origin frame.` errors
  • Loading branch information
Bob Fanger committed Mar 12, 2023
1 parent 7131084 commit afe6fc8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions packages/pixi-panel/src/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ function detect() {
}
if (win.frames) {
for (let i = 0; i < win.frames.length; i += 1) {
if (win.frames[i][varname]) {
return true;
try {
if (win.frames[i][varname]) {
return true;
}
} catch (_) {
// access to iframe was denied
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions packages/pixi-panel/src/pixi-devtools/pixiDevtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ export default function pixiDevtools() {
}
if (win.frames) {
for (let i = 0; i < win.frames.length; i += 1) {
if (win.frames[i][varname]) {
return win.frames[i][varname];
try {
if (win.frames[i][varname]) {
return win.frames[i][varname];
}
} catch (_) {
// access to iframe was denied
}
}
}
Expand Down

0 comments on commit afe6fc8

Please sign in to comment.