From fb0275608debbd07acdc4f2aed0f197f1e864bff Mon Sep 17 00:00:00 2001 From: Ivan Gabriele Date: Tue, 28 May 2024 23:44:26 +0200 Subject: [PATCH] fix(components): ignore external domain stylesheets in NewWindow styles copying --- src/components/NewWindow.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/NewWindow.tsx b/src/components/NewWindow.tsx index 1bd4cd6a4..4cfb5ba7d 100644 --- a/src/components/NewWindow.tsx +++ b/src/components/NewWindow.tsx @@ -276,7 +276,12 @@ function onCopyStyles(source: Document, target: Document | undefined): void { try { rules = styleSheet.cssRules } catch (err) { - console.error(err) + // An error here most likely happens when trying to access stylesheets from other domains, + // which is a CORS violation and should be ignored. + // eslint-disable-next-line no-console + console.debug(err) + + return } if (rules) { // IE11 is very slow for appendChild, so use plain string here