From ba9902fb936143ddb91d6622bd82d66d78c5a22f Mon Sep 17 00:00:00 2001 From: Alan K Date: Fri, 24 Oct 2014 07:52:11 -0400 Subject: [PATCH] fix for arraybuffer brokenness on fxos1.3; adds a new code path for that version, other platforms should be the same. --- src/providers/indexeddb.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/providers/indexeddb.js b/src/providers/indexeddb.js index 5fb09cd..f353075 100644 --- a/src/providers/indexeddb.js +++ b/src/providers/indexeddb.js @@ -73,7 +73,13 @@ IndexedDBContext.prototype.putObject = function(key, value, callback) { _put(this.objectStore, key, value, callback); }; IndexedDBContext.prototype.putBuffer = function(key, uint8BackedBuffer, callback) { - _put(this.objectStore, key, uint8BackedBuffer.buffer, callback); + var buf; + if(!Buffer._useTypedArrays) { // workaround for fxos 1.3 + buf = uint8BackedBuffer.toArrayBuffer(); + } else { + buf = uint8BackedBuffer.buffer; + } + _put(this.objectStore, key, buf, callback); }; IndexedDBContext.prototype.delete = function(key, callback) {