Allow for oncreate handler to stop creation of popups by returning false from event handler.

git-svn-id: svn://10.0.0.236/trunk@38464 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pinkerton%netscape.com
1999-07-06 23:21:23 +00:00
parent 5426224349
commit 5be46e3134

View File

@@ -1186,13 +1186,15 @@ nsWebShellWindow::CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupCont
return NS_OK; // It's ok. Really.
// Fire the CONSTRUCT DOM event to give JS/C++ a chance to build the popup
// dynamically.
// dynamically. After we fire off the event, make sure we check the result
// for |nsEventStatus_eConsumeNoDefault| which translates into an event
// handler returning false. If that happens, abort creating the popup.
nsEventStatus status = nsEventStatus_eIgnore;
nsMouseEvent event;
event.eventStructType = NS_EVENT;
event.message = NS_POPUP_CONSTRUCT;
rv = popupContent->HandleDOMEvent(*presContext, &event, nsnull, NS_EVENT_FLAG_INIT, status);
if ( NS_FAILED(rv) )
if ( NS_FAILED(rv) || status == nsEventStatus_eConsumeNoDefault )
return rv;
// Find out if we're a menu.