typo
typo

Reputation: 389

Can you use Rust to write Firefox add-ons/extensions?

Mozilla has the Oxidation project:

The goal of Oxidation is to make it easier and more pleasant to use Rust in Firefox, and correspondingly to increase the amount of Rust code in Firefox.

But it does not mention anything about whether Rust is supported for add-ons or not.

Upvotes: 16

Views: 5641

Answers (2)

rugk
rugk

Reputation: 5573

Nowadays, you can do with WebExtensions and WebAssembly (guide how to compile here). You then just embed it as wasm code in your add-on like in any website.

This add-on e.g. did so. (found on reddit)

Upvotes: 17

Wes
Wes

Reputation: 2204

I don't think it is possible to write a complete add-on in Rust. Although you could use Native Messaging to communicate from the add-on to a binary built with Rust. When an add-on uses native messaging the browser starts a native binary on the system and exchanges messages encoded in JSON over stdio.

Mozilla has detailed information about native messaging on MDN.

Upvotes: 3

Related Questions