Fixing bug 257523. Only handle XBL commands if they're triggerd by events initiated by the user. Patch by trev@gtchat.de, r=jst@mozilla.org, sr=dveditz@cruzio.com, a=chofmann@mozilla.org

This commit is contained in:
jst%mozilla.jstenback.com 2004-09-02 00:33:51 +00:00
parent 42fee317b7
commit a8cd90ba37

View File

@ -223,9 +223,11 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventReceiver* aReceiver,
// See if our event receiver is a content node (and not us).
PRBool isXULKey = (mType & NS_HANDLER_TYPE_XUL);
PRBool isXBLCommand = (mType & NS_HANDLER_TYPE_XBL_COMMAND);
//XUL handlers shouldn't be triggered by non-trusted events.
if (isXULKey) {
// XUL handlers and commands shouldn't be triggered by non-trusted
// events.
if (isXULKey || isXBLCommand) {
nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(aEvent);
if (privateEvent) {
PRBool trustedEvent;
@ -242,7 +244,7 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventReceiver* aReceiver,
// This is a special-case optimization to make command handling fast.
// It isn't really a part of XBL, but it helps speed things up.
if ((mType & NS_HANDLER_TYPE_XBL_COMMAND) && !isReceiverCommandElement) {
if (isXBLCommand && !isReceiverCommandElement) {
// See if preventDefault has been set. If so, don't execute.
PRBool preventDefault;
nsCOMPtr<nsIDOMNSUIEvent> nsUIEvent(do_QueryInterface(aEvent));