WebExtensions: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(→‎Additional APIs: updated information about requesting a WebExtension API)
(added link to FAQ page)
 
(13 intermediate revisions by 7 users not shown)
Line 1: Line 1:
This page is an introduction to Mozilla's implementation of WebExtensions, a new browser extension API. The goals of this API are:
'''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; a cross-browser system for developing extensions. 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].
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.


'''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.
'''Please note:''' the API is called "WebExtensions" because it can be found in search engines; "Web Extensions" (with a space) does not yield relevant results. Information on terminology usage is available [[Add-ons/Terminology|here]].


== Status ==
== Status ==


* Bugs are filed in Bugzilla under Toolkit > WebExtensions, [https://bugzilla.mozilla.org/enter_bug.cgi?format=guided#h=dupes%7CToolkit%7CWebExtensions find or create a bug]
* Bugs are filed in Bugzilla under WebExtensions, [https://bugzilla.mozilla.org/enter_bug.cgi?format=guided#h=dupes%7CWebExtensions find or create a bug]


=== Useful queries ===
=== Useful queries ===
* [https://bugzilla.mozilla.org/buglist.cgi?f1=keywords&list_id=13314909&o1=anywords&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&v1=dev-doc-needed&component=WebExtensions%3A%20Android&component=WebExtensions%3A%20Compatibility&component=WebExtensions%3A%20Developer%20Tools&component=WebExtensions%3A%20Experiments&component=WebExtensions%3A%20Frontend&component=WebExtensions%3A%20General&component=WebExtensions%3A%20Request%20Handling&component=WebExtensions%3A%20Untriaged&product=Toolkit Need documentation]
* [https://bugzilla.mozilla.org/buglist.cgi?f1=keywords&list_id=13314909&o1=anywords&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&v1=dev-doc-needed&component=Android&component=Compatibility&component=Developer%20Tools&component=Experiments&component=Frontend&component=General&component=Request%20Handling&component=Untriaged&product=WebExtensions Need documentation]
* [https://bugzilla.mozilla.org/buglist.cgi?f1=status_whiteboard&list_id=13314901&o1=substring&resolution=---&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&v1=triaged&component=WebExtensions%3A%20Android&component=WebExtensions%3A%20Compatibility&component=WebExtensions%3A%20Developer%20Tools&component=WebExtensions%3A%20Experiments&component=WebExtensions%3A%20Frontend&component=WebExtensions%3A%20General&component=WebExtensions%3A%20Request%20Handling&component=WebExtensions%3A%20Untriaged&product=Toolkit Triaged]
* [https://bugzilla.mozilla.org/buglist.cgi?f1=status_whiteboard&list_id=13314901&o1=substring&resolution=---&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&v1=triaged&component=Android&component=Compatibility&component=Developer%20Tools&component=Experiments&component=Frontend&component=General&component=Request%20Handling&component=Untriaged&product=WebExtensions Triaged]
* [https://bugzilla.mozilla.org/buglist.cgi?f1=status_whiteboard&o3=notsubstring&list_id=13314898&v3=intermittent-failure&o1=notsubstring&resolution=---&o2=notsubstring&query_format=advanced&f3=keywords&f2=status_whiteboard&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&v1=triaged&component=WebExtensions%3A%20Android&component=WebExtensions%3A%20Compatibility&component=WebExtensions%3A%20Developer%20Tools&component=WebExtensions%3A%20Experiments&component=WebExtensions%3A%20Frontend&component=WebExtensions%3A%20General&component=WebExtensions%3A%20Request%20Handling&component=WebExtensions%3A%20Untriaged&v2=design-decision-needed&product=Toolkit Untriaged] (note: this is different from the untriaged component)
* [https://bugzilla.mozilla.org/buglist.cgi?f1=status_whiteboard&o3=notsubstring&list_id=13314898&v3=intermittent-failure&o1=notsubstring&resolution=---&o2=notsubstring&query_format=advanced&f3=keywords&f2=status_whiteboard&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&v1=triaged&component=Android&component=Compatibility&component=Developer%20Tools&component=Experiments&component=Frontend&component=General&component=Request%20Handling&component=Untriaged&v2=design-decision-needed&product=WebExtensions Untriaged] (note: this is different from the untriaged component)
* [https://bugzilla.mozilla.org/buglist.cgi?f1=status_whiteboard&list_id=13314907&o1=anywordssubstr&resolution=---&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&v1=design-decision-needed&component=WebExtensions%3A%20Android&component=WebExtensions%3A%20Compatibility&component=WebExtensions%3A%20Developer%20Tools&component=WebExtensions%3A%20Experiments&component=WebExtensions%3A%20Frontend&component=WebExtensions%3A%20General&component=WebExtensions%3A%20Request%20Handling&component=WebExtensions%3A%20Untriaged&product=Toolkit Design Decision Needed]
* [https://bugzilla.mozilla.org/buglist.cgi?f1=status_whiteboard&list_id=13314907&o1=anywordssubstr&resolution=---&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&v1=design-decision-needed&component=Android&component=Compatibility&component=Developer%20Tools&component=Experiments&component=Frontend&component=General&component=Request%20Handling&component=Untriaged&product=WebExtensions Design Decision Needed]
* [https://bugzilla.mozilla.org/buglist.cgi?f1=status_whiteboard&list_id=13314907&o1=anywordssubstr&resolution=---&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&v1=advisory-group&component=WebExtensions%3A%20Android&component=WebExtensions%3A%20Compatibility&component=WebExtensions%3A%20Developer%20Tools&component=WebExtensions%3A%20Experiments&component=WebExtensions%3A%20Frontend&component=WebExtensions%3A%20General&component=WebExtensions%3A%20Request%20Handling&component=WebExtensions%3A%20Untriaged&product=Toolkit Advisory Group]
* [https://bugzilla.mozilla.org/buglist.cgi?f1=status_whiteboard&list_id=13314907&o1=anywordssubstr&resolution=---&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&v1=advisory-group&component=Android&component=Compatibility&component=Developer%20Tools&component=Experiments&component=Frontend&component=General&component=Request%20Handling&component=Untriaged&product=WebExtensions Advisory Group]
* [https://bugzilla.mozilla.org/buglist.cgi?list_id=13314906&resolution=---&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=WebExtensions%3A%20Android&component=WebExtensions%3A%20Compatibility&component=WebExtensions%3A%20Developer%20Tools&component=WebExtensions%3A%20Experiments&component=WebExtensions%3A%20Frontend&component=WebExtensions%3A%20General&component=WebExtensions%3A%20Request%20Handling&component=WebExtensions%3A%20Untriaged&product=Toolkit All bugs]
* [https://bugzilla.mozilla.org/buglist.cgi?list_id=13314906&resolution=---&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=Android&component=Compatibility&component=Developer%20Tools&component=Experiments&component=Frontend&component=General&component=Request%20Handling&component=Untriaged&product=WebExtensions All bugs]
* [https://bugzilla.mozilla.org/buglist.cgi?list_id=13315397&resolution=FIXED&chfieldto=Now&query_format=advanced&chfield=cf_last_resolved&chfieldfrom=-17d&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&component=WebExtensions%3A%20Android&component=WebExtensions%3A%20Compatibility&component=WebExtensions%3A%20Developer%20Tools&component=WebExtensions%3A%20Experiments&component=WebExtensions%3A%20Frontend&component=WebExtensions%3A%20General&component=WebExtensions%3A%20Request%20Handling&component=WebExtensions%3A%20Untriaged&product=Toolkit Closed in past 17 days]
* [https://bugzilla.mozilla.org/buglist.cgi?list_id=13315397&resolution=FIXED&chfieldto=Now&query_format=advanced&chfield=cf_last_resolved&chfieldfrom=-17d&bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&component=Android&component=Compatibility&component=Developer%20Tools&component=Experiments&component=Frontend&component=General&component=Request%20Handling&component=Untriaged&product=WebExtensions Closed in past 17 days]


==== Firefox 57 ====
==== Firefox 57 ====
Line 28: Line 30:
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.
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.


* [https://bugzilla.mozilla.org/buglist.cgi?list_id=13377474&o1=equals&v1=%2B&f1=cf_blocking_webextensions&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=WebExtensions%3A%20Android&component=WebExtensions%3A%20Compatibility&component=WebExtensions%3A%20Developer%20Tools&component=WebExtensions%3A%20Experiments&component=WebExtensions%3A%20Frontend&component=WebExtensions%3A%20General&component=WebExtensions%3A%20Request%20Handling&component=WebExtensions%3A%20Untriaged&product=Toolkit webextensions+]
* [https://bugzilla.mozilla.org/buglist.cgi?list_id=13377474&o1=equals&v1=%2B&f1=cf_blocking_webextensions&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=Android&component=Compatibility&component=Developer%20Tools&component=Experiments&component=Frontend&component=General&component=Request%20Handling&component=Untriaged&product=WebExtensions webextensions+]
* [https://bugzilla.mozilla.org/buglist.cgi?list_id=13377455&o1=equals&v1=%3F&f1=cf_blocking_webextensions&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=WebExtensions%3A%20Android&component=WebExtensions%3A%20Compatibility&component=WebExtensions%3A%20Developer%20Tools&component=WebExtensions%3A%20Experiments&component=WebExtensions%3A%20Frontend&component=WebExtensions%3A%20General&component=WebExtensions%3A%20Request%20Handling&component=WebExtensions%3A%20Untriaged&product=Toolkit webextensions?]
* [https://bugzilla.mozilla.org/buglist.cgi?list_id=13377455&o1=equals&v1=%3F&f1=cf_blocking_webextensions&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=Android&component=Compatibility&component=Developer%20Tools&component=Experiments&component=Frontend&component=General&component=Request%20Handling&component=Untriaged&product=WebExtensions webextensions?]


== Communication and meetings ==
== Communication and meetings ==


* There is a [[Add-ons/Projects#New_WebExtension_APIs|list of prioritized WebExtension APIs]] publicly available as part of [[Add-ons/Projects|ongoing Add-ons work]].
* There are [https://wiki.mozilla.org/Add-ons/developer/communication developer resources] to help you through the migration.
* There are [https://wiki.mozilla.org/Add-ons/developer/communication developer resources] to help you through the migration.
* Currently every week there is a [https://wiki.mozilla.org/Add-ons/developer/communication#Add-on_Developer_Communication_Calendar public triage meeting] of the bugs we hope to complete.
* Currently every week there is a [https://wiki.mozilla.org/Add-ons/developer/communication#Add-on_Developer_Communication_Calendar public triage meeting] of the bugs we hope to complete.
* Every other week there is a [https://wiki.mozilla.org/Add-ons/Contribute/Triage triage of WebExtensions APIs].
* Every week there is a [https://wiki.mozilla.org/WebExtensions/Triage triage of WebExtensions APIs].
* Join the mailing list at [https://mail.mozilla.org/listinfo/dev-addons dev-addons@mozilla.org].
* Join the mailing list at [https://mail.mozilla.org/listinfo/dev-addons dev-addons@mozilla.org].
* 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 47: Line 50:
== Permission Model ==
== Permission Model ==


We currently enforce [https://developer.chrome.com/extensions/declare_permissions manifest permissions] for [[WebExtensions#List_of_supported_APIs|the supported APIs]]. We also enforce CSP protections.
We currently enforce [https://developer.chrome.com/extensions/declare_permissions manifest permissions] for [https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API the supported APIs]. We also enforce CSP protections.


== Namespacing ==
== Namespacing ==
Line 55: Line 58:
== 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 WebExtensions 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 63: Line 66:
== 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.
Line 70: Line 73:


The list of APIs and their status is now maintained on [https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities MDN]. We intend to fix any of the exceptions listed there.
The list of APIs and their status is now maintained on [https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities MDN]. We intend to fix any of the exceptions listed there.
Please also see [http://arewewebextensionsyet.com 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 ==
== Additional APIs ==
Line 79: Line 80:
*If you'd like to become familiar with Mozilla infrastructure so you can develop WebExtensions APIs directly for Firefox, follow these steps:
*If you'd like to become familiar with Mozilla infrastructure so you can develop WebExtensions APIs directly for Firefox, follow these steps:
**Familiarize yourself with the on-boarding materials: [http://areweeveryoneyet.org/onramp/desktop.html Onboard to Firefox codebase]
**Familiarize yourself with the on-boarding materials: [http://areweeveryoneyet.org/onramp/desktop.html Onboard to Firefox codebase]
**Pick a [https://bugzilla.mozilla.org/buglist.cgi?quicksearch=component%3AWebExtensions%20keyword%3Agood-first-bug&list_id=13160623 "Good First Bug"] to work on
**Pick a [https://bugzilla.mozilla.org/buglist.cgi?quicksearch=product%3AWebExtensions%20keyword%3Agood-first-bug&list_id=13160623 "Good First Bug"] to work on


*If you just want to tinker with WebExtensions APIs without having to build Firefox, [http://webextensions-experiments.readthedocs.io/en/latest/index.html WebExtensions Experiments] is for you!
*If you just want to tinker with WebExtensions APIs without having to build Firefox, [http://webextensions-experiments.readthedocs.io/en/latest/index.html WebExtensions Experiments] is for you!
Line 92: Line 93:


Here is a list of all [https://wiki.mozilla.org/Add-ons/Contribute add-on contribution opportunities].
Here is a list of all [https://wiki.mozilla.org/Add-ons/Contribute add-on contribution opportunities].
== Frequently-Asked Questions ==
You can find more information about WebExtensions on [[WebExtensions/FAQ|our FAQ page]].

Latest revision as of 02:11, 5 September 2018

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; a cross-browser system for developing extensions. 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: the API is called "WebExtensions" because it can be found in search engines; "Web Extensions" (with a space) does not yield relevant results. Information on terminology usage is available here.

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 WebExtensions 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.

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.

Frequently-Asked Questions

You can find more information about WebExtensions on our FAQ page.