mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Bug 1618204 - DeCOMtaminate GetActiveWindow in nsWindow::BringToFront(). r=snorp
Differential Revision: https://phabricator.services.mozilla.com/D64372 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
ec996a7e9d
commit
2339507e78
@ -1814,14 +1814,15 @@ void nsWindow::SetFocus(Raise, mozilla::dom::CallerType aCallerType) {
|
||||
}
|
||||
|
||||
void nsWindow::BringToFront() {
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
// If the window to be raised is the same as the currently raised one,
|
||||
// do nothing. We need to check the focus manager as well, as the first
|
||||
// window that is created will be first in the window list but won't yet
|
||||
// be focused.
|
||||
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
|
||||
nsCOMPtr<mozIDOMWindowProxy> existingTopWindow;
|
||||
fm->GetActiveWindow(getter_AddRefs(existingTopWindow));
|
||||
if (existingTopWindow && FindTopLevel() == nsWindow::TopWindow()) return;
|
||||
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm && fm->GetActiveWindow() && FindTopLevel() == nsWindow::TopWindow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsTopLevel()) {
|
||||
FindTopLevel()->BringToFront();
|
||||
|
Loading…
Reference in New Issue
Block a user