WebExtensions: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
(Update for terminology)
Line 1: Line 1:
'''If you are looking for documentation on how to develop a WebExtension add-on with Firefox, [https://developer.mozilla.org/en-US/Add-ons/WebExtensions please checkout MDN].'''
'''If you are looking for documentation on how to develop an extension with WebExtensions APIs with Firefox, [https://developer.mozilla.org/en-US/Add-ons/WebExtensions please check out MDN].'''


This page is an introduction to Mozilla's implementation of WebExtensions, a new browser extension API. The goals of this API are:
This page is an introduction to Mozilla's implementation of WebExtensions, a new browser extension API. The goals of this API are:
* Porting add-ons to and from other browsers should be easier.  
* Porting add-ons to and from other browsers should be easier.  
* Reviewing add-ons for addons.mozilla.org should be easier.
* Reviewing add-ons for addons.mozilla.org (AMO) should be easier.
* WebExtensions must be compatible with multiprocess Firefox ([[Electrolysis]]).
* Compatibility with multiprocess Firefox ([[Electrolysis]]).
* Changes to Firefox's internal code should be less likely to break add-ons.
* Changes to Firefox's internal code should be less likely to break add-ons.
* WebExtensions should be easier to use than the existing Firefox XPCOM/XUL APIs.
* WebExtensions APIs should be easier to use than the existing Firefox XPCOM/XUL APIs.
* WebExtensions should maintain acceptable security and privacy standards.
* WebExtensions APIs should maintain acceptable security and privacy standards.


Much of the specifics of the new API are similar to the Blink extension API. Google has [https://developer.chrome.com/extensions extensive documentation on the API]. [https://dev.opera.com/extensions/ So does Opera]. But the [https://developer.mozilla.org/en-US/Add-ons/WebExtensions Firefox docs on MDN] are the best.
Much of the specifics of the new API are similar to the Blink extension API. Google has [https://developer.chrome.com/extensions extensive documentation on the API]. [https://dev.opera.com/extensions/ So does Opera]. But the [https://developer.mozilla.org/en-US/Add-ons/WebExtensions Firefox docs on MDN] are the best.
Line 41: Line 41:
* Join us on [[IRC|IRC]] at #webextensions or #addons
* Join us on [[IRC|IRC]] at #webextensions or #addons


== Testing out the WebExtensions API ==
== Testing WebExtensions APIs ==


See [https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Your_first_WebExtension Your first WebExtension] on MDN.
See [https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Your_first_WebExtension Your first extension] on MDN.


= Technical Details =
= Technical Details =
Line 57: Line 57:
== Out-of-process Extensions ==
== Out-of-process Extensions ==


WebExtensions are compatible with Electrolysis. They run in the main Firefox process (except for content scripts, which run in the same process as web content). We are considering a plan to run extensions in a separate process (or possibly the content process) eventually, see {{Bugzilla|1190679}} for more details.
Extensions developed with WebExtension APIs are compatible with Electrolysis. They run in the main Firefox process (except for content scripts, which run in the same process as web content). We are considering a plan to run extensions in a separate process (or possibly the content process) eventually, see {{Bugzilla|1190679}} for more details.


Technical details about the implementation are published at [[WebExtensions/Implementing_APIs_out-of-process]].  
Technical details about the implementation are published at [[WebExtensions/Implementing_APIs_out-of-process]].  
Line 65: Line 65:
== Packaging ==
== Packaging ==


Extensions are packaged as standard Zip files, but with <code>.xpi</code> extensions. In the future, we're planning to move towards whatever the W3C WG recommends.
Extensions are packaged as standard Zip files, but with <code>.xpi</code> extensions. In the future, we're planning to move towards what the W3C WG recommends.


See https://developer.chrome.com/extensions/manifest for a complete list of manifest directives.
See https://developer.chrome.com/extensions/manifest for a complete list of manifest directives.

Revision as of 21:15, 3 August 2017

If you are looking for documentation on how to develop an extension with WebExtensions APIs with Firefox, please check out MDN.

This page is an introduction to Mozilla's implementation of WebExtensions, a new browser extension API. The goals of this API are:

  • Porting add-ons to and from other browsers should be easier.
  • Reviewing add-ons for addons.mozilla.org (AMO) should be easier.
  • Compatibility with multiprocess Firefox (Electrolysis).
  • Changes to Firefox's internal code should be less likely to break add-ons.
  • WebExtensions APIs should be easier to use than the existing Firefox XPCOM/XUL APIs.
  • WebExtensions APIs should maintain acceptable security and privacy standards.

Much of the specifics of the new API are similar to the Blink extension API. Google has extensive documentation on the API. So does Opera. But the Firefox docs on MDN are the best.

Please note: we are going with the name WebExtensions because it can be used in search engines, not Web Extensions (with a space) which is almost impossible to search.

Status

Useful queries

Firefox 57

To keep track of priorities for Firefox 57, we are using the webextensions tracking flag. You can nominate a bug by using the flag with a ?. Bugs that are not on the tracking flag may still be worked but, but will not be a priority. All bugs must have a priority and preferably an assignee. All P1 bugs must have an assignee.

Communication and meetings

Testing WebExtensions APIs

See Your first extension on MDN.

Technical Details

Permission Model

We currently enforce manifest permissions for the supported APIs. We also enforce CSP protections.

Namespacing

At this time, all APIs are accessible through the chrome.* and browser.* namespace. When we begin to add our own APIs, we expect to add them to the browser.* namespace.

Out-of-process Extensions

Extensions developed with WebExtension APIs are compatible with Electrolysis. They run in the main Firefox process (except for content scripts, which run in the same process as web content). We are considering a plan to run extensions in a separate process (or possibly the content process) eventually, see 1190679 for more details.

Technical details about the implementation are published at WebExtensions/Implementing_APIs_out-of-process.

Testing details are published at WebExtensions/Testing-out-of-process.

Packaging

Extensions are packaged as standard Zip files, but with .xpi extensions. In the future, we're planning to move towards what the W3C WG recommends.

See https://developer.chrome.com/extensions/manifest for a complete list of manifest directives.

API support status

The list of APIs and their status is now maintained on MDN. We intend to fix any of the exceptions listed there.

Please also see arewewebextensionsyet.com for an up to date list of supported APIs that is taken by parsing schemas defined in mozilla-central. No guarantees are made on this site, the MDN page is definitive in case of disagreement.

Additional APIs

  • If you're experienced with Mozilla infrastructure and would like to develop WebExtensions APIs directly for Firefox, here is a list of approved APIs that you can start contributing to.
  • If you'd like to become familiar with Mozilla infrastructure so you can develop WebExtensions APIs directly for Firefox, follow these steps:

Contributing

Please see the hacking guide for information about contributing code to the WebExtensions project.

Please see https://webextensions-experiments.readthedocs.io/en/latest/ for some information on Experiments which might be useful for contributing.

Here is a list of all add-on contribution opportunities.