From 32f8be649d5a62d31cede1b0eec73e4657d64e79 Mon Sep 17 00:00:00 2001 From: kuuuube Date: Tue, 31 Dec 2024 18:45:55 -0500 Subject: [PATCH] Make sanitizer fail entirely on any errors --- ext/js/core/utilities.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/ext/js/core/utilities.js b/ext/js/core/utilities.js index 4166972352..7a0040182c 100644 --- a/ext/js/core/utilities.js +++ b/ext/js/core/utilities.js @@ -16,8 +16,6 @@ * along with this program. If not, see . */ -import {log} from './log.js'; - /** * Converts any string into a form that can be passed into the RegExp constructor. @@ -271,15 +269,7 @@ export function promiseTimeout(delay) { * @returns {string} */ export function sanitizeCSS(css) { - let sanitizer; - // As of 2023/03/xx, all latest browser versions support this but some forks may lag behind - try { - sanitizer = new CSSStyleSheet(); - } catch (e) { - log.log('Failed to sanitize dictionary styles'); - log.warn(e); - return css; - } + const sanitizer = new CSSStyleSheet(); sanitizer.replaceSync(css); return [...sanitizer.cssRules].map((rule) => rule.cssText || '').join('\n'); }