Bug 1475208 - (Part 6) Cast property values to string before writing to store and stylesheet. r=gl
MozReview-Commit-ID: 7AFkD12TbOE
--- a/devtools/client/inspector/fonts/fonts.js
+++ b/devtools/client/inspector/fonts/fonts.js
@@ -749,35 +749,37 @@ class FontInspector {
* from the Font Editor. This handler calls the appropriate method to preview the
* changes on the page and update the store.
*
* If the property parameter is not a recognized CSS font property name, assume it's a
* variable font axis name.
*
* @param {String} property
* CSS font property name or axis name
- * @param {String} value
- * CSS font property numeric value or axis value
+ * @param {String|Number} value
+ * CSS font property value or axis value
* @param {String|undefined} fromUnit
* Optional CSS unit to convert from
* @param {String|undefined} toUnit
* Optional CSS unit to convert to
*/
async onPropertyChange(property, value, fromUnit, toUnit) {
if (FONT_PROPERTIES.includes(property)) {
let unit = fromUnit;
if (toUnit && fromUnit) {
value = await this.convertUnits(value, fromUnit, toUnit);
unit = toUnit;
}
- this.onFontPropertyUpdate(property, value, unit);
+ // Cast value to string.
+ this.onFontPropertyUpdate(property, value + "", unit);
} else {
- this.onAxisUpdate(property, value);
+ // Cast axis value to string.
+ this.onAxisUpdate(property, value + "");
}
}
/**
* Handler for "property-value-updated" event emitted from the rule view whenever a
* property value changes. Ignore changes to properties unrelated to the font editor.
*
* @param {Object} eventData