WebExtension APIs for SQL storage?

I’m researching the available WebExtensions API to port my XUL/XPCOM-based Firefox overlay extension. It currently stores user-generated data in an RDF data source, and I would like to use a SQL database for the extension rewrite. Sqlite.jsm would be the JavaScript module I would use for a legacy XUL/XPCOM-based extension; is there an equivalent WebExtensions API?

1 Like

WebExtensions don’t, and I expect won’t ever, support any kind of SQL. A general concept of WebExtensions is to use standard web APIs where possible. Since webSQL isn’t a standard and was never implemented in Firefox, you can’t use that.
The closest you will get to an SQL DB with web standards is indexedDB. If you want more SQL, this might be useful:

On a site note however, I have observed cases where I couldn’t use the indexedDB from a WebExtensions: A few month back IndexedDB would also be blocked for WebExtensions if it was blocked for web sites (privacy/storage settings). I don’t know if that is fixed.

The only reliable storage in therms of availability I know is chrome.storage.local. But that’s not really a database but rather a simple key/value storage that is written to a JSON file from time to time.

Thanks NilkasG; I’ll look into indexedDB and see if I can get it to work.