Quantcast
Channel: The Open Source Experience
Viewing all articles
Browse latest Browse all 10

Modifying Minefield

$
0
0

This week in dps909, we were given the task of searching through firefox code and making changes. The 2 desired changes are: make it so all tabs are created next to the tab in focus, and change navigation through tabs from  ctrl + number to alt + number.

First we were shown how to use Mozilla cross reference effectively. The cross reference can be used to search through firefox source code. Using key terms, one can locate the necessary lines of code and then makes changes in your local copy. In class we searched through code were tab creation may be handled. Eventually we found some code, in tabbrowser.xml, where we believed that our changes can be made.

// Check if we're opening a tab related to the current tab and
// move it to after the current tab.
// aReferrerURI is null or undefined if the tab is opened from
// an external application or bookmark, i.e. somewhere other
// than the current tab.
if ((aRelatedToCurrent == null ? aReferrerURI : aRelatedToCurrent) &&
 Services.prefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent")) {

The code we found had comments explaining that during the creation of a tab, it will check to see if the tab is related, if so, it will create the tab next to the tab in focus. This was the functionality that we wanted, but we wanted it with every tab. So by commenting out the the check, it should create the tab next to the tab in focus every time. Using the command below we created a patch and then re-compiled minefield.
hg diff -p -u 8 > tab.patch

That simple changed seemed to work. As you can see in the image below, the new tab is create next to the tab in focus and not at the end. Minefield is imitating the functionality of being a related tab for every tab created. The patch can be found here on my wiki.



Viewing all articles
Browse latest Browse all 10

Trending Articles