function isSourceURITrusted(uri) {
    // For security reasons, we currently limit synced add-ons to those
    // installed from trusted hostname(s). We additionally require TLS with
    // the add-ons site to help prevent forgeries.
    let trustedHostnames = Svc.Prefs.get("addons.trustedSourceHostnames", "")
                           .split(",");

    if (!uri) {
      this._log.debug("Undefined argument to isSourceURITrusted().");
      return false;
    }

    // Scheme is validated before the hostname because uri.host may not be
    // populated for certain schemes. It appears to always be populated for
    // https, so we avoid the potential NS_ERROR_FAILURE on field access.
    if (uri.scheme != "https") {
      this._log.debug("Source URI not HTTPS: " + uri.spec);
      return false;
    }

    if (trustedHostnames.indexOf(uri.host) == -1) {
      this._log.debug("Source hostname not trusted: " + uri.host);
      return false;
    }

    return true;
  }
/**
   * Determine whether an add-on's sourceURI field is trusted and the add-on
   * can be installed.
   *
   * This function should only ever be called from isAddonSyncable(). It is
   * exposed as a separate function to make testing easier.
   *
   * @param  uri
   *         nsIURI instance to validate
   * @return bool
   */
Determine whether an add-on's sourceURI field is trusted and the add-on
can be installed.

This function should only ever be called from isAddonSyncable(). It is
exposed as a separate function to make testing easier.

@param  uri
nsIURI instance to validate
@return bool
Determine whether an add - on ' s sourceURI field is trusted and the add - on can be installed . This function should only ever be called from isAddonSyncable () . It is exposed as a separate function to make testing easier . @param uri nsIURI instance to validate @return bool
function isSourceURITrusted(uri) {
    let trustedHostnames = Svc.Prefs.get("addons.trustedSourceHostnames", "")
                           .split(",");
    if (!uri) {
      this._log.debug("Undefined argument to isSourceURITrusted().");
      return false;
    }
    if (uri.scheme != "https") {
      this._log.debug("Source URI not HTTPS: " + uri.spec);
      return false;
    }
    if (trustedHostnames.indexOf(uri.host) == -1) {
      this._log.debug("Source hostname not trusted: " + uri.host);
      return false;
    }
    return true;
  }
function isSourceURITrusted ( uri ) { let trustedHostnames = Svc . Prefs . get ( "addons.trustedSourceHostnames" , "" ) . split ( "," ) ; if ( ! uri ) { this . _log . debug ( "Undefined argument to isSourceURITrusted()." ) ; return false ; } if ( uri . scheme != "https" ) { this . _log . debug ( "Source URI not HTTPS: " + uri . spec ) ; return false ; } if ( trustedHostnames . indexOf ( uri . host ) == - 1 ) { this . _log . debug ( "Source hostname not trusted: " + uri . host ) ; return false ; } return true ; }
Determine whether an add-on's sourceURI field is trusted and the add-on
 can be installed.
Determine whether an add - on ' s sourceURI field is trusted and the add - on can be installed .
// For security reasons, we currently limit synced add-ons to those // installed from trusted hostname(s). We additionally require TLS with // the add-ons site to help prevent forgeries. // Scheme is validated before the hostname because uri.host may not be // populated for certain schemes. It appears to always be populated for // https, so we avoid the potential NS_ERROR_FAILURE on field access.