Firefox bug 702161
Mid way through last week David Humphrey sent out an email explaining that he spoke with Chris Pearce about some possible bugs for us to work. The list consisted of various bugs, varying in difficulty. Dave encouraged us to pick up any bugs that interested us so thats exactly what I did. I picked up the following bugs:
- 702161 – videocontrols.xml has anonymous function event listeners that are added but never removed
- 708814 – Should fade out videocontrols even if there’s no mouse movement
- 680321 – Media preload state should reset in resource selection algorithm
These are all in addition to the bug that I was assigned last week ( 688370 ). I chose these bugs for a variety of reasons. 702161 seemed like a good bug to get my foot wet with and get the feel for submitting a patch and going through the review process. The other two interested me on different levels. 708814 looked like a cool media bug to fix and I can identify with it on a personal level. I don’t know how many times I’ve been watching videos online and have my mouse over the video just to notice that the controls don’t disappear. Not annoying the first time it happens but after a while it irks you. 680321 seemed to touch some of the preload code which interests me because in the past we have had issues with preload ( especially in Chrome ). I figured this would be a good way to take a look at whats going on and if any bugs in the future come up around the code I would already have some exposure to it.
Last night I built Firefox from source for the first time in about a year. I feared that it would not be an easy process as my experience with this kind of stuff typically always takes a turn for the worse. I was surprised that this wasn’t the case, in fact, the whole process was quite stress free. I began by following a guide I found online by simply Googling “Building FireFox from source”. After installing various dependencies I was set to begin the build. Something to note is that I was doing this build from a git repo of Mozilla-Central that is updated daily ( I believe ). From what I gather installing is about the same as it would be with mercurial just managing the repo would be a bit different. Something to note is that there is a flag in your .mozconfig file that you can set to specify the number of cores you will use for the build ( for those of you with numerous cores ). The build took about 20 minutes in total and then I was ready to open up my nightly build of FireFox, and it was a success!
The next step was to start on a bug. The logical choice as I mentioned earlier was bug 702161. The problem that was outlined in the bug was that various anonymous functions were created but were never destroyed when the terminate function was called. This is bad because each time terminate was called it would mean various listeners were never removed properly. So what I needed to do was pretty straight forward. I needed to store a reference somewhere to each of these anonymous functions so that upon removal later we could access that reference in order to remove the listener. I was even fortunate enough that within the bug itself Jared told me exactly where to find the file. Perfect. I then went to take a look at the file, which was quite a bit bigger than I thought it was going to be ( ~2000 lines ). After reading over the file a bit and taking a hint from the filename, it was obvious that this file was responsible for all of the code surrounding the video controls. The first thing I wanted to do was simple, make a change that I could see. All I did for this was add in a console.log. I then created a test html file that I could test off of. I added the console.log to the mouseover of the volume button, so it would be pretty obvious when it was working and when it wasn’t. After I made my change I had to rebuild FireFox in order to see my fancy new changes. I found a small article online that outlined how I could only rebuild the portions that I touched, which would in turn drastically reduce the amount of time it was taking to build, in fact it took it down to about 30 seconds. Behold my changes:
I’m itching to get this bug done so I can go and start on the controls not disappearing one, I’m pretty stoked to get going on it. So stay tuned, there are plenty of blog post’s to come🙂