Bug 1475208 - (Part 6) Cast property values to string before writing to store and stylesheet. r=gl draft
authorRazvan Caliman <rcaliman@mozilla.com>
Fri, 03 Aug 2018 11:37:14 +0200
changeset 827674 e3e1554fe62a6aef919bb6ae55b6ee80243e37ff
parent 827673 2f15451b9a9a85b3fca1965ec13e0d72523a4464
push id118557
push userbmo:rcaliman@mozilla.com
push dateWed, 08 Aug 2018 16:44:17 +0000
reviewersgl
bugs1475208
milestone63.0a1
Bug 1475208 - (Part 6) Cast property values to string before writing to store and stylesheet. r=gl MozReview-Commit-ID: 7AFkD12TbOE
devtools/client/inspector/fonts/fonts.js
--- 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