B2G/gecko/browser/devtools/webconsole/webconsole.js
/**
   * Handler for the autocompletion results. This method takes
   * the completion result received from the server and updates the UI
   * accordingly.
   *
   * @param number aRequestId
   *        Request ID.
   * @param function [aCallback=null]
   *        Optional, function to invoke when the completion result is received.
   * @param object aMessage
   *        The JSON message which holds the completion results received from
   *        the content process.
   */
Handler for the autocompletion results. This method takes
the completion result received from the server and updates the UI
accordingly.

@param number aRequestId
Request ID.
@param function [aCallback=null]
Optional, function to invoke when the completion result is received.
@param object aMessage
The JSON message which holds the completion results received from
the content process.
Handler for the autocompletion results . This method takes the completion result received from the server and updates the UI accordingly . @param number aRequestId Request ID . @param function [ aCallback = null ] Optional function to invoke when the completion result is received . @param object aMessage The JSON message which holds the completion results received from the content process .
function JST__receiveAutocompleteProperties(aRequestId, aCallback, aMessage)
  {
    let inputNode = this.inputNode;
    let inputValue = inputNode.value;
    if (this.lastCompletion.value == inputValue ||
        aRequestId != this.lastCompletion.requestId) {
      return;
    }
    let matches = aMessage.matches;
    if (!matches.length) {
      this.clearCompletion();
      return;
    }
    let items = matches.map(function(aMatch) {
      return { label: aMatch };
    });
    let popup = this.autocompletePopup;
    popup.setItems(items);
    let completionType = this.lastCompletion.completionType;
    this.lastCompletion = {
      value: inputValue,
      matchProp: aMessage.matchProp,
    };
    if (items.length > 1 && !popup.isOpen) {
      popup.openPopup(inputNode);
    }
    else if (items.length < 2 && popup.isOpen) {
      popup.hidePopup();
    }
    if (items.length == 1) {
      popup.selectedIndex = 0;
    }
    this.onAutocompleteSelect();
    if (completionType != this.COMPLETE_HINT_ONLY && popup.itemCount == 1) {
      this.acceptProposedCompletion();
    }
    else if (completionType == this.COMPLETE_BACKWARD) {
      popup.selectPreviousItem();
    }
    else if (completionType == this.COMPLETE_FORWARD) {
      popup.selectNextItem();
    }
    aCallback && aCallback(this);
  }
function JST__receiveAutocompleteProperties ( aRequestId , aCallback , aMessage ) { let inputNode = this . inputNode ; let inputValue = inputNode . value ; if ( this . lastCompletion . value == inputValue || aRequestId != this . lastCompletion . requestId ) { return ; } let matches = aMessage . matches ; if ( ! matches . length ) { this . clearCompletion ( ) ; return ; } let items = matches . map ( function ( aMatch ) { return { label : aMatch } ; } ) ; let popup = this . autocompletePopup ; popup . setItems ( items ) ; let completionType = this . lastCompletion . completionType ; this . lastCompletion = { value : inputValue , matchProp : aMessage . matchProp , } ; if ( items . length > 1 && ! popup . isOpen ) { popup . openPopup ( inputNode ) ; } else if ( items . length < 2 && popup . isOpen ) { popup . hidePopup ( ) ; } if ( items . length == 1 ) { popup . selectedIndex = 0 ; } this . onAutocompleteSelect ( ) ; if ( completionType != this . COMPLETE_HINT_ONLY && popup . itemCount == 1 ) { this . acceptProposedCompletion ( ) ; } else if ( completionType == this . COMPLETE_BACKWARD ) { popup . selectPreviousItem ( ) ; } else if ( completionType == this . COMPLETE_FORWARD ) { popup . selectNextItem ( ) ; } aCallback && aCallback ( this ) ; }
Handler for the autocompletion results.
Handler for the autocompletion results .