Brave - A popup predicament

The Bug:

For my 0.2 release I decided to work on a bug that had remained seemingly untouched since late January.

 
https://github.com/brave/browser-laptop/issues/12870

It seemed like a relatively simple concept for an issue. I downloaded the specific repo version that was noted in the ticket, and was ready to begin my investigation. I open up the folder, and was met with:

Oh boy.


Bug Hunting:

It became increasingly clear that this would but a bit more difficult to nail down the exact cause in this project compared to the vastly smaller projects I was used to working on. Nevertheless, I began to theorize what could potentially be causing this problem. I ruled out it being a media rendering issue early on, as the example showing the bug was done using Netflix, a site that uses its own media renderer. I then thought about the problem stemming from the creation of a new browser window, and so I began to delve into folders and files that had to do with the creation of those. Everywhere I looked however, I couldn't nail down any piece of code that looked particularly connected to the type of bug described. I was stumped for a good while, searching for any potential nugget of information through Github, Windows explorer and Vscode. As work from other classes became heavier on me, I found it more and more difficult to peg the problem. But just as I was about to give up the bug, I had a sudden moment of clarity.

The Discovery:

It had to be related to tabs. It would make sense, as tabs are the actual instances being created. I began searching vigorously, filled with newfound energy and determination. 
After a couple of hours of sifting, I came across a very simple if-statement:
 

This statement, in addition to my previous research into the functions used inside it (windowsActions, isFullScreen, props, etc) gave me a very good feeling that this may be the needle in the haystack I had been searching for. From my understanding of this statement, if the last tab was closed or the current tab has changed (and if the tab is in full screen), then the current tab will be brought out of fullscreen. This could potentially produce and error with how Netflix shows its media, as the size of the actual window is shrinking. 

In order to test if this was indeed the bug, I commented it out entirely, and rebuilt the browser.
And...
It worked! It appears that my small edit has fixed the resizing issue! Due to original statement being more-so a quality of life enhancement rather than a core feature, I believe that commenting it out will not have any adverse effects on the browser itself. 

 

Nevertheless, I still ensured that the browser was as functional as it was before I commented out the statement. 
I added a small note alongside the commented out code, but did not delete it. This was to ensure that nothing would be lost in the event the pull request was accepted.

What I Learned:

This was an excellent means of being introduced to how large scale projects and operations are organized. Having to come up with ways to sift through the code to find what I needed what invaluable for future projects, which I will have a much easier time moving around now. I also found that as I read potentially relevant code, I became curious as to what exactly was happening with the functions included. This led me to following the requirement paths, and getting a much better picture of how everything connected together. 

This release was an eye opener, and has led to continued interest in helping development for the Brave project. I believe that this will not be my last contribution due to the amount of interest I have gained on its inner workings.

Comments

Popular Posts