Firefox Extensions

Extensions in Firefox 59

Firefox Quantum continues to make news as Mozilla incorporates even more innovative technology into the platform. The development team behind the WebExtensions architecture is no exception, landing a slew of new API and improvements that can now be found in Firefox 59 (just released to the Beta channel).

As always, documentation for the API discussed here can be found on MDN Web Docs (some of the features below are just hitting the main branch as of this post, so if you don’t find the documentation on MDN, check back in a few days).

Experimental Tab Hiding

Tab hiding is back! Since the deprecation of the legacy extension architecture, one of the most requested features has been the ability to hide tabs with the WebExtensions API. It was a key element of some very popular legacy add-ons that provided the ability to manage tab groups. Firefox 59 brings this capability back in an initial, experimental form.

The API is very straightforward:

  • Include the “tabHide” permission in your manifest file.
  • Use tabs.hide() with the tab ID (or list of tab IDs) to hide tabs.
  • Use tabs.show() with the tab ID (or list of tab IDs) to show hidden tabs.
  • Examine the tabs.Tab.hidden field to determine if a tab is currently hidden.

Note that the visible state of a tab is completely independent from its discarded state. While it may make sense to keep certain tabs active and loaded in memory while hidden, we encourage you to use tabs.discard() in combination with tabs.hide() to help manage memory and resource usage.

There are certain restrictions when hiding tabs:

  • Tabs that are pinned cannot be hidden
  • Tabs that are sharing their screen, microphone or camera cannot be hidden
  • The current active tab cannot be hidden
  • Tabs that are in the process of being closed cannot be hidden

The reintroduction of hidden tabs to Firefox does not come without some concern. A primary motivation for moving to the WebExtensions framework is to offer users a safer extension ecosystem that can be trusted to protect their security and privacy. Obviously, tab hiding opens the door for malicious extensions to hide tabs, doing things in the background without a user’s knowledge.

To make sure we get things right, tab hiding is disabled by default. To enable the API, you must manually go to the about:config page and set extensions.webextensions.tabhide.enabled to true. This restriction will remain in place until:

  • Additional user interface features are added to Firefox that allow users to see all of their hidden tabs and/or show those tabs independent of any extension. This user interface work is currently active and on-going.
  • Developers (internal and external) have had some time to try the API and understand its strengths and weaknesses. In particular, we want some time to gather input on the potential for abuse.

To be clear, this API is currently experimental. It could change, or even go away entirely if we can’t provide it in a secure manner.  Nevertheless, Firefox has a long, proud history of customization and the team is committed to upholding that tradition with tab hiding. So please give the API a try and see what you think. With your help, we will work to make tab hiding as fully functional as possible while still maintaining the security of the WebExtensions architecture.

Want to jump right in a see what it’s like? Give the Tab Hider extension a try.

Additional Tab Features

While tab hiding is the big feature to land in Firefox 59, it isn’t the only thing related to tabs.

Even More Theme API

Continuing the “theme” of previous releases, Firefox 59 includes a number of additions to the Theme API that allow you to customize even more of the browser’s appearance, including:

Improvements to the webRequest API

The webRequest API now merges multiple headers with the same name rather than using only the last one. In addition, a couple of mechanisms were added to the webRequest API to allow for requests to be upgraded from HTTP to HTTPS.

Finally, to make debugging a lot easier, exceptions raised from a webRequest blocking listener now report the original error message and filename. Below is an example:

Before Firefox 59

Before Firefox 59

Starting With Firefox 59

Starting With Firefox 59

Register Content Scripts at Runtime

Another big feature landing with Firefox 59 is the ability to register content scripts at runtime. This is an important feature for extensions that want to support user scripting.

Using the contentScripts.register() API, extensions can dynamically associate content scripts with different URLs, lifting the previous limitation that all content scripts had to be listed statically in the manifest file.

Support for Decentralization Protocols

