Work in progress
This article describes the changes you'll need to be aware of if you are porting an extension from Chrome or Opera to run on Firefox.
Briefly, the process of porting an extension from Chrome or Opera is like this:
- Review your use of manifest.json features and WebExtension APIs. If you're using features or APIs that are not yet supported in Firefox, you may not be able to port your extension yet.
- Add the
applications
key to the extension's manifest.json file. - Check you have done the basic setup for installing WebExtensions in Firefox.
- Package the extension as an XPI, install the extension in Firefox, and test it.
- Submit it to AMO for signing and distribution.
The biggest issue right now is the first in the above list. Firefox currently has support for only a limited set of WebExtension features. We're working on adding more support, but many features are not yet supported, and we may never support some.
In the rest of this article we'll list the features and APIs that are fully or partially supported in Firefox. It's safe to assume that features and APIs not listed here are not yet supported.
manifest.json features
Fully supported keys
applications
default_locale
description
browser_action
manifest_version
name
version
web_accessible_resources
Partially supported keys
background
Firefox does not support the "persistent"
property. Background scripts stay loaded all the time.
content_scripts
Firefox does not currently support:
include_globs
exclude_globs
match_about_blank
permissions
Firefox does not yet support the following permissions:
activeTab
background
clipboardRead
clipboardWrite
geolocation
nativeMessaging
unlimitedStorage
Obviously, it also don't yet support permissions for APIs that are themselves not supported.
JavaScript APIs
Fully supported APIs
Partially supported APIs
browserAction
Firefox does not support:
- the
imageData
attribute onsetIcon()
. enable()
ordisable()
.
extension
Firefox only supports:
getBackgroundPage()
getURL()
i18n
- In the JavaScript API, Firefox only supports
getMessage()
. - Firefox only supports the
@@extension_id
and@@ui_locale
predefined messages. - Firefox does not 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
, andmessage
. - The only supported methods we support are
create()
,clear()
, andgetAll()
. - The only supported event is
onClosed
. Firefox doesn't providebyUser
data.
runtime
Firefox only supports onStartup
, getManifest()
, id
, and the message passing interfaces (sendMessage()
, onMessage
, onConnect
).
storage
- The only storage area Firefox supports support is
local
. - Firefox does not support
getBytesInUse()
orclear()
.
tabs
Firefox does not support:
getCurrent()
sendRequest()
getSelected()
duplicate()
highlight()
move()
detectLanguage()
captureVisibleTab()
getZoom()
setZoom()
getZoomSettings()
setZoomSettings()
Firefox treats highlighted
and active
as the same since Firefox cannot select multiple tabs.
webNavigation
Firefox does not support:
getFrame()
getAllFrames()
onCreatedNavigationTarget
onHistoryStateUpdated
- transition types and qualifiers
- Filtering
onReferenceFragmentUpdated
also triggers for pushState
.
webRequest
Firefox does not support:
handlerBehaviorChanged()
onAuthRequired
onBeforeRedirect
onErrorOccurred
Requests can be:
- canceled only in
onBeforeRequest
- 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 thefocused
,type
, orstate
options.update()
only supports thefocused
option.
Planned APIs
We don't yet support the following APIs, but plan to, soon:
- bookmarks
- commands
- contextMenus
- cookies
- Devtools (mostly panels)
- downloads
- history
- idle
- omnibox
- pageAction
- permissions
- Native messaging (runtime.connectNative)