B2G/gecko/toolkit/mozapps/extensions/AddonManager.jsm
/**
   * Asynchronously gets all current AddonInstalls optionally limiting to a list
   * of types.
   *
   * @param  aTypes
   *         An optional array of types to retrieve. Each type is a string name
   * @param  aCallback
   *         A callback which will be passed an array of AddonInstalls
   * @throws If the aCallback argument is not specified
   */
Asynchronously gets all current AddonInstalls optionally limiting to a list
of types.

@param  aTypes
An optional array of types to retrieve. Each type is a string name
@param  aCallback
A callback which will be passed an array of AddonInstalls
@throws If the aCallback argument is not specified
Asynchronously gets all current AddonInstalls optionally limiting to a list of types . @param aTypes An optional array of types to retrieve . Each type is a string name @param aCallback A callback which will be passed an array of AddonInstalls @throws If the aCallback argument is not specified
function AMI_getInstallsByTypes(aTypes, aCallback) {
    if (!gStarted)
      throw Components.Exception("AddonManager is not initialized",
                                 Cr.NS_ERROR_NOT_INITIALIZED);
    if (aTypes && !Array.isArray(aTypes))
      throw Components.Exception("aTypes must be an array or null",
                                 Cr.NS_ERROR_INVALID_ARG);
    if (typeof aCallback != "function")
      throw Components.Exception("aCallback must be a function",
                                 Cr.NS_ERROR_INVALID_ARG);
    let installs = [];
    new AsyncObjectCaller(this.providers, "getInstallsByTypes", {
      nextObject: function(aCaller, aProvider) {
        callProvider(aProvider, "getInstallsByTypes", null, aTypes,
                     function(aProviderInstalls) {
          installs = installs.concat(aProviderInstalls);
          aCaller.callNext();
        });
      },
      noMoreObjects: function(aCaller) {
        safeCall(aCallback, installs);
      }
    });
  }
function AMI_getInstallsByTypes ( aTypes , aCallback ) { if ( ! gStarted ) throw Components . Exception ( "AddonManager is not initialized" , Cr . NS_ERROR_NOT_INITIALIZED ) ; if ( aTypes && ! Array . isArray ( aTypes ) ) throw Components . Exception ( "aTypes must be an array or null" , Cr . NS_ERROR_INVALID_ARG ) ; if ( typeof aCallback != "function" ) throw Components . Exception ( "aCallback must be a function" , Cr . NS_ERROR_INVALID_ARG ) ; let installs = [ ] ; new AsyncObjectCaller ( this . providers , "getInstallsByTypes" , { nextObject : function ( aCaller , aProvider ) { callProvider ( aProvider , "getInstallsByTypes" , null , aTypes , function ( aProviderInstalls ) { installs = installs . concat ( aProviderInstalls ) ; aCaller . callNext ( ) ; } ) ; } , noMoreObjects : function ( aCaller ) { safeCall ( aCallback , installs ) ; } } ) ; }
Asynchronously gets all current AddonInstalls optionally limiting to a list
 of types.
Asynchronously gets all current AddonInstalls optionally limiting to a list of types .