Introducing the Extension Compatibility Tester

With Firefox’s move to a modern web-style browser extension API, it’s now possible to maintain one codebase and ship an extension in multiple browsers. However, since different browsers can have different capabilities, some extensions may require modification to be truly portable. With this in mind, we’ve built the Extension Compatibility Tester to give developers a better sense of whether their existing extensions will work in Firefox.

The tool currently supports Chrome extension bundle (.crx) files, but we’re working on expanding the types of extensions you can check. The tool generates a report showing any potential uses of APIs or permissions incompatible with Firefox, along with next steps on how to distribute a compatible extension to Firefox users.

We will continue to participate in the Browser Extensions Community Group and support its goal of finding a common subset of extensible points in browsers and APIs that developers can use. We hope you give the tool a spin and let us know what you think!

Try it out! >>

“The tool says my extension may not be compatible“

Not to worry! Our analysis only shows API and permission usage, and doesn’t have the full context. If the incompatible functionality is non-essential to your extension you can use capability testing to only use the API when available:

<span class="sf_code_syntax_comment">// Causes an Error
</span>browser.unavailableAPI(...);
<span class="sf_code_syntax_comment">
// Capability Testing FTW!
</span><span class="sf_code_syntax_keyword">if</span><span class="sf_code_syntax_comment"> (</span><span class="sf_code_syntax_string">'unavailableAPI'</span><span class="sf_code_syntax_comment"> </span><span class="sf_code_syntax_keyword">in</span><span class="sf_code_syntax_comment"> browser) {</span>
	browser.unavailableAPI(...);<span class="sf_code_syntax_comment">
</span>}

Additionally, we’re constantly expanding the available extension APIs, so your missing functionality may be only a few weeks away!

“The tool says my extension is compatible!”

Hooray! That said, definitely try your extension out in Firefox before submitting to make sure things work as you expect. Common APIs may still have different effects in different browsers.

“I don’t want to upload my code to a 3rd party website.”

Understood! The compatibility testing is available as part of our extension development command-line tool or as a standalone module.

If you have any issues using the tool, please file an issue or leave a comment here. The hope is that this tool is a useful first step in helping developers port their extensions, and we get a healthier, more interoperable extension ecosystem.

Happy porting!

About Potch

Potch is a Web Platform Advocate at Mozilla.

More articles by Potch…


One comment

  1. Peter

    “If the incompatible functionality is non-essential to your extension you can use capability testing to only use the API when available: […]
    Additionally, we’re constantly expanding the available extension APIs, so your missing functionality may be only a few weeks away!”

    What about when the incompatible functionality *is* essential to the extension and the APIs are not going to be implemented? The Extension Compatibility Tester correctly identified that 3 APIs from my Chrome extension are not available in Firefox. They are neither listed on [1] nor on [2]. Why is there no page telling developers which Chrome APIs will *not* be supported at all? I vaguely remember seeing a list like that on [3] but the page has been changed to simply say “yes” (which I do not agree with).

    Also, I don’t think the the docs can be trusted. Looking at the chrome.identity.* API, according to [4] there are *no* Chrome incompatibilities. However, looking at [5] shows that four out of six (!) methods are simply not implemented, nor is there any information when or if the methods are going to be implemented.

    [1] https://developer.mozilla.org/en-US/Add-ons/WebExtensions
    [2] https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities
    [3] http://arewewebextensionsyet.com/
    [4] https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/identity#Chrome_incompatibilities
    [5] https://developer.chrome.com/extensions/identity

    August 24th, 2017 at 08:11

Comments are closed for this article.