Integrating an add-on into a custom Firefox build

馋奶兔 提交于 2019-12-20 05:14:32

问题


I'm making a custom Firefox build. I would like to integrate my add-on (Add-on SDK) into the build. I would prefer this rather than directly integrating with the Firefox code.

What is the best way to achieve this?

I'm thinking about placing it into the /browser/extensions/ directory. If this is a good idea, then please explain to me why (or point to appropriate docs files).

There is a very similar question about this: How to integrate add-ons (.xpi) into my custom Firefox build? Unfortunately there is no answer.

Edit: I think I've found a way to do this, however, this method is not documented and might not work in every case. I renamed the .xpi file to ADDON_ID.xpi and placed it in '/browser/extensions/' directory in source code. Than I added:

FINAL_TARGET_FILES.features += [
    'ADDON_ID.xpi'
]

to '/browser/extensions/moz.build' file.

After building the browser, addon was placed in '/browser/features' directory in application files.

Addon integrated like this is hidden from user and is not copied into user profile folder.

Note: I don't use Mozilla update services in my custom build, so I can't confirm that there is no problems while updating the application.


回答1:


The documented way to do this is to include the .xpi file with the distribution in the directory:
[Firefox install directory]/distribution/extensions
The add-on will then be installed in (copied to) each profile upon the first use of that version of Firefox with the profile. The copy of the extension in each profile will be automatically updated using the normal auto-updating procedure. Effectively, the add-on will be treated as if separately installed in each profile. The user will not be asked to confirm installation of the add-on.

For more information see:

  • Customizing Firefox: Including extensions with your distribution of Firefox (MDN documentation)
  • Installing extensions (MDN documentation)
  • Auto update of bundled Firefox extensions (Stackoverflow question)
  • Install WebExtensions on Firefox from the command line (Stackoverflow question)


来源:https://stackoverflow.com/questions/37608585/integrating-an-add-on-into-a-custom-firefox-build

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