Skip to content

Commit

Permalink
fix: catch access stylesheet error
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Sep 22, 2024
1 parent 539f3bc commit bbc2bef
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions apps/renderer/src/components/common/ShadowDOM.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,16 @@ function getLinkedStaticStyleSheets() {
const hasCache = cacheCssTextMap[sheet.href]
if (!hasCache) {
if (!sheet.href) continue
const rules = sheet.cssRules || sheet.rules
let cssText = ""
for (const rule of rules) {
cssText += rule.cssText
try {
const rules = sheet.cssRules || sheet.rules
let cssText = ""
for (const rule of rules) {
cssText += rule.cssText
}
cacheCssTextMap[sheet.href] = cssText
} catch (err) {
console.error("Failed to get cssText for", sheet.href, err)
}

cacheCssTextMap[sheet.href] = cssText
}

cssArray.push({
Expand Down

0 comments on commit bbc2bef

Please sign in to comment.