-
-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange Behaviour with Quotas (binary data) #228
Comments
Just leaving this here as a probable workaround, Thinkwise got a plugin that allows you to expand the default store size. This doesn't solve your issue though. |
I have spent some time trying to find the problem, and it looks like it was to do with binary data (ArrayBuffers) in the JSON objects being stored. So I have added a work around that base64 encodes the array buffers, if it is using IndexedDBShim. It would be better (for compatibility with real IndexedDB) if IndexedDBshim would do this itself, although I can't think of an easy way to find where the binary data is. Looking at the PouchDB WebSQL driver, base64 may not be necessary, and you might only have to remove x0000, x0001, x0002, see: pouchdb/pouchdb#2900. When I have removed the binary data, it now handles the quota correctly and aborts the transaction, and I can read the data back and validate it. |
A PR with test would be most welcome! |
The ArrayBuffers or views on buffers (TypedArray or DataView) (support more recently added to IndexedDB) are not currently supported in IndexedDBShim (added now on the README as a known issue). A PR is most welcome! |
There had been some binary support previously, and internally now there is better potential support (e.g., for keys), but it is still not complete (nor are the parts that are complete fully tested). But just one to-do I wanted to add mention of here while we're tracking binary--cloning should be done synchronously (in some places if not all) so that the API can report errors synchrously as expected by the spec (and W3C tests). |
Support for |
I have an application that writes some large ArrayBuffers to IndexedDB, and I am using IndededDBShim to support versions of Safari that do not have IndexedDB support.
I am getting strange behaviour when writing objects larger than the WebSQL storage quota. If the user does not approve the storage size increment, then the 'put' transaction appears to succeed (it should be aborted). Then when I read the objectStore, I can find an item at the key, and read it. I get back a strange object, it looks to be an instance of 'Object' with no data, but it is not null, but neither is it the ArrayBuffer I tried to store.
The expected behaviour is that the transaction should be aborted, and the key should not exit in the objectStore.
The text was updated successfully, but these errors were encountered: