Bug 1313403 - text (focus) goes to the wrong browser after foreground tab change, r=mak
MozReview-Commit-ID: BxqYL1p494h
This commit is contained in:
@@ -348,6 +348,7 @@ function openLinkIn(url, where, params) {
|
||||
// result in a new frontmost window (e.g. "javascript:window.open('');").
|
||||
w.focus();
|
||||
|
||||
let browserUsedForLoad = null;
|
||||
switch (where) {
|
||||
case "current":
|
||||
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
|
||||
@@ -383,12 +384,13 @@ function openLinkIn(url, where, params) {
|
||||
postData: aPostData,
|
||||
userContextId: aUserContextId
|
||||
});
|
||||
browserUsedForLoad = aCurrentBrowser;
|
||||
break;
|
||||
case "tabshifted":
|
||||
loadInBackground = !loadInBackground;
|
||||
// fall through
|
||||
case "tab":
|
||||
w.gBrowser.loadOneTab(url, {
|
||||
let tabUsedForLoad = w.gBrowser.loadOneTab(url, {
|
||||
referrerURI: aReferrerURI,
|
||||
referrerPolicy: aReferrerPolicy,
|
||||
charset: aCharset,
|
||||
@@ -402,10 +404,15 @@ function openLinkIn(url, where, params) {
|
||||
userContextId: aUserContextId,
|
||||
originPrincipal: aPrincipal,
|
||||
});
|
||||
browserUsedForLoad = tabUsedForLoad.linkedBrowser;
|
||||
break;
|
||||
}
|
||||
|
||||
aCurrentBrowser.focus();
|
||||
// Focus the content, but only if the browser used for the load is selected.
|
||||
if (browserUsedForLoad &&
|
||||
browserUsedForLoad == browserUsedForLoad.ownerGlobal.gBrowser.selectedBrowser) {
|
||||
browserUsedForLoad.focus();
|
||||
}
|
||||
|
||||
if (!loadInBackground && w.isBlankPageURL(url)) {
|
||||
w.focusAndSelectUrlBar();
|
||||
|
||||
Reference in New Issue
Block a user