Bug 939194 - Remove jsval event listeners. r=bz

This commit is contained in:
Tom Schuster 2013-11-16 13:31:37 +01:00
parent 4478f5b384
commit c15091f395
14 changed files with 7 additions and 177 deletions

View File

@ -1471,28 +1471,6 @@ NS_IMETHOD MozRemove() MOZ_FINAL \
nsINode::Remove(); \
return NS_OK; \
} \
using nsINode::GetOnmouseenter; \
using nsINode::SetOnmouseenter; \
NS_IMETHOD GetOnmouseenter(JSContext* cx, JS::Value* aOnmouseenter) MOZ_FINAL \
{ \
return Element::GetOnmouseenter(cx, aOnmouseenter); \
} \
NS_IMETHOD SetOnmouseenter(JSContext* cx, \
const JS::Value& aOnmouseenter) MOZ_FINAL \
{ \
return Element::SetOnmouseenter(cx, aOnmouseenter); \
} \
using nsINode::GetOnmouseleave; \
using nsINode::SetOnmouseleave; \
NS_IMETHOD GetOnmouseleave(JSContext* cx, JS::Value* aOnmouseleave) MOZ_FINAL \
{ \
return Element::GetOnmouseleave(cx, aOnmouseleave); \
} \
NS_IMETHOD SetOnmouseleave(JSContext* cx, \
const JS::Value& aOnmouseleave) MOZ_FINAL \
{ \
return Element::SetOnmouseleave(cx, aOnmouseleave); \
} \
NS_IMETHOD GetClientRects(nsIDOMClientRectList** _retval) MOZ_FINAL \
{ \
*_retval = Element::GetClientRects().get(); \

View File

@ -1709,9 +1709,7 @@ public:
*/
#define EVENT(name_, id_, type_, struct_) \
mozilla::dom::EventHandlerNonNull* GetOn##name_(); \
void SetOn##name_(mozilla::dom::EventHandlerNonNull* listener); \
NS_IMETHOD GetOn##name_(JSContext *cx, JS::Value *vp); \
NS_IMETHOD SetOn##name_(JSContext *cx, const JS::Value &v);
void SetOn##name_(mozilla::dom::EventHandlerNonNull* listener);
#define TOUCH_EVENT EVENT
#define DOCUMENT_ONLY_EVENT EVENT
#include "nsEventNameList.h"

View File

@ -19,13 +19,6 @@ interface nsIDOMBlob;
[scriptable, builtinclass, uuid(ac97e161-9f1d-4163-adc9-e9a59e18682c)]
interface nsIXMLHttpRequestEventTarget : nsIDOMEventTarget {
// event handler attributes
[implicit_jscontext] attribute jsval onabort;
[implicit_jscontext] attribute jsval onerror;
[implicit_jscontext] attribute jsval onload;
[implicit_jscontext] attribute jsval onloadstart;
[implicit_jscontext] attribute jsval onprogress;
[implicit_jscontext] attribute jsval ontimeout;
[implicit_jscontext] attribute jsval onloadend;
};
[scriptable, builtinclass, uuid(df3796fa-d98a-4185-9dda-d2f2b56a5d38)]

View File

@ -2198,21 +2198,6 @@ nsINode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
if (elm) { \
elm->SetEventHandler(nsGkAtoms::on##name_, EmptyString(), handler); \
} \
} \
NS_IMETHODIMP nsINode::GetOn##name_(JSContext *cx, JS::Value *vp) { \
EventHandlerNonNull* h = GetOn##name_(); \
vp->setObjectOrNull(h ? h->Callable().get() : nullptr); \
return NS_OK; \
} \
NS_IMETHODIMP nsINode::SetOn##name_(JSContext *cx, const JS::Value &v) { \
nsRefPtr<EventHandlerNonNull> handler; \
JSObject *callable; \
if (v.isObject() && \
JS_ObjectIsCallable(cx, callable = &v.toObject())) { \
handler = new EventHandlerNonNull(callable); \
} \
SetOn##name_(handler); \
return NS_OK; \
}
#define TOUCH_EVENT EVENT
#define DOCUMENT_ONLY_EVENT EVENT

