treojs / treo

Consistent API to IndexedDB
http://treojs.com
MIT License
258 stars 18 forks source link

Problem in Safari 7.1 and 8 #17

Closed beeftornado closed 9 years ago

beeftornado commented 9 years ago

Safari added indexedDB, but it seems broken and since it actually exists, Treo never falls back to websql (if one opted to use the plugin). According to some investigation done by pouchdb guys, Safari may not always fire the onupgradeneeded event and thus for new databases, the stores will never be created. This throws an exception. https://github.com/pouchdb/pouchdb/issues/2533

Maybe in the websql plugin we can activate it using the hack they chose to do... https://github.com/pouchdb/pouchdb/commit/2a2e722b06d98a8122c751361b7e80b1e066c721

I'm going to try it out locally.

beeftornado commented 9 years ago

Someone has suggested that only creating one store solves the issue. Interesting. Just thought I'd point it out. https://bugs.webkit.org/show_bug.cgi?id=136937

alekseykulikov commented 9 years ago

Yes, Safari's IndexedDB is broken, and onupgradeneeded is not only the one issue. I like Pouch's trick, and we need to add here: https://github.com/alekseykulikov/treo/blob/master/plugins/treo-websql/index.js#L1 (pull request is welcome:)

beeftornado commented 9 years ago

Even manually activating the plugin in safari didn't work. A different exception gets thrown. Was hoping to narrow it down further, but ran out of time today. Will research more this week.

alekseykulikov commented 9 years ago

Closes by https://github.com/unkillbob/treo/commit/ec157c6c16714436563ac04e431c55eda7b751be