B2G/gecko/browser/devtools/webconsole/webconsole.js
/**
   * Log network event.
   *
   * @param object aActorId
   *        The network event actor ID to log.
   * @return nsIDOMElement|undefined
   *         The message element to display in the Web Console output.
   */
Log network event.
@param object aActorId
The network event actor ID to log.
@return nsIDOMElement|undefined
The message element to display in the Web Console output.
Log network event . @param object aActorId The network event actor ID to log . @return nsIDOMElement|undefined The message element to display in the Web Console output .
function WCF_logNetEvent(aActorId)
  {
    let networkInfo = this._networkRequests[aActorId];
    if (!networkInfo) {
      return;
    }
    let request = networkInfo.request;
    let msgNode = this.document.createElementNS(XUL_NS, "hbox");
    let methodNode = this.document.createElementNS(XUL_NS, "label");
    methodNode.setAttribute("value", request.method);
    methodNode.classList.add("webconsole-msg-body-piece");
    msgNode.appendChild(methodNode);
    let linkNode = this.document.createElementNS(XUL_NS, "hbox");
    linkNode.flex = 1;
    linkNode.classList.add("webconsole-msg-body-piece");
    linkNode.classList.add("webconsole-msg-link");
    msgNode.appendChild(linkNode);
    let urlNode = this.document.createElementNS(XUL_NS, "label");
    urlNode.flex = 1;
    urlNode.setAttribute("crop", "center");
    urlNode.setAttribute("title", request.url);
    urlNode.setAttribute("tooltiptext", request.url);
    urlNode.setAttribute("value", request.url);
    urlNode.classList.add("hud-clickable");
    urlNode.classList.add("webconsole-msg-body-piece");
    urlNode.classList.add("webconsole-msg-url");
    linkNode.appendChild(urlNode);
    let severity = SEVERITY_LOG;
    let mixedRequest =
      WebConsoleUtils.isMixedHTTPSRequest(request.url, this.contentLocation);
    if (mixedRequest) {
      urlNode.classList.add("webconsole-mixed-content");
      this.makeMixedContentNode(linkNode);
      severity = SEVERITY_WARNING;
    }
    let statusNode = this.document.createElementNS(XUL_NS, "label");
    statusNode.setAttribute("value", "");
    statusNode.classList.add("hud-clickable");
    statusNode.classList.add("webconsole-msg-body-piece");
    statusNode.classList.add("webconsole-msg-status");
    linkNode.appendChild(statusNode);
    let clipboardText = request.method + " " + request.url;
    let messageNode = this.createMessageNode(CATEGORY_NETWORK, severity,
                                             msgNode, null, null, clipboardText);
    messageNode._connectionId = aActorId;
    messageNode.url = request.url;
    this.makeOutputMessageLink(messageNode, function WCF_net_message_link() {
      if (!messageNode._panelOpen) {
        this.openNetworkPanel(messageNode, networkInfo);
      }
    }.bind(this));
    networkInfo.node = messageNode;
    this._updateNetMessage(aActorId);
    return messageNode;
  }
function WCF_logNetEvent ( aActorId ) { let networkInfo = this . _networkRequests [ aActorId ] ; if ( ! networkInfo ) { return ; } let request = networkInfo . request ; let msgNode = this . document . createElementNS ( XUL_NS , "hbox" ) ; let methodNode = this . document . createElementNS ( XUL_NS , "label" ) ; methodNode . setAttribute ( "value" , request . method ) ; methodNode . classList . add ( "webconsole-msg-body-piece" ) ; msgNode . appendChild ( methodNode ) ; let linkNode = this . document . createElementNS ( XUL_NS , "hbox" ) ; linkNode . flex = 1 ; linkNode . classList . add ( "webconsole-msg-body-piece" ) ; linkNode . classList . add ( "webconsole-msg-link" ) ; msgNode . appendChild ( linkNode ) ; let urlNode = this . document . createElementNS ( XUL_NS , "label" ) ; urlNode . flex = 1 ; urlNode . setAttribute ( "crop" , "center" ) ; urlNode . setAttribute ( "title" , request . url ) ; urlNode . setAttribute ( "tooltiptext" , request . url ) ; urlNode . setAttribute ( "value" , request . url ) ; urlNode . classList . add ( "hud-clickable" ) ; urlNode . classList . add ( "webconsole-msg-body-piece" ) ; urlNode . classList . add ( "webconsole-msg-url" ) ; linkNode . appendChild ( urlNode ) ; let severity = SEVERITY_LOG ; let mixedRequest = WebConsoleUtils . isMixedHTTPSRequest ( request . url , this . contentLocation ) ; if ( mixedRequest ) { urlNode . classList . add ( "webconsole-mixed-content" ) ; this . makeMixedContentNode ( linkNode ) ; severity = SEVERITY_WARNING ; } let statusNode = this . document . createElementNS ( XUL_NS , "label" ) ; statusNode . setAttribute ( "value" , "" ) ; statusNode . classList . add ( "hud-clickable" ) ; statusNode . classList . add ( "webconsole-msg-body-piece" ) ; statusNode . classList . add ( "webconsole-msg-status" ) ; linkNode . appendChild ( statusNode ) ; let clipboardText = request . method + " " + request . url ; let messageNode = this . createMessageNode ( CATEGORY_NETWORK , severity , msgNode , null , null , clipboardText ) ; messageNode . _connectionId = aActorId ; messageNode . url = request . url ; this . makeOutputMessageLink ( messageNode , function WCF_net_message_link ( ) { if ( ! messageNode . _panelOpen ) { this . openNetworkPanel ( messageNode , networkInfo ) ; } } . bind ( this ) ) ; networkInfo . node = messageNode ; this . _updateNetMessage ( aActorId ) ; return messageNode ; }
Log network event.
Log network event .
// If we define a SEVERITY_SECURITY in the future, switch this to // SEVERITY_SECURITY.