View File

@ -247,14 +247,6 @@ NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(nsXHREventTarget, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(nsXHREventTarget, nsDOMEventTargetHelper)
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, loadstart)
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, progress)
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, abort)
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, error)
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, load)
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, timeout)
NS_IMPL_EVENT_HANDLER(nsXHREventTarget, loadend)
void
nsXHREventTarget::DisconnectFromOwner()
{

View File

@ -485,32 +485,6 @@ HTMLBodyElement::IsEventAttributeName(nsIAtom *aName)
// nsGenericHTMLElement::GetOnError returns
// already_AddRefed<EventHandlerNonNull> while other getters return
// EventHandlerNonNull*, so allow passing in the type to use here.
#define FORWARDED_EVENT_HELPER(name_, forwardto_, type_, getter_type_) \
NS_IMETHODIMP \
HTMLBodyElement::GetOn##name_(JSContext *cx, JS::Value *vp) \
{ \
getter_type_ h = forwardto_::GetOn##name_(); \
vp->setObjectOrNull(h ? h->Callable().get() : nullptr); \
return NS_OK; \
} \
NS_IMETHODIMP \
HTMLBodyElement::SetOn##name_(JSContext *cx, const JS::Value &v) \
{ \
nsRefPtr<type_> handler; \
JSObject *callable; \
if (v.isObject() && \
JS_ObjectIsCallable(cx, callable = &v.toObject())) { \
handler = new type_(callable); \
} \
forwardto_::SetOn##name_(handler); \
return NS_OK; \
}
#define FORWARDED_EVENT(name_, id_, type_, struct_) \
FORWARDED_EVENT_HELPER(name_, nsGenericHTMLElement, EventHandlerNonNull, \
EventHandlerNonNull*)
#define ERROR_EVENT(name_, id_, type_, struct_) \
FORWARDED_EVENT_HELPER(name_, nsGenericHTMLElement, \
EventHandlerNonNull, nsCOMPtr<EventHandlerNonNull>)
#define WINDOW_EVENT_HELPER(name_, type_) \
type_* \
HTMLBodyElement::GetOn##name_() \
@ -534,8 +508,7 @@ HTMLBodyElement::IsEventAttributeName(nsIAtom *aName)
nsCOMPtr<nsISupports> supports = do_QueryInterface(win); \
nsGlobalWindow* globalWin = nsGlobalWindow::FromSupports(supports); \
return globalWin->SetOn##name_(handler); \
} \
FORWARDED_EVENT_HELPER(name_, HTMLBodyElement, type_, type_*)
}
#define WINDOW_EVENT(name_, id_, type_, struct_) \
WINDOW_EVENT_HELPER(name_, EventHandlerNonNull)
#define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \
@ -544,9 +517,6 @@ HTMLBodyElement::IsEventAttributeName(nsIAtom *aName)
#undef BEFOREUNLOAD_EVENT
#undef WINDOW_EVENT
#undef WINDOW_EVENT_HELPER
#undef ERROR_EVENT
#undef FORWARDED_EVENT
#undef FORWARDED_EVENT_HELPER
#undef EVENT
} // namespace dom

View File

@ -55,9 +55,6 @@ public:
// Event listener stuff; we need to declare only the ones we need to
// forward to window that don't come from nsIDOMHTMLBodyElement.
#define EVENT(name_, id_, type_, struct_) /* nothing; handled by the shim */
#define FORWARDED_EVENT(name_, id_, type_, struct_) \
NS_IMETHOD GetOn##name_(JSContext *cx, JS::Value *vp); \
NS_IMETHOD SetOn##name_(JSContext *cx, const JS::Value &v);
#define WINDOW_EVENT_HELPER(name_, type_) \
type_* GetOn##name_(); \
void SetOn##name_(type_* handler);
@ -69,7 +66,6 @@ public:
#undef BEFOREUNLOAD_EVENT
#undef WINDOW_EVENT
#undef WINDOW_EVENT_HELPER
#undef FORWARDED_EVENT
#undef EVENT
void GetText(nsString& aText)

View File

@ -345,32 +345,6 @@ HTMLFrameSetElement::IsEventAttributeName(nsIAtom *aName)
// nsGenericHTMLElement::GetOnError returns
// already_AddRefed<EventHandlerNonNull> while other getters return
// EventHandlerNonNull*, so allow passing in the type to use here.
#define FORWARDED_EVENT_HELPER(name_, forwardto_, type_, getter_type_) \
NS_IMETHODIMP \
HTMLFrameSetElement::GetOn##name_(JSContext *cx, JS::Value *vp) \
{ \
getter_type_ h = forwardto_::GetOn##name_(); \
vp->setObjectOrNull(h ? h->Callable().get() : nullptr); \
return NS_OK; \
} \
NS_IMETHODIMP \
HTMLFrameSetElement::SetOn##name_(JSContext *cx, const JS::Value &v) \
{ \
nsRefPtr<type_> handler; \
JSObject *callable; \
if (v.isObject() && \
JS_ObjectIsCallable(cx, callable = &v.toObject())) { \
handler = new type_(callable); \
} \
forwardto_::SetOn##name_(handler); \
return NS_OK; \
}
#define FORWARDED_EVENT(name_, id_, type_, struct_) \
FORWARDED_EVENT_HELPER(name_, nsGenericHTMLElement, EventHandlerNonNull, \
EventHandlerNonNull*)
#define ERROR_EVENT(name_, id_, type_, struct_) \
FORWARDED_EVENT_HELPER(name_, nsGenericHTMLElement, \
EventHandlerNonNull, nsCOMPtr<EventHandlerNonNull>)
#define WINDOW_EVENT_HELPER(name_, type_) \
type_* \
HTMLFrameSetElement::GetOn##name_() \
@ -394,8 +368,7 @@ HTMLFrameSetElement::IsEventAttributeName(nsIAtom *aName)
nsCOMPtr<nsISupports> supports = do_QueryInterface(win); \
nsGlobalWindow* globalWin = nsGlobalWindow::FromSupports(supports); \
return globalWin->SetOn##name_(handler); \
} \
FORWARDED_EVENT_HELPER(name_, HTMLFrameSetElement, type_, type_*)
}
#define WINDOW_EVENT(name_, id_, type_, struct_) \
WINDOW_EVENT_HELPER(name_, EventHandlerNonNull)
#define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \
@ -404,9 +377,6 @@ HTMLFrameSetElement::IsEventAttributeName(nsIAtom *aName)
#undef BEFOREUNLOAD_EVENT
#undef WINDOW_EVENT
#undef WINDOW_EVENT_HELPER
#undef ERROR_EVENT
#undef FORWARDED_EVENT
#undef FORWARDED_EVENT_HELPER
#undef EVENT
} // namespace dom

View File

@ -85,9 +85,6 @@ public:
// Event listener stuff; we need to declare only the ones we need to
// forward to window that don't come from nsIDOMHTMLFrameSetElement.
#define EVENT(name_, id_, type_, struct_) /* nothing; handled by the superclass */
#define FORWARDED_EVENT(name_, id_, type_, struct_) \
NS_IMETHOD GetOn##name_(JSContext *cx, JS::Value *vp); \
NS_IMETHOD SetOn##name_(JSContext *cx, const JS::Value &v);
#define WINDOW_EVENT_HELPER(name_, type_) \
type_* GetOn##name_(); \
void SetOn##name_(type_* handler);
@ -99,7 +96,6 @@ public:
#undef BEFOREUNLOAD_EVENT
#undef WINDOW_EVENT
#undef WINDOW_EVENT_HELPER
#undef FORWARDED_EVENT
#undef EVENT
// These override the SetAttr methods in nsGenericHTMLElement (need

View File

