B2G/gecko/toolkit/mozapps/extensions/XPIProvider.jsm
/**
   * Calls a bootstrap method for an add-on.
   *
   * @param  aId
   *         The ID of the add-on
   * @param  aVersion
   *         The version of the add-on
   * @param  aType
   *         The type for the add-on
   * @param  aFile
   *         The nsIFile for the add-on
   * @param  aMethod
   *         The name of the bootstrap method to call
   * @param  aReason
   *         The reason flag to pass to the bootstrap's startup method
   */
Calls a bootstrap method for an add-on.
Calls a bootstrap method for an add - on .
function XPI_callBootstrapMethod(aId, aVersion, aType, aFile,
                                                        aMethod, aReason) {
    if (Services.appinfo.inSafeMode)
      return;
    if (aMethod == "startup")
      Components.manager.addBootstrappedManifestLocation(aFile);
    try {
      if (aType == "locale")
         return;
      if (!(aId in this.bootstrapScopes))
        this.loadBootstrapScope(aId, aFile, aVersion, aType);
      if (!(aMethod in this.bootstrapScopes[aId])) {
        WARN("Add-on " + aId + " is missing bootstrap method " + aMethod);
        return;
      }
      let params = {
        id: aId,
        version: aVersion,
        installPath: aFile.clone(),
        resourceURI: getURIForResourceInFile(aFile, "")
      };
      LOG("Calling bootstrap method " + aMethod + " on " + aId + " version " +
          aVersion);
      try {
        this.bootstrapScopes[aId][aMethod](params, aReason);
      }
      catch (e) {
        WARN("Exception running bootstrap method " + aMethod + " on " +
             aId, e);
      }
    }
    finally {
      if (aMethod == "shutdown")
        Components.manager.removeBootstrappedManifestLocation(aFile);
    }
  }
function XPI_callBootstrapMethod ( aId , aVersion , aType , aFile , aMethod , aReason ) { if ( Services . appinfo . inSafeMode ) return ; if ( aMethod == "startup" ) Components . manager . addBootstrappedManifestLocation ( aFile ) ; try { if ( aType == "locale" ) return ; if ( ! ( aId in this . bootstrapScopes ) ) this . loadBootstrapScope ( aId , aFile , aVersion , aType ) ; if ( ! ( aMethod in this . bootstrapScopes [ aId ] ) ) { WARN ( "Add-on " + aId + " is missing bootstrap method " + aMethod ) ; return ; } let params = { id : aId , version : aVersion , installPath : aFile . clone ( ) , resourceURI : getURIForResourceInFile ( aFile , "" ) } ; LOG ( "Calling bootstrap method " + aMethod + " on " + aId + " version " + aVersion ) ; try { this . bootstrapScopes [ aId ] [ aMethod ] ( params , aReason ) ; } catch ( e ) { WARN ( "Exception running bootstrap method " + aMethod + " on " + aId , e ) ; } } finally { if ( aMethod == "shutdown" ) Components . manager . removeBootstrappedManifestLocation ( aFile ) ; } }
Calls a bootstrap method for an add-on.
Calls a bootstrap method for an add - on .
// Never call any bootstrap methods in safe mode // Don't call bootstrap.js methods for language packs, // they only contain chrome. // Load the scope if it hasn't already been loaded