diff --git a/mozilla/content/xul/content/src/nsXULPopupListener.cpp b/mozilla/content/xul/content/src/nsXULPopupListener.cpp index a207f0f8873..e038c160ac2 100644 --- a/mozilla/content/xul/content/src/nsXULPopupListener.cpp +++ b/mozilla/content/xul/content/src/nsXULPopupListener.cpp @@ -300,7 +300,10 @@ XULPopupListenerImpl::Blur(nsIDOMEvent* aMouseEvent) } // Blur events don't bubble, so this means our window lost focus. - // Close up, baby. + // Let's check just to make sure. + nsCOMPtr eventTarget; + aMouseEvent->GetTarget(getter_AddRefs(eventTarget)); + // We have some popup content. Obtain our window. nsIScriptContextOwner* owner = document->GetScriptContextOwner(); nsCOMPtr context; @@ -309,7 +312,11 @@ XULPopupListenerImpl::Blur(nsIDOMEvent* aMouseEvent) if (global) { // Get the DOM window nsCOMPtr domWindow = do_QueryInterface(global); - domWindow->Close(); + + // Close, but only if we are the same target. + nsCOMPtr windowNode = do_QueryInterface(domWindow); + if (windowNode.get() == eventTarget.get()) + domWindow->Close(); } } diff --git a/mozilla/rdf/content/src/nsXULPopupListener.cpp b/mozilla/rdf/content/src/nsXULPopupListener.cpp index a207f0f8873..e038c160ac2 100644 --- a/mozilla/rdf/content/src/nsXULPopupListener.cpp +++ b/mozilla/rdf/content/src/nsXULPopupListener.cpp @@ -300,7 +300,10 @@ XULPopupListenerImpl::Blur(nsIDOMEvent* aMouseEvent) } // Blur events don't bubble, so this means our window lost focus. - // Close up, baby. + // Let's check just to make sure. + nsCOMPtr eventTarget; + aMouseEvent->GetTarget(getter_AddRefs(eventTarget)); + // We have some popup content. Obtain our window. nsIScriptContextOwner* owner = document->GetScriptContextOwner(); nsCOMPtr context; @@ -309,7 +312,11 @@ XULPopupListenerImpl::Blur(nsIDOMEvent* aMouseEvent) if (global) { // Get the DOM window nsCOMPtr domWindow = do_QueryInterface(global); - domWindow->Close(); + + // Close, but only if we are the same target. + nsCOMPtr windowNode = do_QueryInterface(domWindow); + if (windowNode.get() == eventTarget.get()) + domWindow->Close(); } }