Fix that makes the blur handler ultra-paranoid. It sanity checks its target before

closing the window.  (I'm having to do this since focus/blur events bubble. @#$@#$%#)


git-svn-id: svn://10.0.0.236/trunk@34339 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
hyatt%netscape.com
1999-06-09 01:07:31 +00:00
parent d5e0d681e5
commit 0f2b50816a
2 changed files with 18 additions and 4 deletions

View File

@@ -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<nsIDOMNode> eventTarget;
aMouseEvent->GetTarget(getter_AddRefs(eventTarget));
// We have some popup content. Obtain our window.
nsIScriptContextOwner* owner = document->GetScriptContextOwner();
nsCOMPtr<nsIScriptContext> context;
@@ -309,7 +312,11 @@ XULPopupListenerImpl::Blur(nsIDOMEvent* aMouseEvent)
if (global) {
// Get the DOM window
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(global);
domWindow->Close();
// Close, but only if we are the same target.
nsCOMPtr<nsIDOMNode> windowNode = do_QueryInterface(domWindow);
if (windowNode.get() == eventTarget.get())
domWindow->Close();
}
}

View File

@@ -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<nsIDOMNode> eventTarget;
aMouseEvent->GetTarget(getter_AddRefs(eventTarget));
// We have some popup content. Obtain our window.
nsIScriptContextOwner* owner = document->GetScriptContextOwner();
nsCOMPtr<nsIScriptContext> context;
@@ -309,7 +312,11 @@ XULPopupListenerImpl::Blur(nsIDOMEvent* aMouseEvent)
if (global) {
// Get the DOM window
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(global);
domWindow->Close();
// Close, but only if we are the same target.
nsCOMPtr<nsIDOMNode> windowNode = do_QueryInterface(domWindow);
if (windowNode.get() == eventTarget.get())
domWindow->Close();
}
}