Skip to content

mozilla-extensions/webcompat-addon

Repository files navigation

WebCompat Go Faster add-on

This is the development repository for the Firefox WebCompat Go Faster add-on.

Writing site patches, overrides and injections

Detailed information on our policies on writing overrides, as well as technical information, can be found in the Mozilla Wiki.

Build instructions

This guide assumes you've got a copy of mozilla-central checked out on your machine and you already have set up Node.js 5 or newer. The build script assumes your mozilla-central is located at ../fx-team relative to inside the root folder. If not, please set the EXPORT_MC_LOCATION environment accordingly.

Running the extension without a built and set up mozilla-central is not possible at the moment.

If this is the first time you're working with this repository, install the dependencies with npm install.

Exporting the built source code for committing

  1. Ensure the version number is bumped in src/manifest.json, appropriately (see Versioning Scheme for more info).
  2. Make sure the EXPORT_MC_LOCATION environment variable is set to the root of your mozilla-central checkout.
  3. Depending on where you want to export to, run one of the following:
    • For exporting into mozilla-central into both the Desktop build and the Android Components, run npm run jake export.
    • For exporting into the Desktop tree of mozilla-central, run npm run jake export-mc.
    • For exporting into the Android Components tree of mozilla-central, run npm run jake export-ac.
  4. Your changes will now be in your mozilla-central checkout. Double-check the results, and you're ready to commit.

Run the changed extension sources

Via about:debugging

If you want to debug this extension on recent Desktop versions, you can use about:debugging:

  1. Open about:config in Firefox
  2. Set extensions.experiments.enabled pref to true
  3. Open about:debugging
  4. Click the Load Temporary Add-on... button
  5. Select ./src/manifest.json and hit open.
  6. Test!

Testing in Firefox for Android (Fenix)

Since the WebCompat feature inside Fenix is not shipped directly to the product but is included via a universal android component, you need both a local copy of Fenix and a local copy of Android-Components on your system. To build, make sure to follow the Mozilla Android Components' instructions on how to test unreleased component code, and use the android-component exporter (see above) to get your sources into the repo.

Building webcompat.xpi

  1. Run npm run build.
  2. Find the built .xpi inside the web-ext-artifacts/ directory.

Run the automated test suite

  1. Run npm run test
  2. Wait!

Run tests inside mozilla-central

Tests located in src/tests/ are not automatically started by the CI in this repo, but are meant as in-tree tests that run together with other Firefox tests. These tests are triggered when trying to land things via Phabricator, but manually running them is also possible.

  1. Export the sources to mozilla-central as explained above.
  2. Switch into your mozilla-central directory.
  3. Build the changed sources into Firefox by running ./mach build.
  4. Run the test suite with ./mach mochitest browser/extensions/webcompat/.

Automatically check and adjust the code style

As mozilla-central is now mostly auto-formatted with prettier, and the config for that is really slim, this repo follows these guidelines. To automatically check and adjust the code style,

  1. Run npm run autoformat
  2. Done.

Run tests and codestyle checks automatically before pushing

If you want to make sure you don't push something that would fail on CI, use the pre-push hook supplied with this repository.

If your Git version is newer than 2.9.x, you can enable the hooks with

git config core.hooksPath .githooks

and if Git is older, please symlink the hook into the right directory manually with

ln -s .githooks/pre-push .git/hooks/

License

MPL.