PSA: New Promise-based IndexedDB.jsm module

Dão Gottwald dgottwald at
Sun Mar 26 09:03:38 UTC 2017

For those who are curious like me, it looks like extension meta data is our
first and so far only consumer of this:

Kris, what lead you to wanting to use IndexedDB here? What are the
tradeoffs compared to mozstorage or plain JSON (see sessionstore)?


2017-03-26 4:27 GMT+02:00 Kris Maglione <kmaglione at>:

> A couple of weeks ago, I added a new Promise-based IndexedDB helper module
> as part of some performance work I was doing:
> If you've been avoiding IndexedDB because of the verbose and
> difficult-to-work-with API, I encourage you to give it a try. There are
> a lot of advantages to using IndexedDB for storage, particularly the fully
> async API and use of structured clone for data serialization. With this
> module, a basic database access is as simple as:
>  let db = await
>    "fooDB", {storage: "persistent", version: 1}, db => {
>      db.createObjectStore("foo");
>    });
>  await db.objectStore("foo", "readwrite")
>          .set("bar", {baz: "quux"});
>  let val = await db.objectStore("foo").get("bar");
> Please let me know if you have any questions or suggestions.
> -Kris
> _______________________________________________
> firefox-dev mailing list
> firefox-dev at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the firefox-dev mailing list