I’m using Firefox nightly and trying to create an extension using SQLite and OPFS. When I go to this URL in Firefox, I see the message “The OPFS is available.”.
When I convert that same example into an extension, and load it in Firefox nightly via web-ext, I get a message that OPFS is not supported.
@randy I’m currently also considering using sqlite/OPFS in a FF extension. Are you still experiencing this issue now that 111.0 was officially released with OPFS support? If so maybe we should raise it on Bugzilla.
@djahandarie, thanks for the reply! Yes, I still have the same issue using Firefox 111.0 and the official build of sqlite-wasm v3.41.
The problem still seems to be that Firefox doesn’t recognize the COOP/COEP keys in the manifest.json file, and I don’t know how else to specify those headers in an extension.
Where is the proper place to report this? I’m unfamiliar with Firefox development.
The reason these headers are required for sqlite/OPFS is because they use SharedArrayBuffer, which requires them. (ref 1, ref 2)
However, in Chrome extensions, SharedArrayBuffer works without those headers, so sqlite/OPFS are usable. (ref)
Unrelated to OPFS, there was an issue on the Firefox bug tracker regarding SharedArrayBuffer usage within extensions two years ago, which culminated in only allowing it for privileged extensions (aka not available to normal people like us). (ref)
I think it’d be worth raising another bug on bugzilla.mozilla.org specifically about OPFS usage within extensions, while linking to the above bug and context. Would you like to give that a shot?