B2G/gecko/storage/test/unit/head_storage.js
/**
 * Use asyncClose to cleanup a connection.  Synchronous by means of internally
 * spinning an event loop.
 */
Use asyncClose to cleanup a connection.  Synchronous by means of internally
spinning an event loop.
Use asyncClose to cleanup a connection . Synchronous by means of internally spinning an event loop .
function asyncCleanup()
{
  let closed = false;
  print("*** Storage Tests: Trying to asyncClose!");
  getOpenedDatabase().asyncClose(function() { closed = true; });
  let curThread = Components.classes["@mozilla.org/thread-manager;1"]
                            .getService().currentThread;
  while (!closed)
    curThread.processNextEvent(true);
  gDBConn = null;
  print("*** Storage Tests: Trying to remove file!");
  var dbFile = getTestDB();
  if (dbFile.exists())
    try { dbFile.remove(false); } catch(e) {  }
}
function asyncCleanup ( ) { let closed = false ; print ( "*** Storage Tests: Trying to asyncClose!" ) ; getOpenedDatabase ( ) . asyncClose ( function ( ) { closed = true ; } ) ; let curThread = Components . classes [ "@mozilla.org/thread-manager;1" ] . getService ( ) . currentThread ; while ( ! closed ) curThread . processNextEvent ( true ) ; gDBConn = null ; print ( "*** Storage Tests: Trying to remove file!" ) ; var dbFile = getTestDB ( ) ; if ( dbFile . exists ( ) ) try { dbFile . remove ( false ) ; } catch ( e ) { } }
Use asyncClose to cleanup a connection.
Use asyncClose to cleanup a connection .
// close the connection // we need to null out the database variable to get a new connection the next // time getOpenedDatabase is called // removing test db /* stupid windows box */