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:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user