B2G/gecko/toolkit/mozapps/extensions/AddonManager.jsm
/**
   * Checks whether a particular source is allowed to install add-ons of a
   * given mimetype.
   *
   * @param  aMimetype
   *         The mimetype of the add-on
   * @param  aURI
   *         The optional nsIURI of the source
   * @return true if the source is allowed to install this mimetype
   */
Checks whether a particular source is allowed to install add-ons of a
given mimetype.

@param  aMimetype
The mimetype of the add-on
@param  aURI
The optional nsIURI of the source
@return true if the source is allowed to install this mimetype
Checks whether a particular source is allowed to install add - ons of a given mimetype . @param aMimetype The mimetype of the add - on @param aURI The optional nsIURI of the source @return true if the source is allowed to install this mimetype
function AMI_isInstallAllowed(aMimetype, aURI) {
    if (!gStarted)
      throw Components.Exception("AddonManager is not initialized",
                                 Cr.NS_ERROR_NOT_INITIALIZED);
    if (!aMimetype || typeof aMimetype != "string")
      throw Components.Exception("aMimetype must be a non-empty string",
                                 Cr.NS_ERROR_INVALID_ARG);
    if (aURI && !(aURI instanceof Ci.nsIURI))
      throw Components.Exception("aURI must be a nsIURI or null",
                                 Cr.NS_ERROR_INVALID_ARG);
    let providers = this.providers.slice(0);
    for (let provider of providers) {
      if (callProvider(provider, "supportsMimetype", false, aMimetype) &&
          callProvider(provider, "isInstallAllowed", null, aURI))
        return true;
    }
    return false;
  }
function AMI_isInstallAllowed ( aMimetype , aURI ) { if ( ! gStarted ) throw Components . Exception ( "AddonManager is not initialized" , Cr . NS_ERROR_NOT_INITIALIZED ) ; if ( ! aMimetype || typeof aMimetype != "string" ) throw Components . Exception ( "aMimetype must be a non-empty string" , Cr . NS_ERROR_INVALID_ARG ) ; if ( aURI && ! ( aURI instanceof Ci . nsIURI ) ) throw Components . Exception ( "aURI must be a nsIURI or null" , Cr . NS_ERROR_INVALID_ARG ) ; let providers = this . providers . slice ( 0 ) ; for ( let provider of providers ) { if ( callProvider ( provider , "supportsMimetype" , false , aMimetype ) && callProvider ( provider , "isInstallAllowed" , null , aURI ) ) return true ; } return false ; }
Checks whether a particular source is allowed to install add-ons of a
 given mimetype.
Checks whether a particular source is allowed to install add - ons of a given mimetype .