Перевод не завершен. Пожалуйста, помогите перевести эту статью с английского.
Веб расширения разработаны с поддержкой совместимости с расширениями Хрома и Оперы на сколько это возможно. Расширения, написанные для этих браузеров, должны работать в Firefox с минимальными изменениями.
Все же, Firefox на данный момент имеет поддержку только для ограниченного набора функций и API, поддержуемых в Хроме и Опере. Мы работаем над добавлением большей поддержки, но много функций пока еще не поддерживаются и некоторые из них никогда не будут поддерживаться.
Эта статья перечисляет все функции и API, которые полностью поддерживаются в Firefox Developer Edition (на данный момент Firefox 47). Там где функция поддерживается частично, мы указали на проблемные места.
You should assume that features and APIs not listed here at all are not yet supported.
manifest.json функция
Полностью поддерживаемые ключи:
applications
browser_action
default_locale
description
icons
manifest_version
name
page_action
version
web_accessible_resources
Частично поддерживаемые ключи:
background
Firefox не поддерживает "устойчивое"
свойство. Фоновые скрипты остаются загруженными всё время.
commands
Firefox не поддерживает:
- Media keys как сокращение
global
- специальную комманду
_execute_browser_action
content_scripts
Firefox не поддерживает:
match_about_blank
content_security_policy
Firefox не поддерживает:
- "https://127.0.0.1" or "https://localhost" as script sources: they must be served over HTTPS.
options_ui
Firefox не поддерживает:
chrome_style
Using options_ui
requires a valid value for the applications.gecko.id property.
permissions
Firefox не поддерживает следующие разрешения:
background
clipboardRead
clipboardWrite
geolocation
unlimitedStorage
Obviously, it doesn't support permissions for APIs that are themselves not supported.
incognito
Firefox does not support the following incognito (private browsing) modes:
split
JavaScript APIs
Fully supported APIs
- alarms
- browserAction
- Relative URLs passed to
setPopup()
are resolved relative to the caller document, rather than to the extension root
- Relative URLs passed to
- commands
- contextMenus
- cookies
- i18n
- pageAction
- Relative URLs passed to
setPopup()
are resolved relative to the caller document, rather than to the extension root
- Relative URLs passed to
Partially supported APIs
bookmarks
- Firefox does not support:
import()
export()
onCreated
onRemoved
onChanged
onMoved
onChildrenReordered
onImportBegan
onImportEnded
BookmarkTreeNodeUnmodifiable
- Firefox has special bookmarks like "Recently Bookmarked" or "Recently Visited"
contextMenus
- Firefox does not support:
- the "browser_action" or "page_action" context types
downloads
- Firefox does not support:
drag()
acceptDanger()
setShelfEnabled()
onDeterminingFilename
- The
saveAs
option and values other than"GET"
for themethod
option are not supported bydownload()
extension
- Firefox does not support:
setUpdateUrlData()
- Additionally, the following deprecated properties will not be supported:
onRequest
onRequestExternal
getExtensionTabs()
sendRequest()
idle
- Firefox does not support:
onStateChanged
setDetectionInterval()
Additoinally, queryState()
always returns "active"
in Firefox, regardless of the current system idle state.
notifications
- Firefox does not support:
update()
- Firefox doesn't provide
byUser
data.
runtime
- Firefox does not support:
getPackageDirectoryEntry()
reload()
requestUpdateCheck()
restart()
sendNativeMessage()
onBrowserUpdateAvailable
onConnectExternal
onInstalled
onMessageExternal
onRestartRequired
onStartup
onSuspend
onSuspendCanceled
onUpdateAvailable
storage
- Firefox does not support:
managed
storage areasync
storage areagetBytesInUse()
.
tabs
- Firefox treats
highlighted
andactive
as the same, since Firefox has no concept of selecting multiple tabs. - In Firefox, you need the
tabs
permission if you want to includeurl
in thequeryInfo
parameter totabs.query()
. -
In Firefox, relative URLs passed into
tabs.executeScript()
ortabs.insertCSS()
are resolved relative to the current page URL. In Chrome, these URLs are resolved relative to the add-on's base URL. To work cross-browser, you can specify the path as an absolute URL, starting at the add-on's root, like this:/path/to/script.js
- In Firefox, you can't open (using
tabs.create
), or navigate to (usingtabs.update
) privileged URLs:- chrome: URLs
- javascript: URLs
- data: URLs
- privileged about: URLs (for example, about:config, about:addons, about:debugging)
- Additionally, the following deprecated properties will not be supported:
sendRequest()
getSelected()
onActiveChanged
onHighlightChanged
onSelectionChanged
webNavigation
- Firefox does not support:
onCreatedNavigationTarget
onTabReplaced
webRequest
- Firefox does not support:
onAuthRequired
- filtering by
windowId
andtabId
- the
"requestBody"
instruction inopt_extraInfoSpec
- In Firefox requests can be redirected only if their original URL uses the http or https scheme
windows
- Firefox does not support:
- the
focused
option increate()
- the
- In Firefox
onFocusChanged
will trigger multiple times for a given focus change.
Planned APIs
We don't support the following APIs, but plan to, soon:
This doesn't mean that these are the only additional APIs we will support, but that they are our current priorities.
Miscellaneous incompatibilities
Optional arguments
URLs in CSS
Firefox resolves URLs in injected CSS files relative to the CSS file itself, rather than to the page it's injected into.
Additional incompatibilities
Firefox does not support using alert() from background pages. Using alert(message)
from a background page will cause the Browser Console to be opened and both a line stating "alert() is not supported in background windows; please use console.log instead." and the message
will be output to the console.