One way of searching through the code is to use http://mxr.mozilla.org.
We eventually found our way to this snippet of code: http://mxr.mozilla.org/mozilla-central/source/browser/base/content/tabbrowser.xml#1326
1321 // Check if we're opening a tab related to the current tab and
1322 // move it to after the current tab.
1323 // aReferrerURI is null or undefined if the tab is opened from
1324 // an external application or bookmark, i.e. somewhere other
1325 // than the current tab.
1326 if ((aRelatedToCurrent == null ? aReferrerURI : aRelatedToCurrent) &&
1327 Services.prefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent")) {
1328 let newTabPos = (this._lastRelatedTab ||
1329 this.selectedTab)._tPos + 1;
1330 if (this._lastRelatedTab)
1331 this._lastRelatedTab.owner = null;
1332 else
1333 t.owner = this.selectedTab;
1334 this.moveTabTo(t, newTabPos);
1335 this._lastRelatedTab = t;
1336 }
Just by reading the commented code you'll see that this is exactly what we're looking for. It checks to see if the current tab is related to the new tab and will open it next to the current if true. So by commenting out the first "if" statement we will essentially make all new tabs open next to the current. Our new changes will look like this:
- if ((aRelatedToCurrent == null ? aReferrerURI : aRelatedToCurrent) &&
- Services.prefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent")) {
+ //if ((aRelatedToCurrent == null ? aReferrerURI : aRelatedToCurrent) &&
+ // Services.prefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent")) {
let newTabPos = (this._lastRelatedTab ||
this.selectedTab)._tPos + 1;
if (this._lastRelatedTab)
this._lastRelatedTab.owner = null;
else
t.owner = this.selectedTab;
this.moveTabTo(t, newTabPos);
this._lastRelatedTab = t;
- }
+ //}
Thats it, we didn't even have to write any new code, simply commenting out several lines did what we were looking for. Finally build the source code again.
No comments:
Post a Comment