Mozilla has always been a proponent of decentralization, recognizing that it is a key ingredient of a healthy Internet. Starting with Firefox 59, several protocols that support decentralized architectures are approved for use by extensions.  The newly approved protocols are:

Firefox itself does not implement these protocols, but having them on the approved list means the browser recognizes them as valid protocols and extensions are free to provide implementations.

browserAction and pageAction Improvements

Browser Actions and Page Actions are two of the most popular types of extensions that we see submitted to the Firefox Add-Ons website.  Accordingly, the team behind WebExtensions continues to expand and improve the API for those types of extensions.

  • pageActions can now be shown and/or hidden automatically for specific pages via pattern matching using the “hide_matches” and “show_matches” manifest properties. This is a nice performance win for users.
  • browserAction set* methods can now accept a null value which removes the property from the browserAction.
  • Invalid badge background colors are now rejected (provides more Chrome compatibility).
  • An extension can now determine if its browserAction is enabled or disabled (browserAction.isEnabled), a pageAction is currently shown for a tab ( pageActions.isShown), and if its sidebarAction is currently open (sidebarAction.isOpen).

Enhancement to Cookies

The ability for extensions to control cookies in the browser expanded in Firefox 59, including:

Proxy Settings

Extensions can now override the proxy settings in the browser which has been another highly requested feature.  Using the browserSettings.proxyConfig.set() API, the following proxy settings can be controlled:

  • proxyType: The type of proxy to use.
  • http: The address of the http proxy, can include a port.
  • httpProxyAll: Use the http proxy server for all protocols.
  • ftp: The address of the ftp proxy, can include a port.
  • ssl: The address of the ssl proxy, can include a port.
  • socks: The address of the socks proxy, can include a port.
  • socksVersion: The version of the socks proxy.
  • passthrough: A list of hosts which should not be proxied.
  • autoConfigUrl: A URL to use to configure the proxy.
  • autoLogin: Do not prompt for authentication if password is saved.
  • proxyDNS: Proxy DNS when using SOCKS v5.

User Notification of Extensions Overrides

As with previous releases, when functionality is provided via WebExtensions that allows extensions to control some aspect of the browser, Firefox will inform the user which extension controls that aspect and provide a way for them to regain control.

The ability for an extension to control the browser’s tracking protection setting was added back in Firefox 57 via the websites.trackingProtectionMode API. Firefox 59 now shows when an extension controls tracking protection.

Tracking Protection Notification

In the above image, notice that a message is now displayed after a user disables an extension reminding them how to re-enable it, also a new feature of Firefox 59.

One of the most popular browser defaults to override is the new tab page. Firefox already shows the user when an extension has overridden that page, but starting with Firefox 59 it also informs the user of the override on the first appearance of the new tab page itself. Plus, it is smart enough to revert back to the previous new tab if the new override is declined.

Restore New Tab

Additional Browser Controls

To better support mouse gestures, browserSettings.contextMenuShowEvent() has been added in this version. This new API can be set to “mouseup” or “mousedown” by extensions to determine when context menus should be shown. Note that this is not supported on Android, and also calling it with a value of “mousedown” on Windows is a no-op.

Also in Firefox 59, read-only browserSettings now return false when calling set or clear and also report an accurate levelofControl.

Context Menus for Bookmarks

Speaking of context menus, you can now set custom context menus for bookmarks.  This will work on the bookmarks toolbar, the library menu, the bookmarks subview, and the bookmarks menu.

Development and Debugging

One of the best ways to suggest a new WebExtension API is to prototype it via an official experiment. Two major changes landed for WebExtension experiments that makes this significantly easier:

Also in Firefox 59, more detail has been added to sandbox names to aid in debugging.

Miscellaneous Changes and Fixes

A number of smaller items were also landed in the new Firefox 59 Beta, including:

More to Come

