B2G/gecko/toolkit/mozapps/extensions/XPIProviderUtils.js
/**
   * Synchronously makes a DBAddonInternal from a mozIStorageRow or returns one
   * from the cache.
   *
   * @param  aRow
   *         The mozIStorageRow to make the DBAddonInternal from
   * @return a DBAddonInternal
   */
Synchronously makes a DBAddonInternal from a mozIStorageRow or returns one
from the cache.

@param  aRow
The mozIStorageRow to make the DBAddonInternal from
@return a DBAddonInternal
Synchronously makes a DBAddonInternal from a mozIStorageRow or returns one from the cache . @param aRow The mozIStorageRow to make the DBAddonInternal from @return a DBAddonInternal
function XPIDB_makeAddonFromRowAsync(aRow, aCallback) {
    let internal_id = aRow.getResultByName("internal_id");
    if (this.addonCache[internal_id]) {
      let addon = this.addonCache[internal_id].get();
      if (addon) {
        if ("_pendingCallbacks" in addon)
          addon._pendingCallbacks.push(aCallback);
        else
          aCallback(addon);
        return;
      }
    }
    let addon = new XPIProvider.DBAddonInternal();
    addon._internal_id = internal_id;
    let location = aRow.getResultByName("location");
    addon._installLocation = XPIProvider.installLocationsByName[location];
    addon._descriptor = aRow.getResultByName("descriptor");
    copyRowProperties(aRow, PROP_METADATA, addon);
    addon._defaultLocale = aRow.getResultByName("defaultLocale");
    copyRowProperties(aRow, DB_METADATA, addon);
    DB_BOOL_METADATA.forEach(function(aProp) {
      addon[aProp] = aRow.getResultByName(aProp) != 0;
    });
    try {
      addon._sourceBundle = addon._installLocation.getLocationForID(addon.id);
    }
    catch (e) {
    }
    this.addonCache[internal_id] = Components.utils.getWeakReference(addon);
    addon._pendingCallbacks = [aCallback];
    this.fetchAddonMetadata(addon);
  }
function XPIDB_makeAddonFromRowAsync ( aRow , aCallback ) { let internal_id = aRow . getResultByName ( "internal_id" ) ; if ( this . addonCache [ internal_id ] ) { let addon = this . addonCache [ internal_id ] . get ( ) ; if ( addon ) { if ( "_pendingCallbacks" in addon ) addon . _pendingCallbacks . push ( aCallback ) ; else aCallback ( addon ) ; return ; } } let addon = new XPIProvider . DBAddonInternal ( ) ; addon . _internal_id = internal_id ; let location = aRow . getResultByName ( "location" ) ; addon . _installLocation = XPIProvider . installLocationsByName [ location ] ; addon . _descriptor = aRow . getResultByName ( "descriptor" ) ; copyRowProperties ( aRow , PROP_METADATA , addon ) ; addon . _defaultLocale = aRow . getResultByName ( "defaultLocale" ) ; copyRowProperties ( aRow , DB_METADATA , addon ) ; DB_BOOL_METADATA . forEach ( function ( aProp ) { addon [ aProp ] = aRow . getResultByName ( aProp ) != 0 ; } ) ; try { addon . _sourceBundle = addon . _installLocation . getLocationForID ( addon . id ) ; } catch ( e ) { } this . addonCache [ internal_id ] = Components . utils . getWeakReference ( addon ) ; addon . _pendingCallbacks = [ aCallback ] ; this . fetchAddonMetadata ( addon ) ; }
Synchronously makes a DBAddonInternal from a mozIStorageRow or returns one
 from the cache.
Synchronously makes a DBAddonInternal from a mozIStorageRow or returns one from the cache .
// If metadata is still pending for this instance add our callback to // the list to be called when complete, otherwise pass the addon to // our callback // An exception will be thrown if the add-on appears in the database but // not on disk. In general this should only happen during startup as // this change is being detected.