Mozilla Addons Blog: Extensions in Firefox 68 |
In Firefox 68, we are introducing a new API and some enhancements to webRequest and private browsing. We’ve also fixed a few issues in order to improve compatibility and resolve issues developers were having with Firefox.
At airports and caf'es you may have seen Firefox asking you to log in to the network before you can access the internet. In Firefox 68, you can make use of this information in an extension. The new captive portal API will assist you in making sure your add-on works gracefully when locked behind a captive portal.
For example, you could hold off your requests until network access is available again. If you have been using other techniques for detecting captive portals, we encourage you to switch to this API so your extension uses the same logic as Firefox.
Here is an example of how to use this API:
(async function() { // The current portal state, one of `unknown`, `not_captive`, `unlocked_portal`, `locked_portal`. let state = await browser.captivePortal.getState(); // Get the duration since the captive portal state was last checked let lastChecked = await browser.captivePortal.getLastChecked(); console.log(`The captive portal has been ${state} since at least ${lastChecked} milliseconds`); browser.captivePortal.onStateChanged.addListener((details) => { console.log("Captive portal state is: " + details.state); }); browser.captivePortal.onConnectivityAvailable.addListener((status) => { // status can be "captive" in an (unlocked) captive portal, or "clear" if we are in the open console.log("Internet connectivity is available: " + status); }); })();
Note: if you use this API, be sure to add the captivePortal permission to your manifest.
We’ve made a few additions to the webRequest API to better support private browsing mode. You can now limit your webRequests to only include requests from private browsing mode. If instead you are interested in both types of requests it is now possible to differentiate them in the webRequest listener.
To improve the integration of containers, we’ve also added the container ID (cookieStoreId) to the webRequest listener.
The two additional fields mentioned in the previous section are also available in the details object passed to the proxy.onRequest listener.
At the same time, we’d like to make you aware that we are deprecating the proxy.register
, proxy.unregister
and proxy.onProxyError
APIs. As an alternative, you can use the proxy.onRequest API to determine how requests will be handled, and proxy.onError to handle failures. If your extension is using these APIs you will see a warning in the console. These APIs will ultimately be removed in Firefox 71, to be released on December 10th, 2019.
We’ve changed the timing of tabs.duplicate for better compatibility with Chrome. The promise is now resolved immediately, before the duplicated tab finished loading. If you have been relying on this promise for a completed duplicated tab in Firefox, please adjust your code and make use of the tabs.onUpdated listener.
browser.browsingData.remove({}, { indexedDB: true });
and it failed in some cases, we’ve fixed this on our end now.We’ve had a great amount of support from the community. I’d like to thank everyone who has taken part, but especially our volunteer contributors Jan Henning, Myeongjun Go, Oriol Brufau, M'elanie Chauvel, violet.bugreport and Piro. If you are interested in contributing to the WebExtensions ecosystem, please take a look at our wiki.
The post Extensions in Firefox 68 appeared first on Mozilla Add-ons Blog.
https://blog.mozilla.org/addons/2019/06/13/extensions-in-firefox-68/
Комментировать | « Пред. запись — К дневнику — След. запись » | Страницы: [1] [Новые] |