Firefox 59 landed a total of 69 items for WebExtensions, the most important of which are discussed above. Thank you to everyone who had a part in getting it to Beta, especially volunteer contributors Andre Garzia, Tim Nguyen, Oriol Brufau, Javier Serrano Polo, Kevin Jones, Tushar Arora, Martin Giger, Peter Snyder, Lukas Jung. Additional changes and improvements to the WebExtensions API are already in progress for Firefox 60, so please continue to send us your feedback. And as always, thank you for using Firefox and helping ensure that individuals have the ability to shape the Internet and their own experiences on it.

43 comments on “Extensions in Firefox 59”

  1. zakius wrote on

    well, I guess you are still not willing to bring back browser context events to deliver proper mouse gestures and keyboard shortcuts?

    1. peter wrote on

      Yes please, this is on the most wanted list for me!

      1. zakius wrote on

        for me it’s the only thing that stops me from migrating
        without proper gestures I simply CAN’T work
        every other extension? sure, at wors’t case I’ll write it myself, but these require a lot of work on the browser side and I won’t bother to learn another few languages to fix it and keep my fork alive

    2. Aaron wrote on

      1000 times this. Not being able to trigger extensions via customizable shortcuts is very aggravating, and not having emacs bindings for various small features (e.g., moving through address suggestions) is _killing_ me. It’s almost enough to make me go back to Chrome.

  2. Feedbro Reader wrote on

    Great work team! Thanks a lot for fixing WebExtension related issues and bringing useful new features as well! Your work is highly appreciated!

  3. ddavinci85 wrote on

    Thank you and Mozilla team for all hard work! I’m glad to see that more and more customization options are bring back to Firefox as the new WebExtensions API. I want to ask if there are any plans to provide support for customizable toolbars / sidebars / addonbars? It was part of features that were offered by legacy addons like Puzzle Bars or All-in-One Sidebar.

    1. kjemmo wrote on

      There is a Toolbar API planned, but the latest change is that priority was lowered from P2 to P3. Version is still unspecified, so it could be years till we can make use of toolbars (if ever). In my opinion this is a disaster and all the users of my add-ons are sticking to Firefox 56 and are complaining to me that the can not upgrade. All i can tell them is that Mozilla do not consider toolbars to be important. I loose many users to Chrome because of this. If I could a least tell them a version number where toolbars will be available again… Then they might wait it out.

      1. kjemmo wrote on

        Toolbar bug is here:
        https://bugzilla.mozilla.org/show_bug.cgi?id=1215064

        Please vote for it and request a higher priority if you want to see it available sooner rather than later.

        1. ChrisH wrote on

          I’ve seen requests before to “vote” for a feature on bugzilla… But I see no “vote” button. What is meant by “voting” for a feature??

  4. lidel wrote on

    Pstt.. for IPFS there are actually three new protocols: “ipfs”, “ipns” and “dweb” 🙂
    (https://hg.mozilla.org/mozilla-central/rev/c2cb8a06bcf1)

  5. NiklasG wrote on

    That’s a nice collection of new (old) features, I especially look forward to extensions making use of the tab-hiding.

    One regression that may be worth mentioning is that `@-moz-document` rules seem to have stopped working in styles applied with `tabs.insertCSS` unless the `cssOrigin` is set to `user`.

  6. Aidan wrote on

    Has the fact that there is no way for extensions to automatically clear the url bar with a custom new tab page been addressed?

  7. Robert Ab wrote on

    It will be really great to get better API support for session managers:
    http://tabmixplus.org/forum/viewtopic.php?p=73159#p73159
    The minimum APIs needed are described in bug 1381922, bug 1378651 & bug 1378647. I know that is impossible to get all functions available in Session Manager, but these 3 bugs (+3 already completed) are not enough. Discussion is needed how to implement in the better way APIs for these extensions; discussion started in bugs 1413525 & 1427928, but it stopped.

    I feel like Mozilla forgot about 1 mln users of session managers including Tab Mix Plus and Session Manager, and new ones like Tab Session Manager and MySessions.

    This reason and other related with no more security patches for FF56 (ESR) caused me and many other users to switch to Waterfox 56.

  8. Long Time Firefox User wrote on

    Thank you very much for your hard work, Vivaldi is a fantastic web browser and I’m really happy that I found it 🙂

  9. Nehemoth wrote on

    Excellent work.

    Please bring back the option for status bar too.
    Yes, a lot people love the status bar. To see what the browser it’s doing without hovering the mouse and also a nice extension launcher.

    Thanks

    1. Guillaume Chau wrote on

      What’s the browser doing is already displayed at the bottom left of the window in a temporary tooltip. A permanent status bar is useless and takes up space. And if you need buttons, you have the main toolbar for that.

      1. Not Firefox Anymore wrote on

        Yes, and the fact that that little overlay obscures web content is not a problem at all, no siree.

  10. Mike Miller wrote on

    These are all actions I used to be able to do without Mozilla so “kindly” granting me access to my browser and my machine in the latest gimped versions of Firefox.

    This false focus on security is overwhelmingly clueless and counterproductive.

    Without full-featured extensions, why would I use Firefox when I can use Chrome, a browser that is better-supported?

    Mozilla’s failure will be inevitably caused by such decisions.

    1. Guillaume Chau wrote on

      Chrome can’t hide tabs: https://developer.chrome.com/extensions/tabs

  11. Aris wrote on

    Regarding the tab hiding feature:

    “There are certain restrictions when hiding tabs:
    — The current active tab cannot be hidden”

    Wasn’t the point of requesting a “tab hiding” feature mainly to hide tabs toolbar, if only one tab is visible or to hide default tabs toolbar when using tab sidebar add-ons?
    Being forced to always keep current/active tab makes the whole tab hiding feature useless.

    1. Dan wrote on

      An extension can easily make a different tab active and then hide that tab. Tab hiding is mainly of interest for tab managers such as tab groups, which lets you switch back and forth between two groups of tabs. By hiding everything not in the group, you have toggled the group. In order to hide the current tab, just display one of the tabs from the other group, then hide the current tab. This will happen before the user even notices.

      Consider what they are really saying here: a tab cannot be hidden and remain your current tab. And what use would that be anyway?

  12. Harry wrote on

    What about bringing back XUL/Legacy extensions?

  13. Ben wrote on

    These are definite improvements, but until it either supports a built-in feature or add-on to produce something akin to the old It’s All Text! add-on then I for one won’t be wasting my time.

    The ability to use the text editor if my choice when editing textareas or other editable fields is a deal-breaker.

    Which is why for the moment I’m effectively (and somewhat unwillingly) locked into Chrome for a lot of things now. Except for those things which can be accessed by my text editor alone.

    This comment was made with Emacs via w3m.

  14. Leigh Harrison wrote on

    Bring back FireFTP. Im astounded how much more arduous my work flow is without it.

  15. Kees wrote on

    Although this is good news I would also appreciate it that Mozilla supplies APIs to allo Tile Tabs WE works the same as using the classic XUL based add-on.

    And also: When doing any new API-s then check what was popular in the classic (and VERY, VERY flexible) XUL/XPCOM based add-ons so that withing about 6-9 months 90% of all actively developped XUL based addons can have a PROPER (not a cut-down version) WebExtension…

  16. Name (required) wrote on

    Have the extension APIs restored the capability for for a multi-row tab bar, or are you leaving this feature out to prevent Firefox from looking too different from Chrome?

  17. Ex- User wrote on

    Tbh, all this is too little too late, I’ve now changed to Chrome for all my browsing needs and am not looking back.

  18. Werner wrote on

    Restrictions like this

    There are certain restrictions when hiding tabs:
    The current active tab cannot be hidden

    make tab hiding feature useless. Neither hiding tabs toolbar with one visible tab nor hiding tabs toolbar for tab-sidebar add-ons is possible this way.

  19. Nathan Myers wrote on

    There is only one feature that I have wanted for many years: I want an easy way to discover which damn tab is pegging CPU usage at 100%.

    Better would be a (revocable) limit on how many CPU seconds a tab could burn without getting further permission, or on what fraction of a CPU second they are allowed to burn, per second.

    The tabs themselves could have a color bar or heat map showing how much of one CPU they are eating.

    I use uMatrix, which is super-wonderful but has a rather heavy UI, and, I suspect, causes some pages to go 100% CPU while they wait for completion of a script that will never run.

    1. PeaceByJesus wrote on

      Yes, with over 200 tabs open (multiple tab rows, width reduced via TMP, and with Colorful Tabs, and the superb FT DeepDark theme, under FF ESR 52.5.2 64-bit), I would like this once the extension I would lose by updating become available. If not, its FF ESR till them or a spin-off. Thank God for those who produce what we have.

    2. Guillaume Chau wrote on

      Open a tab and go to `about:performance`.

  20. Michael wrote on

    Please provide an API that will enable “tab focus on mouse hover” for accessibility.

  21. Adin wrote on

    Panorama and then Tab Groups were the best features of Firefox and still don’t exist in Chrome or Edge. It will be a welcome return.

  22. timendum wrote on

    Thanks for the post, I was inspired and updated my four years old extension to WebExtension via proxyConfig.

    https://addons.mozilla.org/firefox/addon/reload-pac-button/versions/

  23. Adamo wrote on

    Please bring back the ability for extensions to clear the url bar of a custom new tab page when a new tab is opened or at least, to select the url, so that we can directly type an url or a search without doing a click.
    There is a bug opened about this regression here https://bugzilla.mozilla.org/show_bug.cgi?id=1409675

  24. Praveen S wrote on

    I installed our product on FF 58 which take over the new tab page. Used this extension for a couple of weeks and then, I updated FF version from 58 to 59.

    After browser update, “new tab page changed” popup appeared.

    Expected results:
    After browser update, “new tab page changed” popup should not appear as the user already used this extension.

  25. Steven wrote on

    I see many requests on the forums for setting default page zoom percent but it still hasn’t made it newer versions. Very annoying for anyone not using max FF window size on monitor as most pages do not display correctly at 100 percent zoom in this case. Such a simple thing to add that many people want. No extension correctly handles this yet. Chrome has it.

  26. Wellington Torrejais da Silva wrote on

    Nice improvements!

    I wait for news in the headless areas and integration with other software.
    Is there way actually to hide all interface(url bar, title bar…) and show just page?

    I think this type of customization is very important to leverage the Firefox like Electron project.

    Thanks!

  27. Apo wrote on

    If the “Session manager” add-on 
    http://sessionmanager.mozdev.org/
    does not function on the latest version of firefox, I fear it is reason enough for me to switch to Chrome…

  28. BelFox wrote on

    Great work on the WebExtensions API! Please bring back support for toolbars as well.

  29. Andre wrote on

    The only reason that i don’t use more dat protocol it’s because i don’t want to switch between beaker browser and firefox.
    Firefox with a “Create site” button will be great.
    Keep it up.

  30. dez0 wrote on

    Mozilla: Please sync the “find in this page” text input box with contents of the “search bar”.

    Reason: When doing a search engine search for “firefox word highlight”, one would want to quickly find the keywords on the resulting page. To do this, the user currently has to open a separate “find in this page” box and input the keywords a second time.
    Multiply this by dozens of times each day, and it becomes inefficient.

    It would also be helpful if Firefox would remember and repopulate the Search Bar keywords for each specific tab when switching back to that tab.

    Please remember: Firefox is not just a browser. For many, it is an important productivity tool. 🙂

  31. Mark wrote on

    This is a great start offering more tab control. I wish there was a hardcore API where you could once again manipulate the UI, key events, etc. We have an app that is now stuck at Firefox 56 since we need that sort of UI control for kiosk mode to prevent user tampering. Without it we are stuck!