Mozilla Addons Blog: Extensions in Firefox 64 |
Following the explosion of extension features in Firefox 63, Firefox 64 moved into Beta with a quieter set of capabilities spread across many different areas.
The most visible change to extensions comes on the user-facing side of Firefox where the add-ons management page (about:addons) received an upgrade.
Changes on this page include:
These changes are part of an ongoing redesign of about:addons that will make managing extensions and themes within Firefox simpler and more intuitive. You can expect to see additional changes in 2019.
As part of our continuing effort to make sure users are aware of when an extension is controlling some aspect of Firefox, the Notification Permissions window now shows when an extension is controlling the browser’s ability to accept or reject web notification requests.
When an extension is installed, the notification popup is now persistently shown off of the main (hamburger) menu. This ensures that the notification is always acknowledged by the user and can’t be accidentally dismissed by switching tabs.
Finally, extensions can now be removed by right-clicking on an extension’s browser action icon and selecting “Remove Extension” from the resulting context menu.
Firefox 63 saw a large number of improvements for extension context menus and, as promised, there are even more improvements in Firefox 64.
The biggest change is a new API that can be called from the contextmenu
DOM event to set a custom context menu in extension pages. This API, browser.menus.overrideContext()
, allows extensions to hide all default Firefox menu items in favor of providing a custom context menu UI. This context menu can consist of multiple top-level menu items from the extension, and may optionally include tab or bookmark context menu items from other extensions.
To use the new API, you must declare the menus
and the brand new menus.overrideContext
permission. Additionally, to include context menus from other extensions in the tab or bookmarks contexts, you must also declare the tabs
or bookmarks
permissions, respectively.
The API is still being documented on MDN at the time of this writing, but the API takes a contextOptions
object as a parameter, which includes the following values:
showDefaults
: boolean that indicates whether to include default Firefox menu items in the context menu (defaults to false)context
: optional parameter that indicates the ContextType
to override to allow menu items from other extensions in this context menu. Currently, only bookmark
and tab
are supported. showDefaults
cannot be used with this option.bookmarkId
: required when context is bookmark
. Requires bookmarks
permission.tabId
: required when context is tab
. Requires tabs
permission.While waiting for the MDN documentation to go live, I would highly encourage you to check out the terrific blog post by Yuki “Piro” Hiroshi that covers usage of the new API in great detail.
Other improvements to extension context menus include:
browser.menus.update()
now allows extensions to update an icon without having to delete and recreate the menu item.menus.create()
and menus.update()
now support a viewTypes property. This is a list of view types that specifies where the menu item will be shown and can include tab
, popup
(pageAction/browserAction) or sidebar
. It defaults to any view, including those without a viewType.menus.onShown
and menus.onClicked
events now include the viewType described above as part of their info object so extensions can determine the type of view where the menu was shown or clicked.menus.onClicked
event also added a button property to indicate which mouse button initiated the click (left, middle, right).In addition to the extension management in Firefox and the context menu work, many smaller improvements were made throughout the WebExtension API.
tabs.create()
and windows.create()
now open the about:privatebrowsing page instead of about:newtab.browser.search.search()
API no longer requires user input in order to be called. This makes the API much more useful, especially in asynchronous event listeners. This feature was also uplifted to Firefox 63.identity.launchWebAuthFlow()
API so that the redirect_uri parameter is no longer mandatory. This fixes some OAuth services that require the redirect_uri be configured on the service.port.onMessage
is now properly fired in content scripts from non-tabs locations (sidebar, extension popup views)A total of 73 features and improvements landed as part of Firefox 64. Volunteer contributors were a huge part of this release and a tremendous thank you goes out to our community, including: Oriol Brufau, Tomislav Jovanovic, Shivam Singhal, Tim Nguyen, Arshad Kazmi, Divyansh Sharma, Tom Schuster, Tim B, Tushar Arora, Prathiksha Guruprasad. It is the combined efforts of Mozilla and our amazing community that make Firefox a truly unique product. If you are interested in contributing to the WebExtensions ecosystem, please take a look at our wiki.
The post Extensions in Firefox 64 appeared first on Mozilla Add-ons Blog.
https://blog.mozilla.org/addons/2018/11/08/extensions-in-firefox-64/
Комментировать | « Пред. запись — К дневнику — След. запись » | Страницы: [1] [Новые] |