Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于firefox插件不能保存数据(SQLite持久化)的问题 #2

Open
lastsunday opened this issue Jun 23, 2024 · 0 comments
Open
Labels
question Further information is requested

Comments

@lastsunday
Copy link
Owner

lastsunday commented Jun 23, 2024

问题未解决,该问题已经在2021年的mozilla上的论坛被提出。

Mozilla issues

https://bugzilla.mozilla.org/show_bug.cgi?id=1673477

相关资料:

https://discourse.mozilla.org/t/sqlite-and-opfs-not-working-in-firefox-extension/111667
引用djahandarie 的回答:

  1. The reason these headers are required for sqlite/OPFS is because they use SharedArrayBuffer, which requires them. (ref 1 1, ref 2)
  2. However, in Chrome extensions, SharedArrayBuffer works without those headers, so sqlite/OPFS are usable. (ref 4)
  3. 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 3)

其他:

不在fire extension环境下访问该地址,会提示The OPFS is available.说明OPFS可用。
原理为在Request Response Header里添加了以下参数:

cross-origin-embedder-policy: require-corp
cross-origin-opener-policy: same-origin

相关资料见:https://github.com/sqlite/sqlite-wasm?tab=readme-ov-file#in-a-worker-with-opfs-if-available

@lastsunday lastsunday added the question Further information is requested label Jun 23, 2024
@lastsunday lastsunday changed the title 关于firefox插件不能进行保存数据(SQLite持久化)的问题 关于firefox插件不能保存数据(SQLite持久化)的问题 Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant