Bug 881480: Add ownSymbols to onPrototypeAndProperties; r?ochameau draft
authorManish Goregaokar <manishearth@gmail.com>
Thu, 16 Feb 2017 19:06:22 -0800
changeset 485707 c1f7ce420495014e3e5216c1087caef74ef0169a
parent 484187 1060668405a9399774c205430de4a7001d3f27ac
child 546098 7b81b65c1cd45c76aab8754780119387e52c8fbd
push id45822
push userbmo:manishearth@gmail.com
push dateFri, 17 Feb 2017 03:07:56 +0000
reviewersochameau
bugs881480
milestone54.0a1
Bug 881480: Add ownSymbols to onPrototypeAndProperties; r?ochameau MozReview-Commit-ID: 7Mzg1UPOYcY
devtools/server/actors/object.js
--- a/devtools/server/actors/object.js
+++ b/devtools/server/actors/object.js
@@ -245,33 +245,41 @@ ObjectActor.prototype = {
   },
 
   /**
    * Handle a protocol request to provide the prototype and own properties of
    * the object.
    */
   onPrototypeAndProperties: function () {
     let ownProperties = Object.create(null);
+    let ownSymbols = [];
     let names;
+    let symbols;
     try {
       names = this.obj.getOwnPropertyNames();
+      symbols = this.obj.getOwnPropertySymbols();
     } catch (ex) {
       // The above can throw if this.obj points to a dead object.
       // TODO: we should use Cu.isDeadWrapper() - see bug 885800.
       return { from: this.actorID,
                prototype: this.hooks.createValueGrip(null),
                ownProperties: ownProperties,
+               ownSymbols: ownSymbols,
                safeGetterValues: Object.create(null) };
     }
     for (let name of names) {
       ownProperties[name] = this._propertyDescriptor(name);
     }
+    for (let sym of symbols) {
+      ownSymbols.push({"name": sym.toString(), "descriptor": this._propertyDescriptor(sym)});
+    }
     return { from: this.actorID,
              prototype: this.hooks.createValueGrip(this.obj.proto),
              ownProperties: ownProperties,
+             ownSymbols: ownSymbols,
              safeGetterValues: this._findSafeGetterValues(names) };
   },
 
   /**
    * Find the safe getter values for the current Debugger.Object, |this.obj|.
    *
    * @private
    * @param array ownProperties