B2G/gecko/toolkit/mozapps/extensions/XPIProvider.jsm
/**
   * Finds all the add-ons installed in this location.
   */
Finds all the add-ons installed in this location.
Finds all the add - ons installed in this location .
function DirInstallLocation__readAddons() {
    let entries = getDirectoryEntries(this._directory);
    for (let entry of entries) {
      let id = entry.leafName;
      if (id == DIR_STAGE || id == DIR_XPI_STAGE || id == DIR_TRASH)
        continue;
      let directLoad = false;
      if (entry.isFile() &&
          id.substring(id.length - 4).toLowerCase() == ".xpi") {
        directLoad = true;
        id = id.substring(0, id.length - 4);
      }
      if (!gIDTest.test(id)) {
        LOG("Ignoring file entry whose name is not a valid add-on ID: " +
             entry.path);
        continue;
      }
      if (entry.isFile() && !directLoad) {
        let newEntry = this._readDirectoryFromFile(entry);
        if (!newEntry) {
          LOG("Deleting stale pointer file " + entry.path);
          try {
            entry.remove(true);
          }
          catch (e) {
            WARN("Failed to remove stale pointer file " + entry.path, e);
          }
          continue;
        }
        entry = newEntry;
        this._linkedAddons.push(id);
      }
      this._IDToFileMap[id] = entry;
      this._FileToIDMap[entry.path] = id;
    }
  }
function DirInstallLocation__readAddons ( ) { let entries = getDirectoryEntries ( this . _directory ) ; for ( let entry of entries ) { let id = entry . leafName ; if ( id == DIR_STAGE || id == DIR_XPI_STAGE || id == DIR_TRASH ) continue ; let directLoad = false ; if ( entry . isFile ( ) && id . substring ( id . length - 4 ) . toLowerCase ( ) == ".xpi" ) { directLoad = true ; id = id . substring ( 0 , id . length - 4 ) ; } if ( ! gIDTest . test ( id ) ) { LOG ( "Ignoring file entry whose name is not a valid add-on ID: " + entry . path ) ; continue ; } if ( entry . isFile ( ) && ! directLoad ) { let newEntry = this . _readDirectoryFromFile ( entry ) ; if ( ! newEntry ) { LOG ( "Deleting stale pointer file " + entry . path ) ; try { entry . remove ( true ) ; } catch ( e ) { WARN ( "Failed to remove stale pointer file " + entry . path , e ) ; } continue ; } entry = newEntry ; this . _linkedAddons . push ( id ) ; } this . _IDToFileMap [ id ] = entry ; this . _FileToIDMap [ entry . path ] = id ; } }
Finds all the add-ons installed in this location.
Finds all the add - ons installed in this location .
// Use a snapshot of the directory contents to avoid possible issues with // iterating over a directory while removing files from it (the YAFFS2 // embedded filesystem has this issue, see bug 772238). // Failing to remove the stale pointer file is ignorable