A Chromium and Firefox extension that allows the user to open Firefox from Chromium quickly as well as open other browsers from Firefox.
- Firefox Nightly or Developer Edition 122+
- Some Chromium browser 88+
Run npm i
to install dependencies.
Run npm run build
to build the extension.
To see changes made to the extension, first build the extension, then reload the extension in the browser.
- Open your chromium browser
- Go to the extensions page (e.g.
chrome://extensions
) - Enable developer mode
- Click on "Load unpacked" and select the
build/chromium
folder or thedist/chromium.zip
file.
To see console logs, inspect the service worker.
Since Firefox Bridge for Firefox uses experimental APIs, you will need to use Firefox Nightly or Beta, then:
- Open your Firefox browser
- Go to about:config
- Set
xpinstall.signatures.required
tofalse
- Set
extensions.experiments.enabled
totrue
To load the extension:
- Go to
about:debugging#/runtime/this-firefox
- Click on "Load Temporary Add-on..."
- Select the
build/firefox/manifest.json
file or thedist/firefox.zip
file. - Click
Inspect
to see the console logs.
Run npm test
to run the tests.
The tests use the files in the build
folder. Since the shared logic is the same for both browsers, the shared tests are imported from the build/chromium
folder only.
Since the Firefox and Chromium extension has a lot of shared logic, but also independent logic, the build process is a bit complicated.
- The
src
folder contains theshared
,_locales
,firefox
, andchromium
folders. - The
chromium
andfirefox
folders contain aninterfaces
folder that contains the interfaces for the shared logic. - The import statements within the
shared
folder will always point to the code in thechromium/interfaces
folder. This is to simplify development within the IDE. - The
build
directory holds the built extension and thedist
folder holds the zipped version.
In Firefox, we use experimental APIs to fetch which browsers are installed on the users computer as well as launch the browser without relying on the protocol handler. To learn more about the APIs, see the Experiments Documentation.
Due to the privileged-ness of the Firefox extension, we must use manifest V2, hence the lack of callbacks and browser.browserAction
vs browser.action
.
To develop the experimental APIs, you will need to install the Firefox source code and build the browser.
- Follow the instructions to install the Firefox source code.
- Navigate to
mozilla-unified/
- Run
./mach build
to build the browser - Run
./mach run
to run the browser - Follow the above instructions to load the extension in Firefox
Doing this, you will be able to have much more context in the console, including the ability to see the logs from the console.log
statements in api.js
.