Bug 583997 - Fix parameter usage in loadOneTab and addTab, also add new option to openUILinkIn to explicitly focus newly opened tab. r,sr=Neil

This commit is contained in:
Misak Khachatryan 2010-08-07 23:58:02 +05:00
Родитель 42d88fa198
Коммит 061c96872e
2 изменённых файлов: 21 добавлений и 10 удалений

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

@ -1445,14 +1445,13 @@
arguments[1] != null &&
typeof arguments[1] == "object" &&
!(arguments[1] instanceof Components.interfaces.nsIURI)) {
({
referrerURI: aReferrerURI,
charset: aCharset,
postData: aPostData,
focusNewTab: aFocusNewTab,
allowThirdPartyFixup: aAllowThirdPartyFixup,
relatedToCurrent: aRelatedToCurrent
} = arguments[1]);
let params = arguments[1];
aReferrerURI = params.referrerURI;
aCharset = params.charset;
aPostData = params.postData;
aFocusNewtab = params.focusNewTab;
aAllowThirdPartyFixup = params.allowThirdPartyFixup;
aRelatedToCurrent = params.relatedToCurrent;
}
this._browsers = null; // invalidate cache

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

@ -598,7 +598,7 @@ function goAbout(aProtocol)
target = "current";
break;
default:
target = "tab";
target = "tabfocused";
}
openUILinkIn(url, target);
}
@ -1190,6 +1190,7 @@ function whereToOpenLink(e, ignoreButton, ignoreSave)
* "current" current tab (if there aren't any browser windows, then in a new window instead)
* "tab" new tab (if there aren't any browser windows, then in a new window instead)
* "tabshifted" same as "tab" but in background if default is to select new tabs, and vice versa
* "tabfocused" same as "tab" but explicitly focus new tab
* "window" new window
* "save" save to disk (with no filename hint!)
*
@ -1259,6 +1260,17 @@ function openUILinkIn(url, where, aAllowThirdPartyFixup, aPostData, aReferrerURI
w.content.focus();
}
break;
case "tabfocused":
var browser = w.getBrowser();
var tab = browser.addTab(url, {
referrerURI: aReferrerURI,
postData: aPostData,
allowThirdPartyFixup: aAllowThirdPartyFixup,
relatedToCurrent: aRelatedToCurrent
});
browser.selectedTab = tab;
w.content.focus();
break;
}
return w;
@ -1366,7 +1378,7 @@ function switchToTabHavingURI(aURI, aOpenNew, aCallback) {
// No opened tab has that url.
if (aOpenNew) {
let browser = openUILinkIn(aURI.spec, "tab");
let browser = openUILinkIn(aURI.spec, "tabfocused");
if (aCallback) {
browser.addEventListener("pageshow", function(event) {
if (event.target.location.href != aURI.spec)