title: InvalidStateError "A mutation operation was attempted on a database that did not allow mutations." in indexedDB in Firefox
body: <p>I have the following code, which throws a <code>InvalidStateError</code> in <em>Firefox</em> (when calling <code>objectStore</code>).
  The message is <code>A mutation operation was attempted on a database that did not allow mutations.</code>.</p>
  
  <p>Strangely, when I place the creation of the transaction inside the <code>getBlob</code> callback it seems to work.</p>
  
  <pre><code>function saveFile( fileEntry ) {
      var transaction = this;
      transaction.onerror = function( event ) {
          console.log( event );
      };
  
      fileEntry.getBlob( "", function( blob ) {
          var store = transaction.objectStore( STORE_NAME );
          try {
              var request = store.put( blob, fileEntry.getFullname() );
              request.onsuccess = function( event ) {
                  console.log( "file: " + fileEntry.getFullname() );
                  ++(progressBar[0].value);
              };
              request.onerror = function( event ) {
                  console.log( "error in file " + event );
                  ++(progressBar[0].value);
              };
          } catch( ex ) {
              console.log("getBlob " + ex );
          }
      }, function() {
      }, true );
  }
  
  function saveRecursive( dirEntry, missingFiles ) {
      var db = this;
      var transaction = db.transaction( [STORE_NAME],
                                    MODES.READ_WRITE );
  
      for( var i in dirEntry.children ) {
          var entry = dirEntry.children[i];
  
          if( entry.directory ) {
              createDirectory( dirEntry, entry );
              saveRecursive.call( db, entry, missingFiles );
              continue;
          }
  
          var index = missingFiles.indexOf( entry.getFullname() );
          if( index == -1 )
              continue;
  
          // Still missing - add
          missingFiles.splice( index, 1 );
          saveFile.call( transaction, entry );
      }
  }
  </code></pre>
  
  <p>Could someone explain to me, why this is not working?</p>