WebExtensions: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Add exceptions to supported APIs)
(More errata.)
Line 13: Line 13:


== List of supported APIs ==
== List of supported APIs ==
Note that we expect to fix virtually all of the exceptions printed below.


* [https://developer.chrome.com/extensions/alarms alarms]
* [https://developer.chrome.com/extensions/alarms alarms]
** This API is entirely supported.
* [https://developer.chrome.com/extensions/browserAction browserAction]
* [https://developer.chrome.com/extensions/browserAction browserAction]
** We don't support the imageData attribute on setIcon.
** We don't support the imageData attribute on setIcon.
** We don't support enable or disable.
** We don't support enable or disable.
* [https://developer.chrome.com/extensions/extension extension]
* [https://developer.chrome.com/extensions/extension extension]
** We support only getBackgroundPage and getURL.
** We support only getBackgroundPage and getURL.
* [https://developer.chrome.com/extensions/i18n i18n]
* [https://developer.chrome.com/extensions/i18n i18n]
** We support only getMessage in the JavaScript API.
** We support only getMessage in the JavaScript API.
Line 25: Line 31:
** We don't localize CSS files.
** We don't localize CSS files.
** Strings to be localized must consist entirely of __MSG_foo__ in order for a substitution to be made.
** Strings to be localized must consist entirely of __MSG_foo__ in order for a substitution to be made.
* [https://developer.chrome.com/extensions/notifications notifications]
* [https://developer.chrome.com/extensions/notifications notifications]
** The only supported notification options are iconUrl, title, and message.
** The only supported notification options are iconUrl, title, and message.
** The only methods we support are create, clear, and getAll.
** The only methods we support are create, clear, and getAll.
** The only event we support is onClosed. We don't provide byUser data.
** The only event we support is onClosed. We don't provide byUser data.
* [https://developer.chrome.com/extensions/runtime runtime]
* [https://developer.chrome.com/extensions/runtime runtime]
** We support onStartup, getManifest, id, and the message passing interfaces (sendMessage, onMessage, onConnect).
* [https://developer.chrome.com/extensions/storage storage]
* [https://developer.chrome.com/extensions/storage storage]
** The only storage area we support is local.
** We don't support getBytesInUse or clear.
* [https://developer.chrome.com/extensions/tabs tabs]
* [https://developer.chrome.com/extensions/tabs tabs]
** Unsupported functions: getCurrent, sendRequest, getSelected, duplicate, highlight, move, detectLanguage, captureVisibleTab, get/setZoom, get/setZoomSettings. We probably will never support detectLanguage or captureVisibleTab.
** We treat highlighted and active as effectively the same since Firefox cannot select multiple tabs.
* [https://developer.chrome.com/extensions/webNavigation webNavigation]
* [https://developer.chrome.com/extensions/webNavigation webNavigation]
** We don't support getFrame or getAllFrames.
** We don't support onCreatedNavigationTarget or onHistoryStateUpdated.
** We don't support transition types and qualifiers.
** onReferenceFragmentUpdated also triggers for pushState.
** Filtering is unsupported.
* [https://developer.chrome.com/extensions/webRequest webRequest]
* [https://developer.chrome.com/extensions/webRequest webRequest]
** We don't support handlerBehaviorChanged.
** We don't support onAuthRequired, onBeforeRedirect, or onErrorOccurred.
** Requests can be canceled only in onBeforeRequest.
** Requests can be modified/redirected only in onBeforeSendHeaders.
** Responses can be modified only in onHeadersReceived.
* [https://developer.chrome.com/extensions/windows windows]
* [https://developer.chrome.com/extensions/windows windows]
** onFocusChanged will trigger multiple times for a given focus change.
** create does not support the focused, type, or state options.
** update only supports the focused option.


== List of APIs we will likely support in the future ==
== List of APIs we will likely support in the future ==
Line 47: Line 78:
* [https://developer.chrome.com/extensions/omnibox omnibox]
* [https://developer.chrome.com/extensions/omnibox omnibox]
* [https://developer.chrome.com/extensions/pageAction pageAction]
* [https://developer.chrome.com/extensions/pageAction pageAction]
* [https://developer.chrome.com/extensions/permissions permissions]


== Custom APIs for Firefox ==
== Custom APIs for Firefox ==
Line 52: Line 84:
We plan to add our own APIs based on the needs of existing Firefox add-ons.
We plan to add our own APIs based on the needs of existing Firefox add-ons.


* NoScript-type functionality.
* Sidebars
* Sidebars
* Toolbars
* Toolbars
* Keyboard shortcuts
* Keyboard shortcuts

Revision as of 22:26, 17 July 2015

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

  • It should be easier to use.
  • It must be compatible with multiprocess Firefox (Electrolysis).
  • Porting add-ons to and from other browsers should be easier.
  • Changes to Firefox's internal code should be less likely to break add-ons.
  • It should be easier to review add-ons to reduce the backlog on addons.mozilla.org.

Much of the specifics of the new API are similar to the Chrome extension API. Google has extensive documentation on the API.

We hope to ship a preliminary version of this API in Firefox 42.

For the time being, extensions will still be packaged as .xpi files. The .xpi file will contain the same files as the Chrome extension, including manifest.json. It will also include bootstrap.js and install.rdf files that allow it to be loaded into Firefox.

List of supported APIs

Note that we expect to fix virtually all of the exceptions printed below.

  • alarms
    • This API is entirely supported.
  • browserAction
    • We don't support the imageData attribute on setIcon.
    • We don't support enable or disable.
  • extension
    • We support only getBackgroundPage and getURL.
  • i18n
    • We support only getMessage in the JavaScript API.
    • We only support @@extension_id and @@ui_locale predefined messages.
    • We don't localize CSS files.
    • Strings to be localized must consist entirely of __MSG_foo__ in order for a substitution to be made.
  • notifications
    • The only supported notification options are iconUrl, title, and message.
    • The only methods we support are create, clear, and getAll.
    • The only event we support is onClosed. We don't provide byUser data.
  • runtime
    • We support onStartup, getManifest, id, and the message passing interfaces (sendMessage, onMessage, onConnect).
  • storage
    • The only storage area we support is local.
    • We don't support getBytesInUse or clear.
  • tabs
    • Unsupported functions: getCurrent, sendRequest, getSelected, duplicate, highlight, move, detectLanguage, captureVisibleTab, get/setZoom, get/setZoomSettings. We probably will never support detectLanguage or captureVisibleTab.
    • We treat highlighted and active as effectively the same since Firefox cannot select multiple tabs.
  • webNavigation
    • We don't support getFrame or getAllFrames.
    • We don't support onCreatedNavigationTarget or onHistoryStateUpdated.
    • We don't support transition types and qualifiers.
    • onReferenceFragmentUpdated also triggers for pushState.
    • Filtering is unsupported.
  • webRequest
    • We don't support handlerBehaviorChanged.
    • We don't support onAuthRequired, onBeforeRedirect, or onErrorOccurred.
    • Requests can be canceled only in onBeforeRequest.
    • Requests can be modified/redirected only in onBeforeSendHeaders.
    • Responses can be modified only in onHeadersReceived.
  • windows
    • onFocusChanged will trigger multiple times for a given focus change.
    • create does not support the focused, type, or state options.
    • update only supports the focused option.

List of APIs we will likely support in the future

Custom APIs for Firefox

We plan to add our own APIs based on the needs of existing Firefox add-ons.

  • NoScript-type functionality.
  • Sidebars
  • Toolbars
  • Keyboard shortcuts