From fe9b94d4eccd4f830e63c412e44d5ba15319fdd0 Mon Sep 17 00:00:00 2001 From: pbouianov Date: Wed, 5 Mar 2014 14:45:59 -0500 Subject: [PATCH] Changed IndexedDB provider to use RW context if RO is requested. Fixes issue #128 --- src/providers/indexeddb.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/providers/indexeddb.js b/src/providers/indexeddb.js index 9de9e9a..2658163 100644 --- a/src/providers/indexeddb.js +++ b/src/providers/indexeddb.js @@ -116,7 +116,10 @@ define(function(require) { }; }; IndexedDB.prototype.getReadOnlyContext = function() { - return new IndexedDBContext(this.db, IDB_RO); + // Due to timing issues in Chrome with readwrite vs. readonly indexeddb transactions + // always use readwrite so we can make sure pending commits finish before callbacks. + // See https://github.com/js-platform/filer/issues/128 + return new IndexedDBContext(this.db, IDB_RW); }; IndexedDB.prototype.getReadWriteContext = function() { return new IndexedDBContext(this.db, IDB_RW);