From f35b2f4d3d83e5e1c4606e47e3735f5990993366 Mon Sep 17 00:00:00 2001 From: roytam1 Date: Fri, 28 Jun 2024 22:37:19 +0800 Subject: [PATCH] devtools: DOMUtils.getCSSValuesForProperty() and DOMUtils.getSubpropertiesForCSSProperty() can fail, wrap them in try-catch blocks --- devtools/server/actors/css-properties.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/devtools/server/actors/css-properties.js b/devtools/server/actors/css-properties.js index b22d8005fa..5f47fca865 100644 --- a/devtools/server/actors/css-properties.js +++ b/devtools/server/actors/css-properties.js @@ -61,13 +61,19 @@ function generateCssProperties() { } // Don't send colors over RDP, these will be re-attached by the front. - let values = DOMUtils.getCSSValuesForProperty(name); + let values = ""; + try { + values = DOMUtils.getCSSValuesForProperty(name); + } catch(e) {} if (values.includes("aliceblue")) { values = values.filter(x => !colors.includes(x)); values.unshift("COLOR"); } - let subproperties = DOMUtils.getSubpropertiesForCSSProperty(name); + let subproperties = []; + try { + subproperties = DOMUtils.getSubpropertiesForCSSProperty(name); + } catch(e) {} // In order to maintain any backwards compatible changes when debugging older // clients, take the definition from the static CSS properties database, and fill it