IndexedDB is our answer for this for JS... C++ folks are still pretty much on their own!
IndexedDB handles indexing (hence the rather awkward name), transactions with abort/rollback, object-graph serialization (not just JSON), usage from multiple tabs/windows/components/processes simultaneously, data integrity guarantees, and easy single-copy file/ blob support. It's also completely asynchronous (and read-only transactions run in parallel!), and one day soon it will be available in Workers too. We're using it extensively in B2G (it's the only storage option, really) and it's easily usable from chrome too (with a two line bit of Cc/Ci init code). IE and Chrome both implement it and we all have it available without a prefix because the API (v1) is pretty much frozen. What we've heard from a lot of JS developers (gaia folks included), though, is that this feature set is more than some want or need. They don't want to worry about indexes or transactions or serializing complex objects. Luckily we anticipated this! Our aim was to provide a sufficiently powerful tool such that we could build complex apps (e.g. B2G's email app, ping asuth for details!) as well as simple key-value stores (e.g. gaia's async_storage, mostly written by dflanagan I think). Someone even implemented an early version of Chrome's filesystem API on IndexedDB... Nevertheless, I (and others) think it's clear that the big thing we screwed up on is that we didn't release a "simple storage" wrapper alongside IndexedDB. I think we expected this sort of thing to appear on its own, but so far it hasn't. Sorry :( So now we're working on wrappers. https://github.com/mounirlamouri/storage.js is one in-progress example. I think there is another as well but the link escapes me at the moment. In any case it should be trivial to do something very similar as a JSM. (We already have an IndexedDBHelper.jsm for more complicated databases that do actually want control over tables and indexes.) Hopefully IndexedDB meets most people's needs... That's what we tried to build here, after all. The need to sprinkle some sugar here and there is completely expected and very much encouraged. Please feel free to ping me over irc or email or here on the list if anything is unclear or difficult. (Of course there are definitely other folks that are involved here but I don't want to volunteer them without their consent!) -bent P.S. The "experimental" mark in MDN is outdated, and very unfortunate. We should remove that ASAP. _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform