From 73ddd616484c09f0fa290e1ac674af34508f1a67 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Mon, 24 Feb 2025 00:16:37 +0800 Subject: [PATCH] fix(iframe): handle URL origin check errors gracefully - Add try-catch block to prevent errors during URL origin comparison - Fallback to opening link in new tab if origin check fails --- src/contentScripts/views/App.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/contentScripts/views/App.vue b/src/contentScripts/views/App.vue index 45477ea3..de37c1ff 100644 --- a/src/contentScripts/views/App.vue +++ b/src/contentScripts/views/App.vue @@ -254,7 +254,13 @@ function openIframeDrawer(url: string) { const currentUrl = new URL(location.href) const destination = new URL(url) - if (!isSameOrigin(currentUrl, destination)) { + try { + if (!isSameOrigin(currentUrl, destination)) { + openLinkToNewTab(url) + return + } + } + catch { openLinkToNewTab(url) return }