@ -81,8 +81,6 @@ NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(nsScreen, nsDOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(nsScreen, nsDOMEventTargetHelper)
NS_IMPL_EVENT_HANDLER(nsScreen, mozorientationchange)
int32_t
nsScreen::GetPixelDepth(ErrorResult& aRv)
{

View File

@ -5,7 +5,7 @@
#include "nsIDOMEventTarget.idl"
[scriptable, builtinclass, uuid(310a1d9a-4271-4d85-9e35-9dae6683b2c1)]
[scriptable, builtinclass, uuid(bcdf4ce4-9785-4e31-a851-1d51ea16da20)]
interface nsIDOMScreen : nsIDOMEventTarget
{
readonly attribute long top;
@ -27,8 +27,6 @@ interface nsIDOMScreen : nsIDOMEventTarget
[binaryname(SlowMozOrientation)]
readonly attribute DOMString mozOrientation;
[implicit_jscontext] attribute jsval onmozorientationchange;
/**
* Lock the screen to the specified orientations(s). This method returns true
* if the lock was acquired successfully, and false otherwise.

View File

@ -15,7 +15,7 @@ interface nsIDOMMozNamedAttrMap;
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-element
*/
[scriptable, uuid(c3646b5d-a07d-470a-8e40-784459833c9f)]
[scriptable, uuid(989422ef-120d-4d29-8a56-6aa2505a8b02)]
interface nsIDOMElement : nsIDOMNode
{
readonly attribute DOMString tagName;
@ -80,12 +80,6 @@ interface nsIDOMElement : nsIDOMNode
[binaryname(MozRemove)]
void remove();
// HTML
[implicit_jscontext] attribute jsval onmouseenter;
[implicit_jscontext] attribute jsval onmouseleave;
// CSSOM View
/**
* Retrieve a list of rectangles, one for each CSS border-box associated with

View File

@ -20,7 +20,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(cc19f3c8-82fe-4337-8174-d4cde5bedcee)]
[scriptable, uuid(068630db-2c00-43dd-b167-495757a88236)]
interface nsIDOMHTMLBodyElement : nsISupports
{
attribute DOMString aLink;
@ -29,23 +29,4 @@ interface nsIDOMHTMLBodyElement : nsISupports
attribute DOMString link;
attribute DOMString text;
attribute DOMString vLink;
[implicit_jscontext] attribute jsval onafterprint;
[implicit_jscontext] attribute jsval onbeforeprint;
[implicit_jscontext] attribute jsval onbeforeunload;
[implicit_jscontext] attribute jsval onhashchange;
[implicit_jscontext] attribute jsval onmessage;
[implicit_jscontext] attribute jsval onoffline;
[implicit_jscontext] attribute jsval ononline;
[implicit_jscontext] attribute jsval onpagehide;
[implicit_jscontext] attribute jsval onpageshow;
[implicit_jscontext] attribute jsval onpopstate;
// Not supported yet
// [implicit_jscontext] attribute jsval onredo;
[implicit_jscontext] attribute jsval onresize;
// Not supported yet
// [implicit_jscontext] attribute jsval onstorage;
// Not supported yet
// [implicit_jscontext] attribute jsval onundo;
[implicit_jscontext] attribute jsval onunload;
};

View File

@ -20,28 +20,9 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(aea59d1c-ff6f-4b26-88dc-2f9b4be1a138)]
[scriptable, uuid(14b29269-c387-4cff-8463-b0871ca0be3a)]
interface nsIDOMHTMLFrameSetElement : nsISupports
{
attribute DOMString cols;
attribute DOMString rows;
[implicit_jscontext] attribute jsval onafterprint;
[implicit_jscontext] attribute jsval onbeforeprint;
[implicit_jscontext] attribute jsval onbeforeunload;
[implicit_jscontext] attribute jsval onhashchange;
[implicit_jscontext] attribute jsval onmessage;
[implicit_jscontext] attribute jsval onoffline;
[implicit_jscontext] attribute jsval ononline;
[implicit_jscontext] attribute jsval onpagehide;
[implicit_jscontext] attribute jsval onpageshow;
[implicit_jscontext] attribute jsval onpopstate;
// Not supported yet
// [implicit_jscontext] attribute jsval onredo;
[implicit_jscontext] attribute jsval onresize;
// Not supported yet
// [implicit_jscontext] attribute jsval onstorage;
// Not supported yet
// [implicit_jscontext] attribute jsval onundo;
[implicit_jscontext] attribute jsval onunload;
};