This is the extension for the urlbar top sites add-on experiment. When installed, focusing Firefox's urlbar automatically opens the urlbar view and shows the top sites from your new-tab page. (Two caveats: The view does not automatically open when the current tab is the new-tab page itself since it already shows your top sites. It also doesn't open in private windows.)
Bug 1547279 is the meta bug that tracks this experiment.
- Firefox 69b13 or newer
- Either a Mozilla-signed version of the add-on; or Firefox Nightly, Developer
Edition, or any other Firefox build that gives privileges to temporarily
installed add-ons (Beta does not). This add-on uses Mozilla-privileged APIs
(
browser.urlbarandbrowser.normandyAddonStudy)
You can use web-ext or about:debugging. Both will load the add-on as a temporary add-on, so you'll need to use Firefox Nightly, Developer Edition, or any other Firefox build that gives privileges to temporarily installed add-ons.
Use web-ext to build the add-on zip file.
The tests directory contains a browser chrome mochitest and a head.js. The
head.js implements a simple framework for testing Normandy experiment add-on
files.
The requirements above for running the add-on apply to testing it, too. You'll need either a Mozilla-signed version of the add-on; or Firefox Nightly, Developer Edition, or any other Firefox build that gives privileges to temporarily installed add-ons.
To run the test in a particular version of Firefox, you'll need to clone the repo from which your Firefox was built. If you're testing in Nightly 70, you'll need mozilla-central. If you're testing in Developer Edition 69 or Beta 69, you'll need mozilla-beta.
Then:
-
cdinto yoururlbar-top-sites-experimentclone. -
Copy
tests/*intosrcdir/testing/extensions/, wheresrcdiris the top-level directory of your Firefox repo:$ cp -R tests/* srcdir/testing/extensions -
Build the add-on zip file using
web-extas described above:$ web-ext buildOr use a signed copy of the zip file.
-
Copy the zip file into
srcdir/testing/extensions/tests/browser:$ cp web-ext-artifacts/urlbar_top_sites_experiment-1.0.0.zip srcdir/testing/extensions/tests/browser -
Update
EXPECTED_ADDON_SIGNED_STATEas necessary insrcdir/testing/extensions/tests/browser/browser_urlbarTopSitesExtension.js. If your zip file is unsigned, its value should beAddonManager.SIGNEDSTATE_MISSING. If it's signed, it should beAddonManager.SIGNEDSTATE_PRIVILEGED. -
cdinto yoursrcdir. -
Run the test using
mach:$ ./mach mochitest -f browser --appname <path to Firefox binary> testing/extensions/tests/browser/browser_urlbarTopSitesExtension.jsIf your Firefox repo itself contains the Firefox binary (because you ran
mach build), you can omit the--appnameargument.If
machdoesn't find the test, remove your objdir,mach build, and try again from step 1. (There's got to be a better way…)
This project uses the linting rules from mozilla-central. From your
urlbar-top-sites-experiment directory, run:
$ npm install
$ npx eslint .