Firefox Focus refactoring

In my previous blog post, I told about the issues I plan to work on for my open source contributions the following week. Earlier this week, I was also looking at some of the issues in big projects, and I found one that interested me in React repo. The problem was that a new test failed because of a wrong error message. I asked to work on it, and an engineer from React team warned me:

I won’t promise we won’t fix it sooner — but if you can find the cause, it would be appreciated (from issue discussion)

I decided to try to fix it. I set up the project locally and started hacking on the issue. I have never looked at React’s codebase before, so it was all new to me. I started researching it and trying to find the bug. I spent about two hours doing that, and after that, the issue author left a comment that the issue was fixed and thanked me for offering help.

Well, even though I didn’t really contribute to it, I still can find value in the work I did because I might contribute to React later.

Afterwards, I changed my focus to Firefox Focus because I had already asked to work on some of its issues there.

There was an issue filed 7 months ago, which asks to move magic numbers from the code into the file with constant variables. There were mentioned several files in the discussion:

  • SearchSuggestionsPromptView
  • URLBar
  • AddSearchEngineViewController

So I decided to work on them + some other files.

Basically, I went through files and looked for any magic number appearance. If found, I created a new constant variable in UIConstants file, and replace the magic number with the name of constant from UIConstants.

Some stats from the submitted pull request:

  • 7 files were refactored
  • 230 lines of code were changed (+143, -87)