зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1373604 - Only try to switch focus to targetDocShell if the load succeeds. r=smaug
MozReview-Commit-ID: H1TsRcbagg4
This commit is contained in:
Родитель
35588e8dd0
Коммит
eaa22c46f8
|
@ -10179,16 +10179,18 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
|||
// do nothing.
|
||||
}
|
||||
|
||||
// Switch to target tab if we're currently focused window.
|
||||
// Take loadDivertedInBackground into account so the behavior would be
|
||||
// the same as how the tab first opened.
|
||||
bool isTargetActive = false;
|
||||
targetDocShell->GetIsActive(&isTargetActive);
|
||||
if (mIsActive && !isTargetActive &&
|
||||
!Preferences::GetBool("browser.tabs.loadDivertedInBackground", false)) {
|
||||
if (NS_FAILED(nsContentUtils::DispatchFocusChromeEvent(
|
||||
targetDocShell->GetWindow()))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Switch to target tab if we're currently focused window.
|
||||
// Take loadDivertedInBackground into account so the behavior would be
|
||||
// the same as how the tab first opened.
|
||||
bool isTargetActive = false;
|
||||
targetDocShell->GetIsActive(&isTargetActive);
|
||||
nsCOMPtr<nsPIDOMWindowOuter> domWin = targetDocShell->GetWindow();
|
||||
if (mIsActive && !isTargetActive && domWin &&
|
||||
!Preferences::GetBool("browser.tabs.loadDivertedInBackground", false)) {
|
||||
if (NS_FAILED(nsContentUtils::DispatchFocusChromeEvent(domWin))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче