B2G/gecko/browser/modules/NewTabUtils.jsm
/**
   * V1 changes storage from chromeappsstore.sqlite to prefs.
   */
V1 changes storage from chromeappsstore.sqlite to prefs.
V1 changes storage from chromeappsstore . sqlite to prefs .
function Storage__migrateToV1() {
    let file = FileUtils.getFile("ProfD", ["chromeappsstore.sqlite"]);
    if (!file.exists())
      return;
    let db = Services.storage.openUnsharedDatabase(file);
    let stmt = db.createStatement(
      "SELECT key, value FROM webappsstore2 WHERE scope = 'batwen.:about'");
    try {
      while (stmt.executeStep()) {
        let key = stmt.row.key;
        let value = JSON.parse(stmt.row.value);
        switch (key) {
          case "pinnedLinks":
            this.set(key, value);
            break;
          case "blockedLinks":
            let hashes = {};
            for (let url in value) {
              hashes[toHash(url)] = 1;
            }
            this.set(key, hashes);
            break;
          default:
            break;
        }
      }
    } finally {
      stmt.finalize();
      db.close();
    }
  }
function Storage__migrateToV1 ( ) { let file = FileUtils . getFile ( "ProfD" , [ "chromeappsstore.sqlite" ] ) ; if ( ! file . exists ( ) ) return ; let db = Services . storage . openUnsharedDatabase ( file ) ; let stmt = db . createStatement ( "SELECT key, value FROM webappsstore2 WHERE scope = 'batwen.:about'" ) ; try { while ( stmt . executeStep ( ) ) { let key = stmt . row . key ; let value = JSON . parse ( stmt . row . value ) ; switch ( key ) { case "pinnedLinks" : this . set ( key , value ) ; break ; case "blockedLinks" : let hashes = { } ; for ( let url in value ) { hashes [ toHash ( url ) ] = 1 ; } this . set ( key , hashes ) ; break ; default : break ; } } } finally { stmt . finalize ( ) ; db . close ( ) ; } }
V1 changes storage from chromeappsstore.sqlite to prefs.
V1 changes storage from chromeappsstore . sqlite to prefs .
// Import data from the old chromeappsstore.sqlite file, if exists. // Convert urls to hashes. // Ignore unknown keys.