Skip to content

Instantly share code, notes, and snippets.

@tofumatt
Last active November 22, 2015 20:10
Show Gist options
  • Save tofumatt/ad4c581d3451299bab81 to your computer and use it in GitHub Desktop.
Save tofumatt/ad4c581d3451299bab81 to your computer and use it in GitHub Desktop.
Add-ons Draft Post

NOTE: I wrote this on WordPress.com and would've put it in the add-ons blog as a draft to review, but I am having some LDAP error and can't publish it there. So here it is for review, let me know!

A New Firefox Addons Validator

The state of add-ons has changed a lot over the past five years, with Jetpack add-ons rising in popularity and Web Extensions on the horizon. Our validation process hasn't changed as much as the ecosystem it validates, so today Mozilla is announcing its new Add-ons Validator, written in JS and available for testing today!

How the Add-ons Validator Fits in to Firefox

Add-ons are a huge part of the Firefox system and a fantastic reason to use Firefox. We already have [NUMBER OF ADDONS] available and with work underway to allow Web Extensions in Firefox, we'll see a lot more soon. For add-ons to be listed on the Firefox Add-ons site, they need to be reviewed and approved by Mozilla's add-on review team. The first step in this review process is automated validation using our Add-ons Validator.

Add-ons validation is important: it alerts reviewers to deprecated API usage, errors, and bad practices. Add-ons can contain a lot of code; our validation alerts reviewers to possible problems and lets them focus on bits of add-ons that could make your browser buggy or slow. It also lets us make sure add-ons aren't doing anything malicious with your browsing data! The Add-ons validator helps keep your browsing fast and safe.

But our current validator is a bit old, long in the tooth, and because it's written in Python with JavaScript dependencies: our old validator is difficult for add-on developers to install themselves. This means add-on developers often don't know about validation errors until they submit their add-on for review.

This wastes add-on developers' time and reviewers' time, introducing a feedback cycle that could have been avoided if the add-on developer could have just ran addons-validator myAddon.xpi before they uploaded their add-on. If developers could easily check their add-ons for errors locally, getting their add-ons in front of millions of users is that much faster.

Well, now they can!

Introducing the new Add-ons Validator, in JS!

I'm not a fan of massive rewrites, but in this case it really helps. Add-ons developers are JavaScript coders and nearly everyone involved in web development these days uses Node.js. We've written the new validator in JavaScript and published it on npm: you can install it right now.

We took this opportunity to review all the rules the old add-on validator defined: there were a lot of outdated rules dating back to Gecko 6. We've removed a lot of outdated rules; some of them haven't been encountered on addons.mozilla.org for years. This has allowed us to cut down on code footprint and make a faster, leaner, and easier-to-work-with validator for the future.

Speaking of which...

What's next?

We're still porting over relevant rules from the old validator. Our three objectives are:

  1. Porting old rules (discarding outdated ones where necessary)
  2. Adding support for Web Extensions
  3. Getting the new validator running in production

We're looking for help with those first two objectives, so if you'd like to help us make our slightly ambitious full-project-rewrite-deadline, you can...

Get Involved!

If you're an add-ons developer, JavaScript programmer, or both: we'd love your help! Our code and issue tracker are on GitHub at github.com/mozilla/addons-validator. We keep a healthy backlog of issues available, so you can help us add rules, review code, or test things out there. We also have a good first bug label if you're new to add-ons but want to contribute!

If you'd like to try the next-generation add-ons validator, you can install it with npm: npm install addons-validator. Run your add-ons against it and let us know what you think. We'd love your feedback as GitHub issues, or emails on the add-ons developer mailing list.

And if you're an add-ons developer who wishes the validator did something it currently doesn't, please let us know!

We're really excited about the future of add-ons at Mozilla; we hope this new validator will help people write better add-ons. It should make writing add-ons faster, help reviewers get through more add-ons, and will ultimately result in more awesome add-ons available for all Firefox users.

Happy hacking!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment