B2G/gecko/browser/devtools/commandline/CmdAddon.jsm
/**
     * Resolves the promise which is the scope (this) of this function, filling
     * it with an HTML representation of the passed add-ons.
     */
Resolves the promise which is the scope (this) of this function, filling
it with an HTML representation of the passed add-ons.
Resolves the promise which is the scope ( this ) of this function filling it with an HTML representation of the passed add - ons .
function list(aType, aAddons) {
      if (!aAddons.length) {
        this.resolve(gcli.lookup("addonNoneOfType"));
      }
      let enabledAddons = [];
      let disabledAddons = [];
      aAddons.forEach(function(aAddon) {
        if (aAddon.isActive) {
          enabledAddons.push(aAddon);
        } else {
          disabledAddons.push(aAddon);
        }
      });
      let header;
      switch(aType) {
        case "dictionary":
          header = gcli.lookup("addonListDictionaryHeading");
          break;
        case "extension":
          header = gcli.lookup("addonListExtensionHeading");
          break;
        case "locale":
          header = gcli.lookup("addonListLocaleHeading");
          break;
        case "plugin":
          header = gcli.lookup("addonListPluginHeading");
          break;
        case "theme":
          header = gcli.lookup("addonListThemeHeading");
        case "all":
          header = gcli.lookup("addonListAllHeading");
          break;
        default:
          header = gcli.lookup("addonListUnknownHeading");
      }
      this.resolve(header +
        "<ol>" +
        enabledAddons.sort(compareAddonNames).map(representEnabledAddon).join("") +
        disabledAddons.sort(compareAddonNames).map(representDisabledAddon).join("") +
        "</ol>");
    }
function list ( aType , aAddons ) { if ( ! aAddons . length ) { this . resolve ( gcli . lookup ( "addonNoneOfType" ) ) ; } let enabledAddons = [ ] ; let disabledAddons = [ ] ; aAddons . forEach ( function ( aAddon ) { if ( aAddon . isActive ) { enabledAddons . push ( aAddon ) ; } else { disabledAddons . push ( aAddon ) ; } } ) ; let header ; switch ( aType ) { case "dictionary" : header = gcli . lookup ( "addonListDictionaryHeading" ) ; break ; case "extension" : header = gcli . lookup ( "addonListExtensionHeading" ) ; break ; case "locale" : header = gcli . lookup ( "addonListLocaleHeading" ) ; break ; case "plugin" : header = gcli . lookup ( "addonListPluginHeading" ) ; break ; case "theme" : header = gcli . lookup ( "addonListThemeHeading" ) ; case "all" : header = gcli . lookup ( "addonListAllHeading" ) ; break ; default : header = gcli . lookup ( "addonListUnknownHeading" ) ; } this . resolve ( header + "<ol>" + enabledAddons . sort ( compareAddonNames ) . map ( representEnabledAddon ) . join ( "" ) + disabledAddons . sort ( compareAddonNames ) . map ( representDisabledAddon ) . join ( "" ) + "</ol>" ) ; }
Resolves the promise which is the scope (this) of this function, filling
 it with an HTML representation of the passed add-ons.
Resolves the promise which is the scope ( this ) of this function filling it with an HTML representation of the passed add - ons .
// Separate the enabled add-ons from the disabled ones. // Map and sort the add-ons, and create an HTML list.