function isAddonSyncable(addon) {
    // Currently, we limit syncable add-ons to those that are:
    //   1) In a well-defined set of types
    //   2) Installed in the current profile
    //   3) Not installed by a foreign entity (i.e. installed by the app)
    //      since they act like global extensions.
    //   4) Is not a hotfix.
    //   5) Are installed from AMO

    // We could represent the test as a complex boolean expression. We go the
    // verbose route so the failure reason is logged.
    if (!addon) {
      this._log.debug("Null object passed to isAddonSyncable.");
      return false;
    }

    if (this._syncableTypes.indexOf(addon.type) == -1) {
      this._log.debug(addon.id + " not syncable: type not in whitelist: " +
                      addon.type);
      return false;
    }

    if (!(addon.scope & AddonManager.SCOPE_PROFILE)) {
      this._log.debug(addon.id + " not syncable: not installed in profile.");
      return false;
    }

    // This may be too aggressive. If an add-on is downloaded from AMO and
    // manually placed in the profile directory, foreignInstall will be set.
    // Arguably, that add-on should be syncable.
    // TODO Address the edge case and come up with more robust heuristics.
    if (addon.foreignInstall) {
      this._log.debug(addon.id + " not syncable: is foreign install.");
      return false;
    }

    // Ignore hotfix extensions (bug 741670). The pref may not be defined.
    if (this._extensionsPrefs.get("hotfix.id", null) == addon.id) {
      this._log.debug(addon.id + " not syncable: is a hotfix.");
      return false;
    }

    // We provide a back door to skip the repository checking of an add-on.
    // This is utilized by the tests to make testing easier. Users could enable
    // this, but it would sacrifice security.
    if (Svc.Prefs.get("addons.ignoreRepositoryChecking", false)) {
      return true;
    }

    let cb = Async.makeSyncCallback();
    AddonRepository.getCachedAddonByID(addon.id, cb);
    let result = Async.waitForSyncCallback(cb);

    if (!result) {
      this._log.debug(addon.id + " not syncable: add-on not found in add-on " +
                      "repository.");
      return false;
    }

    return this.isSourceURITrusted(result.sourceURI);
  }
/**
   * Determines whether an add-on is suitable for Sync.
   *
   * @param  addon
   *         Addon instance
   * @return Boolean indicating whether it is appropriate for Sync
   */
Determines whether an add-on is suitable for Sync.
@param  addon
Addon instance
@return Boolean indicating whether it is appropriate for Sync
Determines whether an add - on is suitable for Sync . @param addon Addon instance @return Boolean indicating whether it is appropriate for Sync
function isAddonSyncable(addon) {
    if (!addon) {
      this._log.debug("Null object passed to isAddonSyncable.");
      return false;
    }
    if (this._syncableTypes.indexOf(addon.type) == -1) {
      this._log.debug(addon.id + " not syncable: type not in whitelist: " +
                      addon.type);
      return false;
    }
    if (!(addon.scope & AddonManager.SCOPE_PROFILE)) {
      this._log.debug(addon.id + " not syncable: not installed in profile.");
      return false;
    }
    if (addon.foreignInstall) {
      this._log.debug(addon.id + " not syncable: is foreign install.");
      return false;
    }
    if (this._extensionsPrefs.get("hotfix.id", null) == addon.id) {
      this._log.debug(addon.id + " not syncable: is a hotfix.");
      return false;
    }
    if (Svc.Prefs.get("addons.ignoreRepositoryChecking", false)) {
      return true;
    }
    let cb = Async.makeSyncCallback();
    AddonRepository.getCachedAddonByID(addon.id, cb);
    let result = Async.waitForSyncCallback(cb);
    if (!result) {
      this._log.debug(addon.id + " not syncable: add-on not found in add-on " +
                      "repository.");
      return false;
    }
    return this.isSourceURITrusted(result.sourceURI);
  }
function isAddonSyncable ( addon ) { if ( ! addon ) { this . _log . debug ( "Null object passed to isAddonSyncable." ) ; return false ; } if ( this . _syncableTypes . indexOf ( addon . type ) == - 1 ) { this . _log . debug ( addon . id + " not syncable: type not in whitelist: " + addon . type ) ; return false ; } if ( ! ( addon . scope & AddonManager . SCOPE_PROFILE ) ) { this . _log . debug ( addon . id + " not syncable: not installed in profile." ) ; return false ; } if ( addon . foreignInstall ) { this . _log . debug ( addon . id + " not syncable: is foreign install." ) ; return false ; } if ( this . _extensionsPrefs . get ( "hotfix.id" , null ) == addon . id ) { this . _log . debug ( addon . id + " not syncable: is a hotfix." ) ; return false ; } if ( Svc . Prefs . get ( "addons.ignoreRepositoryChecking" , false ) ) { return true ; } let cb = Async . makeSyncCallback ( ) ; AddonRepository . getCachedAddonByID ( addon . id , cb ) ; let result = Async . waitForSyncCallback ( cb ) ; if ( ! result ) { this . _log . debug ( addon . id + " not syncable: add-on not found in add-on " + "repository." ) ; return false ; } return this . isSourceURITrusted ( result . sourceURI ) ; }
Determines whether an add-on is suitable for Sync.
Determines whether an add - on is suitable for Sync .
// Currently, we limit syncable add-ons to those that are: //   1) In a well-defined set of types //   2) Installed in the current profile //   3) Not installed by a foreign entity (i.e. installed by the app) //      since they act like global extensions. //   4) Is not a hotfix. //   5) Are installed from AMO // We could represent the test as a complex boolean expression. We go the // verbose route so the failure reason is logged. // This may be too aggressive. If an add-on is downloaded from AMO and // manually placed in the profile directory, foreignInstall will be set. // Arguably, that add-on should be syncable. // TODO Address the edge case and come up with more robust heuristics. // Ignore hotfix extensions (bug 741670). The pref may not be defined. // We provide a back door to skip the repository checking of an add-on. // This is utilized by the tests to make testing easier. Users could enable // this, but it would sacrifice security.