WebExtensions API – Understanding

What’s an Extension?

An extension can be described as a set of code that is structured and contains web development (JavaScript HTML CSS) to modify the Firefox browser’s behaviour or appearance. Firefox extension have been an integral part for years. These extensions allow users the ability to modify their browsing experience.

What exactly is the WebExtensions API and how does it work?

WebExtensions can be described as the web API to create extensions for Firefox. Large parts of this API can be used with Opera, Chrome, and MS Edge to create extensions that work across multiple browsers.

WebExtensions API Development

Are you able to code extensions with WebExtensions API using your skills?

All you need to know is HTML, CSS, JavaScript and HTML. WebExtensions API can be understood by everyone using current web development tools.

I would like to make an extension. Which is the best place to start?

MDN Web Docs has a complete section devoted to extension development using the WebExtensions API. The WebExtensions API reference manual is also included.

WebExtension API compatibility with multiprocess Firefox

Yes. All APIs will work in multiprocess Firefox. It is not necessary to take any additional development steps.

Can the WebExtensions API give access to my preferences?

Non. It is not possible to gain direct access in the past to your preferences. Multiple extensions could try to make them different and create conflict. Unfortunately, there were no security limits so that malicious extensions weren’t able to exploit users. WebExtensions are focused on more advanced APIs which implement particular tasks. Although those APIs might alter preferences over time, WebExtensions will handle it in the background. Developers wouldn’t be able to set these preferences.

Which extension can I share?

MDN has a section on Publishing that will help you get your extension approved.

WebExtension Roadmap

WebExtensions API is this a Web standard.

It’s not yet. Mozilla has joined forces with Microsoft and Opera in defining a browser-extension API that is compatible across browsers. It is possible to write extensions according to this specification on Chrome and Edge as well as Opera and Firefox. There is a preliminary specifications. Developers should still be aware of the differences among browsers. Chrome defines browser extension namespace “browser” in the preliminary specification, while Chrome uses “chome”. Firefox can support both namespaces to allow more current extensions. The WebExtensions polyfill will enable extensions that conform to the initial specification to work with Chrome.

WebExtensions has a stable API.

Yes. MDN will document each API in relation to its standard or experimental status. APIs that are out of date will also be highlighted. On the Wikipedia page, you can read more about the WebExtensions API.

WebExtension APIs exist outside the scope of this draft?

Yes. Yes. However, unlike the web platform we do not expect that every browser will implement all aspects of WebExtensions exactly in the same manner. A common API offers many benefits to extension developers, even though they may not have perfect overlap. Extensions that adhere to the common API should be able to work in all browsers. Even if developers use browser-specific APIs to create their extensions, they may still work on other browsers using feature detection/fallbacks.

Could I submit a new WebExtensions API?

You can, and we encourage that you do. Make sure your proposed API conforms to the WebExtensions Policy before you start. If your proposal does not fit within the guidelines, you can submit a bug to Bugzilla. This will allow the WebExtensions developer team to examine the proposal. Each week we have a public triage to help make this process transparent. Each is either labeled as “design needed”, approved, or rejected.

How can I prototype a WebExtensions new API?

Yes. WebExtensions allows you to easily expose and verify almost any feature via a WebExtensions WebExtensions API. It helps you to see how an API works and the potential problems. In the Firefox Nightly version, prototype WebExtension experiment can be performed. It is important to remember that just because an experiment exists, it doesn’t mean the feature will eventually become an official WebExtension-API.

Legacy Extensions & WebExtension API

Which date did Firefox adopt WebExtensions?

Mozilla in August 2015 announced the deprecation of legacy XPCOM/XUL-based extension system systems and the move to the WebExtension API. Between August 2015 and November 2017, WebExtension and legacy add-ons both were available in some form. WebExtensions, which were the first supported API to develop extensions in Firefox 57 (“Quantum”) in November 2017, was released.

Firefox does not use XUL internally.

Firefox has parts that still use XUL internally. XUL continues to be used in some parts of Firefox, but it is gradually being replaced with more current technologies. Firefox, for example, has a completely updated CSS engine since release 57. WebExtensions API acts as a bridge between extension code and Firefox’s internal technology. Firefox gradually removes XUL from Firefox, so extensions that depended on it would soon cease to work.

Google Chrome copied Firefox’s code?

WebExtensions API wasn’t created to just replicate Chrome or to allow Chrome extensions not to be modified in Firefox. It was intended to ease cross-browser developer by offering commonly supported methods and interfaces. We would have been stupid to ignore the fact that Chrome holds a significant market share. Mozilla’s main mission is to offer open, cross-platform interoperability for web users. So modeling the WebExtensions API from Chrome’s API makes the most sense. All vendors will offer their APIs only to specific browsers.

Why WebExtensions vs Jetpack

Jetpack did lack the WebExtensions API, which has inherent technology benefits such as support for content blockers used by popular extensions. WebExtensions’ initial implementation was made possible by Chrome’s Chrome API. This allowed Firefox to use large amounts of Chrome extensions, larger than Jetpack add-ons, and more extension developers. Common APIs enabled developers to share code and allow extensions to be port easily between browsers.

Why use the.xpi packaging design?

Chrome is using a different system while Firefox uses JAR signature for WebExtensions. The signing system is specific to each browser, so it’s difficult to combine the two. It makes perfect sense that Firefox keeps the current packaging extension. WebExtensions doesn’t use the filename suffix in the XPI file format.

Is it possible to have malicious addons?

Yes. The case for extension signing.