Bug 515932 - loadOneTab and addTab should accept a hash of parameters, including a parameter for opening the tab next to the current one. r=gavin, sr=mconnor

This commit is contained in:
Dão Gottwald 2009-09-15 01:33:00 +02:00
Родитель c8a4f3d339
Коммит 29f3dfca24
1 изменённых файлов: 35 добавлений и 3 удалений

Просмотреть файл

@ -1083,11 +1083,29 @@
<parameter name="aAllowThirdPartyFixup"/>
<body>
<![CDATA[
var aRelatedToCurrent;
if (arguments.length == 2 &&
typeof arguments[1] == "object" &&
!(arguments[1] instanceof Ci.nsIURI)) {
let params = arguments[1];
aReferrerURI = params.referrerURI;
aCharset = params.charset;
aPostData = params.postData;
aLoadInBackground = params.inBackground;
aAllowThirdPartyFixup = params.allowThirdPartyFixup;
aRelatedToCurrent = params.relatedToCurrent;
}
var bgLoad = (aLoadInBackground != null) ? aLoadInBackground :
this.mPrefs.getBoolPref("browser.tabs.loadInBackground");
var owner = bgLoad ? null : this.selectedTab;
var tab = this.addTab(aURI, aReferrerURI, aCharset, aPostData, owner,
aAllowThirdPartyFixup);
var tab = this.addTab(aURI, {
referrerURI: aReferrerURI,
charset: aCharset,
postData: aPostData,
ownerTab: owner,
allowThirdPartyFixup: aAllowThirdPartyFixup,
relatedToCurrent: aRelatedToCurrent});
if (!bgLoad)
this.selectedTab = tab;
@ -1156,6 +1174,19 @@
<parameter name="aAllowThirdPartyFixup"/>
<body>
<![CDATA[
var aRelatedToCurrent;
if (arguments.length == 2 &&
typeof arguments[1] == "object" &&
!(arguments[1] instanceof Ci.nsIURI)) {
let params = arguments[1];
aReferrerURI = params.referrerURI;
aCharset = params.charset;
aPostData = params.postData;
aOwner = params.ownerTab;
aAllowThirdPartyFixup = params.allowThirdPartyFixup;
aRelatedToCurrent = params.relatedToCurrent;
}
this._browsers = null; // invalidate cache
if (!this.mTabbedMode)
@ -1300,7 +1331,8 @@
// 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 (aReferrerURI && this.mPrefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent")) {
if ((aRelatedToCurrent == null ? aReferrerURI : aRelatedToCurrent) &&
this.mPrefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent")) {
let newTabPos = (this._lastRelatedTab ||
this.selectedTab)._tPos + 1;
this.moveTabTo(t, newTabPos);