Firefox 扩展开发和 sqlite
我正在制作一个 Firefox 扩展并寻找一种存储数据的方法,
我看到 sqlite 数据库可用,想知道其他扩展是否可以对我的数据库进行查询?
从我所发现的情况来看,我看不到任何方法可以做到这一点。
Firefox 中还有其他解决方案来存储私人数据吗?
鲍勃
I am making a Firefox extension and looking for a way to store data
I see the sqlite database is available and wonder if it is possible for other extensions to do queries to my database?
From what I have found I can not see any way to do that.
Are there any other solution in Firefox to store private data.
Bob
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,如果其他扩展知道您存储数据库文件的位置以及数据库的结构是什么,那么它们就可以轻松地对其进行查询。
据我所知,没有真正的“安全”方式。您可以将数据存储在首选项中,但这更容易访问。
Well, if other extensions know where you store the database file and what is the structure of the database, then they can easily make queries on that.
Afaik there is no real "secure" way. You can store data in preferences, but that is even easier to access.
您不想在首选项中存储太多数据(它们在启动时同步读取!)
仅了解 sqlite 文件名是行不通的,因为无论谁先打开数据库都会锁定它。让其他扩展对数据库进行查询的最简单方法是在某处公开数据库连接。某个地方可能是 XPCOM 服务组件(这就是各种工具包服务(例如历史记录、书签、表单数据等)的工作原理,FWIW)或者只是从 JavaScript 模块(如果您只想考虑 JavaScript 使用者)。
You don't want to store too much data in preferences (they're read synchronously at startup!)
Just having knowledge of the sqlite filename won't work since you whoever opens the database first will lock it. The easiest way to let other extensions do queries on your database is to expose the DB connection somewhere. That somewhere could be an XPCOM service component (this is how various toolkit services such as history, bookmarks, form data etc. do it, FWIW) or simply an object you import from a JavaScript module if you only want to consider JavaScript consumers.