mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 21:35:39 +00:00
Bug 1050447 - Skip focusing content if we're opening a new about:blank or about:newtab tab. r=dao, feedback=jimm.
This fixes a change in order of focus events for e10s after bug 1009628 landed. We were accidentally focusing the content after focusing the URL bar for new tabs. We now skip focusing the content entirely when opening a new tab. --HG-- extra : histedit_source : a6c140d4e2b4677209b039880922c29e7c24b584
This commit is contained in:
parent
2d5b47fd36
commit
d3974cd62a
@ -1225,6 +1225,15 @@
|
||||
// If we're using remote tabs, we have to wait until after we've finalized
|
||||
// switching the tabs.
|
||||
|
||||
if (newTab._skipContentFocus) {
|
||||
// It's possible the tab we're switching to is ready to focus asynchronously,
|
||||
// when we've already focused something else. In that case, this
|
||||
// _skipContentFocus property can be set so that we skip focusing the
|
||||
// content after we switch tabs.
|
||||
delete newTab._skipContentFocus;
|
||||
return;
|
||||
}
|
||||
|
||||
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
|
||||
let focusFlags = fm.FLAG_NOSCROLL;
|
||||
|
||||
|
@ -309,6 +309,8 @@ function openLinkIn(url, where, params) {
|
||||
// result in a new frontmost window (e.g. "javascript:window.open('');").
|
||||
w.focus();
|
||||
|
||||
let newTab;
|
||||
|
||||
switch (where) {
|
||||
case "current":
|
||||
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
|
||||
@ -331,23 +333,30 @@ function openLinkIn(url, where, params) {
|
||||
loadInBackground = !loadInBackground;
|
||||
// fall through
|
||||
case "tab":
|
||||
let browser = w.gBrowser;
|
||||
browser.loadOneTab(url, {
|
||||
referrerURI: aReferrerURI,
|
||||
charset: aCharset,
|
||||
postData: aPostData,
|
||||
inBackground: loadInBackground,
|
||||
allowThirdPartyFixup: aAllowThirdPartyFixup,
|
||||
relatedToCurrent: aRelatedToCurrent,
|
||||
skipAnimation: aSkipTabAnimation,
|
||||
allowMixedContent: aAllowMixedContent });
|
||||
newTab = w.gBrowser.loadOneTab(url, {
|
||||
referrerURI: aReferrerURI,
|
||||
charset: aCharset,
|
||||
postData: aPostData,
|
||||
inBackground: loadInBackground,
|
||||
allowThirdPartyFixup: aAllowThirdPartyFixup,
|
||||
relatedToCurrent: aRelatedToCurrent,
|
||||
skipAnimation: aSkipTabAnimation,
|
||||
allowMixedContent: aAllowMixedContent
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
w.gBrowser.selectedBrowser.focus();
|
||||
|
||||
if (!loadInBackground && w.isBlankPageURL(url))
|
||||
if (!loadInBackground && w.isBlankPageURL(url)) {
|
||||
if (newTab && gMultiProcessBrowser) {
|
||||
// Remote browsers are switched to asynchronously, and we need to
|
||||
// ensure that the location bar remains focused in that case rather
|
||||
// than the content area being focused.
|
||||
newTab._skipContentFocus = true;
|
||||
}
|
||||
w.focusAndSelectUrlBar();
|
||||
}
|
||||
}
|
||||
|
||||
// Used as an onclick handler for UI elements with link-like behavior.
|
||||
|
Loading…
Reference in New Issue
Block a user