I've been playing with Rust lately, and since I mostly work on the Add-on
Manager these days, I thought I'd combine these into a toy rust version.
The Add-on Manager in Firefox is written in Javascript. It uses a lot of
ES6 features, and has "chrome" (as opposed to "content") privileges, which
means that it can access internal Firefox-only APIs to do things like download
and install extensions, themes, and plugins.
One of the core components is a class named AddonInstall which implements a
state machine to download, verify, and install add-ons. The main purpose of this
toy Rust project so far has been to model the design and see what it looks like.
So far mostly it's an exercise in how awesome Enum is compared to the
JS equivalent (int constants), and how nice match is (versus switch statements).
It's possible to compile the Rust app to a native binary, or alternatively to
asm.js/wasm, so one thing I'd like to try soon is loading a wasm version of
this Rust app inside a Firefox JSM (which is the type of JS module used for
internal Firefox code).
There's a webplatform crate on crates.io that enables which allows for
easy DOM access, it'd be interesting to see if this works for Firefox
chrome code too.