DEV Community

Francesco Menghi
Francesco Menghi

Posted on

Removing code from Mozilla

Last month I wrote about a contribution I made to Mozilla/bedrock (The repo for mozilla.org) and today I would like to continue that discussion with a new issue I worked on.

The issue was a simple one: remove old unused code while making sure not to break the current functionality of the two links "See what Firefox has blocked for you" on this page.

Firefox Privacy Page

This link is only visible when using the Firefox Browser and it redirects to about:protections: the dashboard that provides information on how many trackers Firefox automatically blocks for you. If the page is viewed from another browser, of course the link is replaced with a download button to get the latest version of Firefox.

The Details

When hovering the link we can see this href: https://support.mozilla.org/en-US/kb/enhanced-tracking-protection-firefox-desktop/?utm_source=mozilla.org-privacy-products&utm_medium=referral&utm_campaign=privacy-products&entrypoint=mozilla.org-privacy-products

I was intrigued on how clicking the link could redirect me to about:protections so, after looking through the code, I noticed that the line responsible for it was this:

Mozilla.UITour.showProtectionReport();
Enter fullscreen mode Exit fullscreen mode

I tried to run this locally and it did not work so I asked for help on the issue page. I quickly received some really useful information and a link to the docs explaining how to set up Mozilla.UITour locally:

To develop or test using Mozilla.UITour locally you need to create some custom preferences in about:config.
browser.uitour.testingOrigins (string) (value: local address e.g. http://127.0.0.1:8000)
browser.uitour.requireSecure (boolean) (value: false)

Basically, for security reasons, Firefox only allows a few specific domains to work with the Mozilla.UITour JS library and only over https.

Small Lessons

After getting my setup to work, I was finally able to confirm that the code I removed did not interfere with the link redirection and did not break any of the tests. The PR was quickly merged.

There is a lot I still don't know about the repo itself but I am happy that this issue led my to the discovery of a little piece of the browser's functionality that I wasn't aware of.

Note to self: the answer to your question is probably already somewhere in the docs!

Top comments (0)