Commit 0335f944 authored by Felipe Gomes's avatar Felipe Gomes
Browse files

Bug 827976 - Improve usage of the hidden window for nsXULWindow::Destroy. r=aklotz

Differential Revision: https://phabricator.services.mozilla.com/D21075

--HG--
extra : moz-landing-system : lando
parent f499de8e
......@@ -462,19 +462,28 @@ NS_IMETHODIMP nsXULWindow::Destroy() {
if (parent) {
nsCOMPtr<nsIWidget> parentWidget;
parent->GetMainWidget(getter_AddRefs(parentWidget));
if (!parentWidget || parentWidget->IsVisible()) {
nsCOMPtr<nsIBaseWindow> baseHiddenWindow;
if (parentWidget && parentWidget->IsVisible()) {
bool isParentHiddenWindow = false;
if (appShell) {
nsCOMPtr<nsIXULWindow> hiddenWindow;
appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow));
if (hiddenWindow) baseHiddenWindow = do_GetInterface(hiddenWindow);
bool hasHiddenWindow = false;
appShell->GetHasHiddenWindow(&hasHiddenWindow);
if (hasHiddenWindow) {
nsCOMPtr<nsIBaseWindow> baseHiddenWindow;
nsCOMPtr<nsIXULWindow> hiddenWindow;
appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow));
if (hiddenWindow) {
baseHiddenWindow = do_GetInterface(hiddenWindow);
isParentHiddenWindow = (baseHiddenWindow == parent);
}
}
}
// somebody screwed up somewhere. hiddenwindow shouldn't be anybody's
// parent. still, when it happens, skip activating it.
if (baseHiddenWindow != parent) {
nsCOMPtr<nsIWidget> parentWidget;
parent->GetMainWidget(getter_AddRefs(parentWidget));
if (parentWidget) parentWidget->PlaceBehind(eZPlacementTop, 0, true);
if (!isParentHiddenWindow) {
parentWidget->PlaceBehind(eZPlacementTop, 0, true);
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment