Bug 1308467 - fix fronts/css-properties.js when remote debugging old firefox;r=tromey draft
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 07 Oct 2016 15:03:59 +0200
changeset 422099 52cd75f3993b9e69410f75d942bc9f80c4046d6f
parent 421721 1d7748535fa370332623ac29e50dd19e1ef6133b
child 533261 ef394f13d6775b588806e008ae49db964dd4f7c6
push id31693
push userjdescottes@mozilla.com
push dateFri, 07 Oct 2016 13:06:37 +0000
reviewerstromey
bugs1308467
milestone52.0a1
Bug 1308467 - fix fronts/css-properties.js when remote debugging old firefox;r=tromey MozReview-Commit-ID: 365CiBV8uha
devtools/shared/fronts/css-properties.js
--- a/devtools/shared/fronts/css-properties.js
+++ b/devtools/shared/fronts/css-properties.js
@@ -294,18 +294,20 @@ function normalizeCssData(db) {
         }
       }
     }
 
     // Add "subproperties" information to the css properties if it's
     // missing.
     if (!db.properties.background.subproperties) {
       for (let name in db.properties) {
-        db.properties[name].subproperties =
-          CSS_PROPERTIES_DB.properties[name].subproperties;
+        if (typeof CSS_PROPERTIES_DB.properties[name] === "object") {
+          db.properties[name].subproperties =
+            CSS_PROPERTIES_DB.properties[name].subproperties;
+        }
       }
     }
   }
 
   reattachCssColorValues(db);
 
   return db;
 }
@@ -315,17 +317,17 @@ function normalizeCssData(db) {
  * @param {Object} The CSS database.
  */
 function reattachCssColorValues(db) {
   if (db.properties.color.values[0] === "COLOR") {
     const colors = Object.keys(cssColors);
 
     for (let name in db.properties) {
       const property = db.properties[name];
-      if (property.values[0] === "COLOR") {
+      if (property.values && property.values[0] === "COLOR") {
         property.values.shift();
         property.values = property.values.concat(colors).sort();
       }
     }
   }
 }
 
 module.exports = {