移植到WebExtensions时访问旧式Firefox扩展的首选项 [英] Access old-style Firefox extension's preferences when porting to WebExtensions
问题描述
我的基于XUL的Firefox扩展程序在首选项中存储数据.迁移到WebExtension版本时是否可以访问一次此数据?
My XUL-based Firefox extension stores data in preferences. Is there a way to access this data once when migrating to a WebExtension version?
我知道 https://wiki.mozilla.org/WebExtensions/FAQ #Does_the_WebExtensions_API_provide_access_to_preferences.3F ,但希望有针对此特定用例的解决方案.
I am aware of https://wiki.mozilla.org/WebExtensions/FAQ#Does_the_WebExtensions_API_provide_access_to_preferences.3F but hope there is a solution for this specific use-case.
推荐答案
根据首选项的数量,有一些选项:
Depending on the number of preferences, there are a few options:
- 丢弃它们,让您的用户在升级后再次设置它们
- 使用与您的网络扩展程序通信的外部程序阅读它们,请参见 https://developer.mozilla.org/zh-CN/Add-ons/WebExtensions/Native_messaging
- 制作一个导出工具(外部程序),将其导出为JSON(或类似形式)并在您的webextension中选择导入选项
除了上述选项之外,还可以使用混合网络扩展名,该扩展名可以读取首选项并将其发布在addons.mozilla.org上,但是如果我没有记错的话,该选项自Firefox 57起就失效了.
Aside from the options above, it was possible to have a hybrid webextension which could read the preferences and publish it on addons.mozilla.org, but that option expired as of Firefox 57 if I am not mistaken.
这篇关于移植到WebExtensions时访问旧式Firefox扩展的首选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!