B2G/gecko/toolkit/mozapps/extensions/AddonManager.jsm
/**
   * Calls all registered InstallListeners with an event. Any parameters after
   * the extraListeners parameter are passed to the listener.
   *
   * @param  aMethod
   *         The method on the listeners to call
   * @param  aExtraListeners
   *         An optional array of extra InstallListeners to also call
   * @return false if any of the listeners returned false, true otherwise
   */
Calls all registered InstallListeners with an event. Any parameters after
the extraListeners parameter are passed to the listener.

@param  aMethod
The method on the listeners to call
@param  aExtraListeners
An optional array of extra InstallListeners to also call
@return false if any of the listeners returned false, true otherwise
Calls all registered InstallListeners with an event . Any parameters after the extraListeners parameter are passed to the listener . @param aMethod The method on the listeners to call @param aExtraListeners An optional array of extra InstallListeners to also call @return false if any of the listeners returned false true otherwise
function AMI_callInstallListeners(aMethod, aExtraListeners, ...aArgs) {
    if (!gStarted)
      throw Components.Exception("AddonManager is not initialized",
                                 Cr.NS_ERROR_NOT_INITIALIZED);
    if (!aMethod || typeof aMethod != "string")
      throw Components.Exception("aMethod must be a non-empty string",
                                 Cr.NS_ERROR_INVALID_ARG);
    if (aExtraListeners && !Array.isArray(aExtraListeners))
      throw Components.Exception("aExtraListeners must be an array or null",
                                 Cr.NS_ERROR_INVALID_ARG);
    let result = true;
    let listeners;
    if (aExtraListeners)
      listeners = aExtraListeners.concat(this.installListeners);
    else
      listeners = this.installListeners.slice(0);
    for (let listener of listeners) {
      try {
        if (aMethod in listener) {
          if (listener[aMethod].apply(listener, aArgs) === false)
            result = false;
        }
      }
      catch (e) {
        WARN("InstallListener threw exception when calling " + aMethod, e);
      }
    }
    return result;
  }
function AMI_callInstallListeners ( aMethod , aExtraListeners , ... aArgs ) { if ( ! gStarted ) throw Components . Exception ( "AddonManager is not initialized" , Cr . NS_ERROR_NOT_INITIALIZED ) ; if ( ! aMethod || typeof aMethod != "string" ) throw Components . Exception ( "aMethod must be a non-empty string" , Cr . NS_ERROR_INVALID_ARG ) ; if ( aExtraListeners && ! Array . isArray ( aExtraListeners ) ) throw Components . Exception ( "aExtraListeners must be an array or null" , Cr . NS_ERROR_INVALID_ARG ) ; let result = true ; let listeners ; if ( aExtraListeners ) listeners = aExtraListeners . concat ( this . installListeners ) ; else listeners = this . installListeners . slice ( 0 ) ; for ( let listener of listeners ) { try { if ( aMethod in listener ) { if ( listener [ aMethod ] . apply ( listener , aArgs ) === false ) result = false ; } } catch ( e ) { WARN ( "InstallListener threw exception when calling " + aMethod , e ) ; } } return result ; }
Calls all registered InstallListeners with an event.
Calls all registered InstallListeners with an event .