Bug 542938: add a pref to control whether oncopy/oncut/onpaste events are fired, r=smaug

This commit is contained in:
Robert Accettura 2012-02-13 10:06:26 -08:00
Родитель 6dc06e60dd
Коммит 5c36321020
2 изменённых файлов: 15 добавлений и 8 удалений

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

@ -81,6 +81,10 @@
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
nsresult NS_NewDomSelection(nsISelection **aDomSelection);
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
@ -727,14 +731,16 @@ nsCopySupport::FireClipboardEvent(PRInt32 aType, nsIPresShell* aPresShell, nsISe
return false;
// next, fire the cut or copy event
nsEventStatus status = nsEventStatus_eIgnore;
nsEvent evt(true, aType);
nsEventDispatcher::Dispatch(content, presShell->GetPresContext(), &evt, nsnull,
&status);
// if the event was cancelled, don't do the clipboard operation
if (status == nsEventStatus_eConsumeNoDefault)
return false;
if (Preferences::GetBool("dom.event.clipboardevents.enabled", true)) {
nsEventStatus status = nsEventStatus_eIgnore;
nsEvent evt(true, aType);
nsEventDispatcher::Dispatch(content, presShell->GetPresContext(), &evt, nsnull,
&status);
// if the event was cancelled, don't do the clipboard operation
if (status == nsEventStatus_eConsumeNoDefault)
return false;
}
if (presShell->IsDestroying())
return false;

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

@ -634,6 +634,7 @@ pref("privacy.popups.disable_from_plugins", 2);
pref("privacy.donottrackheader.enabled", false);
pref("dom.event.contextmenu.enabled", true);
pref("dom.event.clipboardevents.enabled", true);
pref("javascript.enabled", true);
pref("javascript.options.strict", false);