Access old-style Firefox extension's preferences when porting to WebExtensions

烈酒焚心 提交于 2020-01-06 05:39:12

问题


My XUL-based Firefox extension stores data in preferences. Is there a way to access this data once when migrating to a WebExtension version?

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.


回答1:


Depending on the number of preferences, there are a few options:

  • discard them and let your users set them again after upgrading
  • read them using an external program which communicates with your webextension, see https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Native_messaging
  • make an export tool (external program) which exports to JSON (or something similar) and make an import option in your webextension

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.



来源:https://stackoverflow.com/questions/48650400/access-old-style-firefox-extensions-preferences-when-porting-to-webextensions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!