Fixing bug 257523. Prevent Copy & Paste with generated DOM events. Patch by trev@gtchat.de, r=jst@mozilla.org, sr=dveditz@cruzio.com

This commit is contained in:
jst%mozilla.jstenback.com 2004-09-30 16:29:54 +00:00
Родитель 1e7fadf591
Коммит 30a055a3ab
2 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -98,6 +98,7 @@
#include "nsGUIEvent.h"
#include "nsIDOMEventGroup.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOMNSEvent.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIEventStateManager.h"
@ -374,12 +375,18 @@ static PRBool
DOMEventToNativeKeyEvent(nsIDOMEvent *aDOMEvent,
nsNativeKeyEvent *aNativeEvent)
{
nsCOMPtr<nsIDOMNSUIEvent> nsevent = do_QueryInterface(aDOMEvent);
nsCOMPtr<nsIDOMNSUIEvent> uievent = do_QueryInterface(aDOMEvent);
PRBool defaultPrevented;
nsevent->GetPreventDefault(&defaultPrevented);
uievent->GetPreventDefault(&defaultPrevented);
if (defaultPrevented)
return PR_FALSE;
nsCOMPtr<nsIDOMNSEvent> nsevent = do_QueryInterface(aDOMEvent);
PRBool trusted = PR_FALSE;
nsevent->GetIsTrusted(&trusted);
if (!trusted)
return PR_FALSE;
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aDOMEvent);
keyEvent->GetCharCode(&aNativeEvent->charCode);

Просмотреть файл

@ -98,6 +98,7 @@
#include "nsGUIEvent.h"
#include "nsIDOMEventGroup.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOMNSEvent.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIEventStateManager.h"
@ -374,12 +375,18 @@ static PRBool
DOMEventToNativeKeyEvent(nsIDOMEvent *aDOMEvent,
nsNativeKeyEvent *aNativeEvent)
{
nsCOMPtr<nsIDOMNSUIEvent> nsevent = do_QueryInterface(aDOMEvent);
nsCOMPtr<nsIDOMNSUIEvent> uievent = do_QueryInterface(aDOMEvent);
PRBool defaultPrevented;
nsevent->GetPreventDefault(&defaultPrevented);
uievent->GetPreventDefault(&defaultPrevented);
if (defaultPrevented)
return PR_FALSE;
nsCOMPtr<nsIDOMNSEvent> nsevent = do_QueryInterface(aDOMEvent);
PRBool trusted = PR_FALSE;
nsevent->GetIsTrusted(&trusted);
if (!trusted)
return PR_FALSE;
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aDOMEvent);
keyEvent->GetCharCode(&aNativeEvent->charCode);