Merge pull request 'Do not crash even on css rule insertion failure' (#3520) from tusooa/pleroma-fe:tusooa/no-crash-on-bad-style into develop

Reviewed-on: https://git.pleroma.social/pleroma/pleroma-fe/pulls/3520
This commit is contained in:
HJ 2026-07-30 08:11:16 +00:00
commit 7a5a40b237
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1 @@
Do not crash even on css rule insertion failure

View file

@ -59,7 +59,13 @@ export const adoptStyleSheets = throttle(() => {
.sort((a, b) => a.priority - b.priority) .sort((a, b) => a.priority - b.priority)
.map((sheet) => { .map((sheet) => {
const css = new CSSStyleSheet() const css = new CSSStyleSheet()
sheet.rules.forEach((r) => css.insertRule(r)) sheet.rules.forEach((r) => {
try {
css.insertRule(r)
} catch (e) {
console.warn('Error inserting rule:', e, r)
}
})
return css return css
}) })
} else { } else {