diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-06-22 12:13:20 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-06-22 12:13:20 +0200 |
commit | cadeea97bbefe42f89d16a4678fdc382c7b74bcd (patch) | |
tree | c643e8657945507ad5aae041fa5abfe8e8a4e351 /application/palemoon/base | |
parent | 65c98eda36c738718c6897b894aab107f1acb8cb (diff) | |
download | UXP-cadeea97bbefe42f89d16a4678fdc382c7b74bcd.tar UXP-cadeea97bbefe42f89d16a4678fdc382c7b74bcd.tar.gz UXP-cadeea97bbefe42f89d16a4678fdc382c7b74bcd.tar.lz UXP-cadeea97bbefe42f89d16a4678fdc382c7b74bcd.tar.xz UXP-cadeea97bbefe42f89d16a4678fdc382c7b74bcd.zip |
Be more explicit about which browser content object is focused and when.
Diffstat (limited to 'application/palemoon/base')
-rw-r--r-- | application/palemoon/base/content/utilityOverlay.js | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/application/palemoon/base/content/utilityOverlay.js b/application/palemoon/base/content/utilityOverlay.js index c4cd87f60..c45297e0b 100644 --- a/application/palemoon/base/content/utilityOverlay.js +++ b/application/palemoon/base/content/utilityOverlay.js @@ -328,6 +328,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; @@ -346,27 +347,35 @@ function openLinkIn(url, where, params) { referrerPolicy: aReferrerPolicy, postData: aPostData, }); + browserUsedForLoad = aCurrentBrowser; break; case "tabshifted": loadInBackground = !loadInBackground; // fall through case "tab": let browser = w.gBrowser; - browser.loadOneTab(url, { - referrerURI: aReferrerURI, - referrerPolicy: aReferrerPolicy, - charset: aCharset, - postData: aPostData, - inBackground: loadInBackground, - allowThirdPartyFixup: aAllowThirdPartyFixup, - relatedToCurrent: aRelatedToCurrent}); + let tabUsedForLoad = browser.loadOneTab(url, { + referrerURI: aReferrerURI, + referrerPolicy: aReferrerPolicy, + charset: aCharset, + postData: aPostData, + inBackground: loadInBackground, + allowThirdPartyFixup: aAllowThirdPartyFixup, + relatedToCurrent: aRelatedToCurrent}); + browserUsedForLoad = tabUsedForLoad.linkedBrowser; break; } - w.gBrowser.selectedBrowser.focus(); + // Focus the content, but only if the browser used for the load is selected. + if (browserUsedForLoad && + browserUsedForLoad == browserUsedForLoad.getTabBrowser().selectedBrowser) { + browserUsedForLoad.focus(); + } if (!loadInBackground && w.isBlankPageURL(url)) - w.focusAndSelectUrlBar(); + if (!w.focusAndSelectUrlBar()) { + console.error("Unable to focus and select address bar.") + } } // Used as an onclick handler for UI elements with link-like behavior. |