B2G/gecko/browser/devtools/webconsole/webconsole.js
/**
   * The event handler that is called whenever a user switches a filter on or
   * off.
   *
   * @private
   * @param nsIDOMEvent aEvent
   *        The event that triggered the filter change.
   */
The event handler that is called whenever a user switches a filter on or
off.

@private
@param nsIDOMEvent aEvent
The event that triggered the filter change.
The event handler that is called whenever a user switches a filter on or off . @private @param nsIDOMEvent aEvent The event that triggered the filter change .
function WCF__toggleFilter(aEvent)
  {
    let target = aEvent.target;
    let tagName = target.tagName;
    if (tagName != aEvent.currentTarget.tagName) {
      return;
    }
    switch (tagName) {
      case "toolbarbutton": {
        let originalTarget = aEvent.originalTarget;
        let classes = originalTarget.classList;
        if (originalTarget.localName !== "toolbarbutton") {
          break;
        }
        if (!classes.contains("toolbarbutton-menubutton-button") &&
            originalTarget.getAttribute("type") === "menu-button") {
          break;
        }
        let state = target.getAttribute("checked") !== "true";
        target.setAttribute("checked", state);
        let menuItems = target.querySelectorAll("menuitem");
        for (let i = 0; i < menuItems.length; i++) {
          menuItems[i].setAttribute("checked", state);
          let prefKey = menuItems[i].getAttribute("prefKey");
          this.setFilterState(prefKey, state);
        }
        break;
      }
      case "menuitem": {
        let state = target.getAttribute("checked") !== "true";
        target.setAttribute("checked", state);
        let prefKey = target.getAttribute("prefKey");
        this.setFilterState(prefKey, state);
        if (prefKey == "networkinfo" || prefKey == "network") {
          let checkState = !this.getFilterState("networkinfo") &&
                           !this.getFilterState("network");
          this.document.getElementById("saveBodies").disabled = checkState;
          this.document.getElementById("saveBodiesContextMenu").disabled = checkState;
        }
        let menuPopup = target.parentNode;
        let someChecked = false;
        let menuItem = menuPopup.firstChild;
        while (menuItem) {
          if (menuItem.hasAttribute("prefKey") &&
              menuItem.getAttribute("checked") === "true") {
            someChecked = true;
            break;
          }
          menuItem = menuItem.nextSibling;
        }
        let toolbarButton = menuPopup.parentNode;
        toolbarButton.setAttribute("checked", someChecked);
        break;
      }
    }
  }
function WCF__toggleFilter ( aEvent ) { let target = aEvent . target ; let tagName = target . tagName ; if ( tagName != aEvent . currentTarget . tagName ) { return ; } switch ( tagName ) { case "toolbarbutton" : { let originalTarget = aEvent . originalTarget ; let classes = originalTarget . classList ; if ( originalTarget . localName !== "toolbarbutton" ) { break ; } if ( ! classes . contains ( "toolbarbutton-menubutton-button" ) && originalTarget . getAttribute ( "type" ) === "menu-button" ) { break ; } let state = target . getAttribute ( "checked" ) !== "true" ; target . setAttribute ( "checked" , state ) ; let menuItems = target . querySelectorAll ( "menuitem" ) ; for ( let i = 0 ; i < menuItems . length ; i ++ ) { menuItems [ i ] . setAttribute ( "checked" , state ) ; let prefKey = menuItems [ i ] . getAttribute ( "prefKey" ) ; this . setFilterState ( prefKey , state ) ; } break ; } case "menuitem" : { let state = target . getAttribute ( "checked" ) !== "true" ; target . setAttribute ( "checked" , state ) ; let prefKey = target . getAttribute ( "prefKey" ) ; this . setFilterState ( prefKey , state ) ; if ( prefKey == "networkinfo" || prefKey == "network" ) { let checkState = ! this . getFilterState ( "networkinfo" ) && ! this . getFilterState ( "network" ) ; this . document . getElementById ( "saveBodies" ) . disabled = checkState ; this . document . getElementById ( "saveBodiesContextMenu" ) . disabled = checkState ; } let menuPopup = target . parentNode ; let someChecked = false ; let menuItem = menuPopup . firstChild ; while ( menuItem ) { if ( menuItem . hasAttribute ( "prefKey" ) && menuItem . getAttribute ( "checked" ) === "true" ) { someChecked = true ; break ; } menuItem = menuItem . nextSibling ; } let toolbarButton = menuPopup . parentNode ; toolbarButton . setAttribute ( "checked" , someChecked ) ; break ; } } }
The event handler that is called whenever a user switches a filter on or
 off.
The event handler that is called whenever a user switches a filter on or off .
// Oddly enough, the click event is sent to the menu button when // selecting a menu item with the mouse. Detect this case and bail // out. // This is a filter button with a drop-down. The user clicked the // drop-down, so do nothing. (The menu will automatically appear // without our intervention.) // This is a filter button with a drop-down, and the user clicked the // main part of the button. Go through all the severities and toggle // their associated filters. // Disable the log response and request body if network logging is off. // Adjust the state of the button appropriately.