mirror of
https://github.com/kevinveenbirkenbach/homepage.veen.world.git
synced 2026-09-11 21:46:47 +00:00
fix(iframe): stop observing when the iframe's first location is cross-origin
observeIframeNavigation read iframe.contentWindow.location.href once, outside any guard. For a cross-origin iframe that read throws a SecurityError, which escaped as an uncaught exception and never reached the polling loop, whose own read of the same property is already guarded. The first read is now guarded as well, and the observer returns because it cannot follow a cross-origin frame anyway. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -168,7 +168,12 @@ function observeIframeNavigation() {
|
||||
const iframe = mainElement.querySelector("iframe");
|
||||
if (!iframe || !iframe.contentWindow) return;
|
||||
|
||||
let lastUrl = iframe.contentWindow.location.href;
|
||||
let lastUrl;
|
||||
try {
|
||||
lastUrl = iframe.contentWindow.location.href;
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
||||
setInterval(() => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user