Merge pull request #318 from filerjs/fxos-1.3-fix

fix for arraybuffer brokenness on fxos1.3; adds a new code path for that...
This commit is contained in:
Alan K 2014-10-24 07:55:45 -04:00
commit f0829b69ca
1 changed files with 7 additions and 1 deletions

View File

@ -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) {