mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Fixing bug 302889, and more tinderbox orange (balsa). Make window.close() actually close the window. Events that were incorrectly targetted at an inner window caused one of our DOMWindowClose handlers to prevent the close. See the bug for more details. r+sr=dbaron@mozilla.org, a=chase@mozilla.org
This commit is contained in:
parent
91e96f10ed
commit
b396c88c41
@ -514,18 +514,45 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
|
||||
|
||||
NS_METHOD nsDOMEvent::SetTarget(nsIDOMEventTarget* aTarget)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aTarget);
|
||||
|
||||
NS_ASSERTION(!win || win == win->GetOuterWindow(),
|
||||
"Uh, inner window set as event target!");
|
||||
}
|
||||
#endif
|
||||
|
||||
mTarget = aTarget;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::SetCurrentTarget(nsIDOMEventTarget* aCurrentTarget)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aCurrentTarget);
|
||||
|
||||
NS_ASSERTION(!win || win == win->GetOuterWindow(),
|
||||
"Uh, inner window set as event target!");
|
||||
}
|
||||
#endif
|
||||
|
||||
mCurrentTarget = aCurrentTarget;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMEvent::SetOriginalTarget(nsIDOMEventTarget* aOriginalTarget)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aOriginalTarget);
|
||||
|
||||
NS_ASSERTION(!win || win == win->GetOuterWindow(),
|
||||
"Uh, inner window set as event target!");
|
||||
}
|
||||
#endif
|
||||
|
||||
mOriginalTarget = aOriginalTarget;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -396,6 +396,7 @@ nsGlobalWindow::ClearControllers()
|
||||
|
||||
// QueryInterface implementation for nsGlobalWindow
|
||||
NS_INTERFACE_MAP_BEGIN(nsGlobalWindow)
|
||||
// Make sure this matches the cast in nsGlobalWindow::FromWrapper()
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIScriptGlobalObject)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMWindowInternal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMWindow)
|
||||
@ -1199,8 +1200,9 @@ nsGlobalWindow::HandleDOMEvent(nsPresContext* aPresContext, nsEvent* aEvent,
|
||||
mListenerManager &&
|
||||
!(NS_EVENT_FLAG_CANT_BUBBLE & aEvent->flags && NS_EVENT_FLAG_BUBBLE & aFlags && !(NS_EVENT_FLAG_INIT & aFlags))) {
|
||||
aEvent->flags |= aFlags;
|
||||
mListenerManager->HandleEvent(aPresContext, aEvent, aDOMEvent, this,
|
||||
aFlags, aEventStatus);
|
||||
mListenerManager->HandleEvent(aPresContext, aEvent, aDOMEvent,
|
||||
GetOuterWindowInternal(), aFlags,
|
||||
aEventStatus);
|
||||
aEvent->flags &= ~aFlags;
|
||||
}
|
||||
|
||||
@ -4634,8 +4636,7 @@ nsGlobalWindow::DispatchEvent(nsIDOMEvent* aEvent, PRBool* _retval)
|
||||
// Retrieve the context
|
||||
nsCOMPtr<nsPresContext> presContext = shell->GetPresContext();
|
||||
return presContext->EventStateManager()->
|
||||
DispatchNewEvent(NS_STATIC_CAST(nsIScriptGlobalObject*, this),
|
||||
aEvent, _retval);
|
||||
DispatchNewEvent(GetOuterWindow(), aEvent, _retval);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user