B2G/gecko/toolkit/mozapps/extensions/AddonManager.jsm
/**
 * Calls a method on a provider if it exists and consumes any thrown exception.
 * Any parameters after the dflt parameter are passed to the provider's method.
 *
 * @param  aProvider
 *         The provider to call
 * @param  aMethod
 *         The method name to call
 * @param  aDefault
 *         A default return value if the provider does not implement the named
 *         method or throws an error.
 * @return the return value from the provider or dflt if the provider does not
 *         implement method or throws an error
 */
Calls a method on a provider if it exists and consumes any thrown exception.
Any parameters after the dflt parameter are passed to the provider's method.

@param  aProvider
The provider to call
@param  aMethod
The method name to call
@param  aDefault
A default return value if the provider does not implement the named
method or throws an error.
@return the return value from the provider or dflt if the provider does not
implement method or throws an error
Calls a method on a provider if it exists and consumes any thrown exception . Any parameters after the dflt parameter are passed to the provider ' s method . @param aProvider The provider to call @param aMethod The method name to call @param aDefault A default return value if the provider does not implement the named method or throws an error . @return the return value from the provider or dflt if the provider does not implement method or throws an error
function callProvider(aProvider, aMethod, aDefault, ...aArgs) {
  if (!(aMethod in aProvider))
    return aDefault;
  try {
    return aProvider[aMethod].apply(aProvider, aArgs);
  }
  catch (e) {
    ERROR("Exception calling provider " + aMethod, e);
    return aDefault;
  }
}
function callProvider ( aProvider , aMethod , aDefault , ... aArgs ) { if ( ! ( aMethod in aProvider ) ) return aDefault ; try { return aProvider [ aMethod ] . apply ( aProvider , aArgs ) ; } catch ( e ) { ERROR ( "Exception calling provider " + aMethod , e ) ; return aDefault ; } }
Calls a method on a provider if it exists and consumes any thrown exception.
Calls a method on a provider if it exists and consumes any thrown exception .