Bug 41013: Prevent event passing from frames to content during document destruction r=joki

git-svn-id: svn://10.0.0.236/trunk@73495 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pollmann%netscape.com
2000-06-29 02:02:43 +00:00
parent 0e43b9fadb
commit ba1a3e50a6
10 changed files with 137 additions and 13 deletions

View File

@@ -1417,7 +1417,11 @@ nsMenuFrame::Execute()
event.isMeta = PR_FALSE;
event.clickCount = 0;
event.widget = nsnull;
mContent->HandleDOMEvent(mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
nsCOMPtr<nsIPresShell> shell;
nsresult result = mPresContext->GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(result) && shell) {
shell->HandleDOMEventWithTarget(mContent, &event, &status);
}
// XXX HACK. Just gracefully exit if the node has been removed, e.g., window.close()
// was executed.
@@ -1452,9 +1456,16 @@ nsMenuFrame::OnCreate()
GetMenuChildrenElement(getter_AddRefs(child));
nsresult rv;
if (child)
rv = child->HandleDOMEvent(mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
else rv = mContent->HandleDOMEvent(mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
nsCOMPtr<nsIPresShell> shell;
rv = mPresContext->GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && shell) {
if (child) {
rv = shell->HandleDOMEventWithTarget(child, &event, &status);
}
else {
rv = shell->HandleDOMEventWithTarget(mContent, &event, &status);
}
}
if ( NS_FAILED(rv) || status == nsEventStatus_eConsumeNoDefault )
return PR_FALSE;
@@ -1479,9 +1490,16 @@ nsMenuFrame::OnDestroy()
GetMenuChildrenElement(getter_AddRefs(child));
nsresult rv;
if (child)
rv = child->HandleDOMEvent(mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
else rv = mContent->HandleDOMEvent(mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
nsCOMPtr<nsIPresShell> shell;
rv = mPresContext->GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && shell) {
if (child) {
rv = shell->HandleDOMEventWithTarget(child, &event, &status);
}
else {
rv = shell->HandleDOMEventWithTarget(mContent, &event, &status);
}
}
if ( NS_FAILED(rv) || status == nsEventStatus_eConsumeNoDefault )
return PR_FALSE;