B2G/gecko/browser/devtools/debugger/debugger-view.js
/**
   * Adds a variable to a specified scope.
   * If the optional id is not specified, the variable html node will have a
   * default id set as aScope.id->aName-variable.
   *
   * @param object aScope
   *        The parent scope element.
   * @param string aName
   *        The variable name.
   * @param object aFlags
   *        Optional, contains configurable, enumerable or writable flags.
   * @param string aId
   *        Optional, an id for the variable html node.
   * @return object
   *         The newly created html node representing the added var.
   */
Adds a variable to a specified scope.
If the optional id is not specified, the variable html node will have a
default id set as aScope.id->aName-variable.

@param object aScope
The parent scope element.
@param string aName
The variable name.
@param object aFlags
Optional, contains configurable, enumerable or writable flags.
@param string aId
Optional, an id for the variable html node.
@return object
The newly created html node representing the added var.
Adds a variable to a specified scope . If the optional id is not specified the variable html node will have a default id set as aScope . id - > aName - variable . @param object aScope The parent scope element . @param string aName The variable name . @param object aFlags Optional contains configurable enumerable or writable flags . @param string aId Optional an id for the variable html node . @return object The newly created html node representing the added var .
function DVP__addVar(aScope, aName, aFlags, aId) {
    if (!aScope) {
      return null;
    }
    aId = aId || (aScope.id + "->" + aName + "-variable");
    let element = this._createPropertyElement(aName, aId, "variable",
                                              aScope.getElementsByClassName("details")[0]);
    if (!element) {
      return null;
    }
    element._identifier = aName;
    element.setGrip = this._setGrip.bind(this, element);
    element.addProperties = this._addProperties.bind(this, element);
    element.refresh(function() {
      let separatorLabel = document.createElement("label");
      let valueLabel = document.createElement("label");
      let title = element.getElementsByClassName("title")[0];
      this._setAttributes(element, aName, aFlags);
      separatorLabel.className = "plain";
      separatorLabel.setAttribute("value", ":");
      valueLabel.className = "value plain";
      valueLabel.addEventListener("click", this._activateElementInputMode.bind({
        scope: this,
        element: element,
        valueLabel: valueLabel
      }));
      Object.defineProperty(element, "token", {
        value: aName,
        writable: false,
        enumerable: true,
        configurable: true
      });
      title.appendChild(separatorLabel);
      title.appendChild(valueLabel);
      this._saveHierarchy({
        parent: aScope,
        element: element,
        valueLabel: valueLabel
      });
    }.bind(this));
    return element;
  }
function DVP__addVar ( aScope , aName , aFlags , aId ) { if ( ! aScope ) { return null ; } aId = aId || ( aScope . id + "->" + aName + "-variable" ) ; let element = this . _createPropertyElement ( aName , aId , "variable" , aScope . getElementsByClassName ( "details" ) [ 0 ] ) ; if ( ! element ) { return null ; } element . _identifier = aName ; element . setGrip = this . _setGrip . bind ( this , element ) ; element . addProperties = this . _addProperties . bind ( this , element ) ; element . refresh ( function ( ) { let separatorLabel = document . createElement ( "label" ) ; let valueLabel = document . createElement ( "label" ) ; let title = element . getElementsByClassName ( "title" ) [ 0 ] ; this . _setAttributes ( element , aName , aFlags ) ; separatorLabel . className = "plain" ; separatorLabel . setAttribute ( "value" , ":" ) ; valueLabel . className = "value plain" ; valueLabel . addEventListener ( "click" , this . _activateElementInputMode . bind ( { scope : this , element : element , valueLabel : valueLabel } ) ) ; Object . defineProperty ( element , "token" , { value : aName , writable : false , enumerable : true , configurable : true } ) ; title . appendChild ( separatorLabel ) ; title . appendChild ( valueLabel ) ; this . _saveHierarchy ( { parent : aScope , element : element , valueLabel : valueLabel } ) ; } . bind ( this ) ) ; return element ; }
Adds a variable to a specified scope.
Adds a variable to a specified scope .
// Make sure the scope container exists. // Compute the id of the element if not specified. // Contains generic nodes and functionality. // Make sure the element was created successfully. /**
     * @see DebuggerView.Properties._setGrip
     */ /**
     * @see DebuggerView.Properties._addProperties
     */ // Setup the additional elements specific for a variable node. // Use attribute flags to specify the element type and tooltip text. // Separator between the variable name and its value. // The variable information (type, class and/or value). // Handle the click event when pressing the element value label. // Maintain the symbolic name of the variable. // Remember a simple hierarchy between the parent and the element. // Return the element for later use if necessary.