B2G/gecko/browser/devtools/debugger/debugger-view.js
/**
   * Adds multiple properties to a specified variable.
   * This function handles two types of properties: data properties and
   * accessor properties, as defined in the remote debugger protocol spec.
   *
   * @param object aVar
   *        The parent variable element.
   * @param object aProperties
   *        An object containing the key: descriptor data properties,
   *        specifying the value and/or type & class of the variable,
   *        or 'get' & 'set' accessor properties.
   *        e.g. { "someProp0": { value: 42 },
   *               "someProp1": { value: true },
   *               "someProp2": { value: "nasu" },
   *               "someProp3": { value: { type: "undefined" } },
   *               "someProp4": { value: { type: "null" } },
   *               "someProp5": { value: { type: "object", class: "Object" } },
   *               "someProp6": { get: { type: "object", class: "Function" },
   *                              set: { type: "undefined" } }
   * @return object
   *         The same variable.
   */
Adds multiple properties to a specified variable.
This function handles two types of properties: data properties and
accessor properties, as defined in the remote debugger protocol spec.

@param object aVar
The parent variable element.
@param object aProperties
An object containing the key: descriptor data properties,
specifying the value and/or type & class of the variable,
or 'get' & 'set' accessor properties.
Adds multiple properties to a specified variable . This function handles two types of properties : data properties and accessor properties as defined in the remote debugger protocol spec . @param object aVar The parent variable element . @param object aProperties An object containing the key : descriptor data properties specifying the value and / or type & class of the variable or ' get ' & ' set ' accessor properties .
function DVP__addProperties(aVar, aProperties) {
    for (let i in aProperties) {
      if (Object.getOwnPropertyDescriptor(aProperties, i)) {
        let desc = aProperties[i];
        let value = desc["value"];
        let getter = desc["get"];
        let setter = desc["set"];
        if (value !== undefined) {
          this._addProperty(aVar, [i, value], desc);
        }
        if (getter !== undefined || setter !== undefined) {
          let prop = this._addProperty(aVar, [i]).expand();
          prop.getter = this._addProperty(prop, ["get", getter], desc);
          prop.setter = this._addProperty(prop, ["set", setter], desc);
        }
      }
    }
    return aVar;
  }
function DVP__addProperties ( aVar , aProperties ) { for ( let i in aProperties ) { if ( Object . getOwnPropertyDescriptor ( aProperties , i ) ) { let desc = aProperties [ i ] ; let value = desc [ "value" ] ; let getter = desc [ "get" ] ; let setter = desc [ "set" ] ; if ( value !== undefined ) { this . _addProperty ( aVar , [ i , value ] , desc ) ; } if ( getter !== undefined || setter !== undefined ) { let prop = this . _addProperty ( aVar , [ i ] ) . expand ( ) ; prop . getter = this . _addProperty ( prop , [ "get" , getter ] , desc ) ; prop . setter = this . _addProperty ( prop , [ "set" , setter ] , desc ) ; } } } return aVar ; }
Adds multiple properties to a specified variable.
Adds multiple properties to a specified variable .
// For each property, add it using the passed object key/grip. // Can't use aProperties.hasOwnProperty(i), because it may be overridden. // Get the specified descriptor for current property. // As described in the remote debugger protocol, the value grip must be // contained in a 'value' property. // For accessor property descriptors, the two grips need to be // contained in 'get' and 'set' properties. // Handle data property and accessor property descriptors.