2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-06-15 12:27:29 +04:00
|
|
|
|
2014-04-01 10:13:50 +04:00
|
|
|
#ifndef mozilla_DOMEventTargetHelper_h_
|
|
|
|
#define mozilla_DOMEventTargetHelper_h_
|
2009-06-15 12:27:29 +04:00
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
2012-08-31 07:45:16 +04:00
|
|
|
#include "nsGkAtoms.h"
|
2009-06-15 12:27:29 +04:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsPIDOMWindow.h"
|
|
|
|
#include "nsIScriptGlobalObject.h"
|
2010-06-23 23:46:08 +04:00
|
|
|
#include "nsIScriptContext.h"
|
2015-01-18 06:17:06 +03:00
|
|
|
#include "nsIWeakReferenceUtils.h"
|
2013-09-19 17:54:42 +04:00
|
|
|
#include "MainThreadUtils.h"
|
2012-06-19 06:30:09 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-03-17 10:56:53 +04:00
|
|
|
#include "mozilla/EventListenerManager.h"
|
2012-12-07 05:39:51 +04:00
|
|
|
#include "mozilla/dom/EventTarget.h"
|
2009-06-15 12:27:29 +04:00
|
|
|
|
2014-06-19 04:57:51 +04:00
|
|
|
struct JSCompartment;
|
2016-04-21 01:04:29 +03:00
|
|
|
class nsIDocument;
|
2014-04-01 10:13:50 +04:00
|
|
|
|
2013-11-27 19:22:16 +04:00
|
|
|
namespace mozilla {
|
2014-04-01 10:13:50 +04:00
|
|
|
|
2013-11-27 19:22:16 +04:00
|
|
|
class ErrorResult;
|
|
|
|
|
2013-03-09 15:34:29 +04:00
|
|
|
#define NS_DOMEVENTTARGETHELPER_IID \
|
2013-11-27 19:22:16 +04:00
|
|
|
{ 0xa28385c6, 0x9451, 0x4d7e, \
|
|
|
|
{ 0xa3, 0xdd, 0xf4, 0xb6, 0x87, 0x2f, 0xa4, 0x76 } }
|
2013-03-09 15:34:29 +04:00
|
|
|
|
2014-04-01 10:13:50 +04:00
|
|
|
class DOMEventTargetHelper : public dom::EventTarget
|
2009-06-15 12:27:29 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-04-01 10:13:50 +04:00
|
|
|
DOMEventTargetHelper()
|
2013-04-25 06:44:24 +04:00
|
|
|
: mParentObject(nullptr)
|
|
|
|
, mOwnerWindow(nullptr)
|
|
|
|
, mHasOrHasHadOwnerWindow(false)
|
2014-04-01 10:13:50 +04:00
|
|
|
{
|
|
|
|
}
|
2016-01-30 20:05:36 +03:00
|
|
|
explicit DOMEventTargetHelper(nsPIDOMWindowInner* aWindow)
|
2013-04-25 06:44:24 +04:00
|
|
|
: mParentObject(nullptr)
|
|
|
|
, mOwnerWindow(nullptr)
|
|
|
|
, mHasOrHasHadOwnerWindow(false)
|
|
|
|
{
|
|
|
|
BindToOwner(aWindow);
|
2014-01-07 06:53:23 +04:00
|
|
|
}
|
2015-01-05 18:23:36 +03:00
|
|
|
explicit DOMEventTargetHelper(nsIGlobalObject* aGlobalObject)
|
|
|
|
: mParentObject(nullptr)
|
|
|
|
, mOwnerWindow(nullptr)
|
|
|
|
, mHasOrHasHadOwnerWindow(false)
|
|
|
|
{
|
|
|
|
BindToOwner(aGlobalObject);
|
|
|
|
}
|
2014-08-05 17:19:51 +04:00
|
|
|
explicit DOMEventTargetHelper(DOMEventTargetHelper* aOther)
|
2014-01-07 06:53:23 +04:00
|
|
|
: mParentObject(nullptr)
|
|
|
|
, mOwnerWindow(nullptr)
|
|
|
|
, mHasOrHasHadOwnerWindow(false)
|
|
|
|
{
|
|
|
|
BindToOwner(aOther);
|
2013-04-25 06:44:24 +04:00
|
|
|
}
|
|
|
|
|
2009-06-15 12:27:29 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2014-04-01 10:13:50 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(DOMEventTargetHelper)
|
2009-06-15 12:27:29 +04:00
|
|
|
|
|
|
|
NS_DECL_NSIDOMEVENTTARGET
|
2013-10-23 03:32:04 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual EventListenerManager* GetExistingListenerManager() const override;
|
|
|
|
virtual EventListenerManager* GetOrCreateListenerManager() override;
|
2013-10-23 03:32:04 +04:00
|
|
|
|
2014-04-01 10:13:50 +04:00
|
|
|
using dom::EventTarget::RemoveEventListener;
|
2013-04-17 01:16:08 +04:00
|
|
|
virtual void AddEventListener(const nsAString& aType,
|
2014-04-01 10:13:50 +04:00
|
|
|
dom::EventListener* aListener,
|
2016-04-26 11:23:17 +03:00
|
|
|
const dom::AddEventListenerOptionsOrBoolean& aOptions,
|
2014-04-01 10:13:50 +04:00
|
|
|
const dom::Nullable<bool>& aWantsUntrusted,
|
2015-03-21 19:28:04 +03:00
|
|
|
ErrorResult& aRv) override;
|
2009-06-15 12:27:29 +04:00
|
|
|
|
2013-03-09 15:34:29 +04:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOMEVENTTARGETHELPER_IID)
|
|
|
|
|
2012-02-08 06:53:33 +04:00
|
|
|
void GetParentObject(nsIScriptGlobalObject **aParentObject)
|
|
|
|
{
|
2013-04-04 13:30:36 +04:00
|
|
|
if (mParentObject) {
|
|
|
|
CallQueryInterface(mParentObject, aParentObject);
|
|
|
|
} else {
|
2012-07-30 18:20:58 +04:00
|
|
|
*aParentObject = nullptr;
|
2012-02-08 06:53:33 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-01 10:13:50 +04:00
|
|
|
static DOMEventTargetHelper* FromSupports(nsISupports* aSupports)
|
2012-02-08 06:53:33 +04:00
|
|
|
{
|
2014-04-01 10:13:50 +04:00
|
|
|
dom::EventTarget* target = static_cast<dom::EventTarget*>(aSupports);
|
2012-02-08 06:53:33 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
{
|
2014-04-01 10:13:50 +04:00
|
|
|
nsCOMPtr<dom::EventTarget> target_qi = do_QueryInterface(aSupports);
|
2012-02-08 06:53:33 +04:00
|
|
|
|
|
|
|
// If this assertion fires the QI implementation for the object in
|
2013-04-06 04:44:26 +04:00
|
|
|
// question doesn't use the EventTarget pointer as the
|
2012-02-08 06:53:33 +04:00
|
|
|
// nsISupports pointer. That must be fixed, or we'll crash...
|
|
|
|
NS_ASSERTION(target_qi == target, "Uh, fix QI!");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-04-01 10:13:50 +04:00
|
|
|
return static_cast<DOMEventTargetHelper*>(target);
|
2012-02-08 06:53:33 +04:00
|
|
|
}
|
|
|
|
|
2015-01-15 19:58:40 +03:00
|
|
|
bool HasListenersFor(const nsAString& aType)
|
|
|
|
{
|
|
|
|
return mListenerManager && mListenerManager->HasListenersFor(aType);
|
|
|
|
}
|
|
|
|
|
2012-10-29 08:33:51 +04:00
|
|
|
bool HasListenersFor(nsIAtom* aTypeWithOn)
|
2009-06-15 12:27:29 +04:00
|
|
|
{
|
2012-10-29 08:33:51 +04:00
|
|
|
return mListenerManager && mListenerManager->HasListenersFor(aTypeWithOn);
|
2009-06-15 12:27:29 +04:00
|
|
|
}
|
|
|
|
|
2012-08-31 07:45:16 +04:00
|
|
|
nsresult SetEventHandler(nsIAtom* aType,
|
|
|
|
JSContext* aCx,
|
|
|
|
const JS::Value& aValue);
|
2014-04-01 10:13:50 +04:00
|
|
|
using dom::EventTarget::SetEventHandler;
|
2012-08-31 07:45:16 +04:00
|
|
|
void GetEventHandler(nsIAtom* aType,
|
|
|
|
JSContext* aCx,
|
|
|
|
JS::Value* aValue);
|
2014-04-01 10:13:50 +04:00
|
|
|
using dom::EventTarget::GetEventHandler;
|
2016-01-30 20:05:36 +03:00
|
|
|
virtual nsPIDOMWindowOuter* GetOwnerGlobalForBindings() override
|
2013-05-31 01:46:39 +04:00
|
|
|
{
|
2016-01-30 20:05:36 +03:00
|
|
|
return nsPIDOMWindowOuter::GetFromCurrentInner(GetOwner());
|
2013-05-31 01:46:39 +04:00
|
|
|
}
|
2009-06-15 12:27:29 +04:00
|
|
|
|
2016-04-21 01:04:29 +03:00
|
|
|
nsresult CheckInnerWindowCorrectness() const
|
2009-06-15 12:27:29 +04:00
|
|
|
{
|
2013-04-04 13:30:36 +04:00
|
|
|
NS_ENSURE_STATE(!mHasOrHasHadOwnerWindow || mOwnerWindow);
|
2014-05-20 23:50:57 +04:00
|
|
|
if (mOwnerWindow && !mOwnerWindow->IsCurrentInnerWindow()) {
|
|
|
|
return NS_ERROR_FAILURE;
|
2009-06-15 12:27:29 +04:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-03-13 04:56:07 +04:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowInner* GetOwner() const { return mOwnerWindow; }
|
2016-04-21 01:04:29 +03:00
|
|
|
// Like GetOwner, but only returns non-null if the window being returned is
|
|
|
|
// current (in the "current document" sense of the HTML spec).
|
|
|
|
nsPIDOMWindowInner* GetWindowIfCurrent() const;
|
|
|
|
// Returns the document associated with this event target, if that document is
|
|
|
|
// the current document of its browsing context. Will return null otherwise.
|
|
|
|
nsIDocument* GetDocumentIfCurrent() const;
|
2013-04-04 13:30:36 +04:00
|
|
|
void BindToOwner(nsIGlobalObject* aOwner);
|
2016-01-30 20:05:36 +03:00
|
|
|
void BindToOwner(nsPIDOMWindowInner* aOwner);
|
2014-04-01 10:13:50 +04:00
|
|
|
void BindToOwner(DOMEventTargetHelper* aOther);
|
2012-03-13 04:56:07 +04:00
|
|
|
virtual void DisconnectFromOwner();
|
2015-05-12 22:56:39 +03:00
|
|
|
nsIGlobalObject* GetParentObject() const
|
|
|
|
{
|
|
|
|
return GetOwnerGlobal();
|
|
|
|
}
|
|
|
|
virtual nsIGlobalObject* GetOwnerGlobal() const override
|
|
|
|
{
|
2015-01-18 06:17:06 +03:00
|
|
|
nsCOMPtr<nsIGlobalObject> parentObject = do_QueryReferent(mParentObject);
|
|
|
|
return parentObject;
|
|
|
|
}
|
2013-04-04 13:30:36 +04:00
|
|
|
bool HasOrHasHadOwner() { return mHasOrHasHadOwnerWindow; }
|
2013-11-27 19:22:16 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void EventListenerAdded(nsIAtom* aType) override;
|
|
|
|
virtual void EventListenerRemoved(nsIAtom* aType) override;
|
2013-11-27 19:22:16 +04:00
|
|
|
virtual void EventListenerWasAdded(const nsAString& aType,
|
2014-04-01 10:13:50 +04:00
|
|
|
ErrorResult& aRv,
|
2013-11-27 19:22:16 +04:00
|
|
|
JSCompartment* aCompartment = nullptr) {}
|
|
|
|
virtual void EventListenerWasRemoved(const nsAString& aType,
|
2014-04-01 10:13:50 +04:00
|
|
|
ErrorResult& aRv,
|
2013-11-27 19:22:16 +04:00
|
|
|
JSCompartment* aCompartment = nullptr) {}
|
2014-07-15 01:15:23 +04:00
|
|
|
|
|
|
|
// Dispatch a trusted, non-cancellable and non-bubbling event to |this|.
|
|
|
|
nsresult DispatchTrustedEvent(const nsAString& aEventName);
|
2009-06-15 12:27:29 +04:00
|
|
|
protected:
|
2014-06-23 23:56:07 +04:00
|
|
|
virtual ~DOMEventTargetHelper();
|
|
|
|
|
2013-09-06 01:08:24 +04:00
|
|
|
nsresult WantsUntrusted(bool* aRetVal);
|
|
|
|
|
2015-06-29 19:42:41 +03:00
|
|
|
// If this method returns true your object is kept alive until it returns
|
|
|
|
// false. You can use this method instead using
|
|
|
|
// NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN macro.
|
|
|
|
virtual bool IsCertainlyAliveForCC() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<EventListenerManager> mListenerManager;
|
2012-09-28 00:11:31 +04:00
|
|
|
// Make |event| trusted and dispatch |aEvent| to |this|.
|
|
|
|
nsresult DispatchTrustedEvent(nsIDOMEvent* aEvent);
|
2013-07-09 21:30:58 +04:00
|
|
|
|
|
|
|
virtual void LastRelease() {}
|
2012-03-13 04:56:07 +04:00
|
|
|
private:
|
2013-04-04 13:30:36 +04:00
|
|
|
// Inner window or sandbox.
|
2015-01-18 06:17:06 +03:00
|
|
|
nsWeakPtr mParentObject;
|
2014-05-20 23:50:57 +04:00
|
|
|
// mParentObject pre QI-ed and cached (inner window)
|
2013-04-04 13:30:36 +04:00
|
|
|
// (it is needed for off main thread access)
|
2015-01-18 06:17:06 +03:00
|
|
|
// It is obtained in BindToOwner and reset in DisconnectFromOwner.
|
2016-01-30 20:05:36 +03:00
|
|
|
nsPIDOMWindowInner* MOZ_NON_OWNING_REF mOwnerWindow;
|
2013-04-04 13:30:36 +04:00
|
|
|
bool mHasOrHasHadOwnerWindow;
|
2009-06-15 12:27:29 +04:00
|
|
|
};
|
|
|
|
|
2014-04-01 10:13:50 +04:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(DOMEventTargetHelper,
|
2013-03-09 15:34:29 +04:00
|
|
|
NS_DOMEVENTTARGETHELPER_IID)
|
|
|
|
|
2014-04-01 10:13:50 +04:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2012-11-09 20:00:25 +04:00
|
|
|
// XPIDL event handlers
|
2012-08-31 07:45:16 +04:00
|
|
|
#define NS_IMPL_EVENT_HANDLER(_class, _event) \
|
2014-01-09 21:39:36 +04:00
|
|
|
NS_IMETHODIMP _class::GetOn##_event(JSContext* aCx, \
|
|
|
|
JS::MutableHandle<JS::Value> aValue) \
|
2012-02-08 06:53:33 +04:00
|
|
|
{ \
|
2014-01-09 21:39:36 +04:00
|
|
|
GetEventHandler(nsGkAtoms::on##_event, aCx, aValue.address()); \
|
2012-08-31 07:45:16 +04:00
|
|
|
return NS_OK; \
|
2012-02-08 06:53:33 +04:00
|
|
|
} \
|
2012-08-31 07:45:16 +04:00
|
|
|
NS_IMETHODIMP _class::SetOn##_event(JSContext* aCx, \
|
2014-01-09 21:39:36 +04:00
|
|
|
JS::Handle<JS::Value> aValue) \
|
2012-02-08 06:53:33 +04:00
|
|
|
{ \
|
2012-08-31 07:45:16 +04:00
|
|
|
return SetEventHandler(nsGkAtoms::on##_event, aCx, aValue); \
|
2012-02-08 06:53:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#define NS_IMPL_FORWARD_EVENT_HANDLER(_class, _event, _baseclass) \
|
2014-01-09 21:39:36 +04:00
|
|
|
NS_IMETHODIMP _class::GetOn##_event(JSContext* aCx, \
|
|
|
|
JS::MutableHandle<JS::Value> aValue) \
|
2012-02-08 06:53:33 +04:00
|
|
|
{ \
|
2012-08-31 07:45:16 +04:00
|
|
|
return _baseclass::GetOn##_event(aCx, aValue); \
|
2012-02-08 06:53:33 +04:00
|
|
|
} \
|
2012-08-31 07:45:16 +04:00
|
|
|
NS_IMETHODIMP _class::SetOn##_event(JSContext* aCx, \
|
2014-01-09 21:39:36 +04:00
|
|
|
JS::Handle<JS::Value> aValue) \
|
2012-02-08 06:53:33 +04:00
|
|
|
{ \
|
2012-08-31 07:45:16 +04:00
|
|
|
return _baseclass::SetOn##_event(aCx, aValue); \
|
2012-02-08 06:53:33 +04:00
|
|
|
}
|
|
|
|
|
2012-11-09 20:00:25 +04:00
|
|
|
// WebIDL event handlers
|
|
|
|
#define IMPL_EVENT_HANDLER(_event) \
|
2012-11-09 20:00:25 +04:00
|
|
|
inline mozilla::dom::EventHandlerNonNull* GetOn##_event() \
|
2012-11-09 20:00:25 +04:00
|
|
|
{ \
|
2013-08-16 14:06:24 +04:00
|
|
|
if (NS_IsMainThread()) { \
|
|
|
|
return GetEventHandler(nsGkAtoms::on##_event, EmptyString()); \
|
|
|
|
} \
|
|
|
|
return GetEventHandler(nullptr, NS_LITERAL_STRING(#_event)); \
|
2012-11-09 20:00:25 +04:00
|
|
|
} \
|
2013-09-17 15:01:28 +04:00
|
|
|
inline void SetOn##_event(mozilla::dom::EventHandlerNonNull* aCallback) \
|
2012-11-09 20:00:25 +04:00
|
|
|
{ \
|
2013-08-16 14:06:24 +04:00
|
|
|
if (NS_IsMainThread()) { \
|
2013-09-17 15:01:28 +04:00
|
|
|
SetEventHandler(nsGkAtoms::on##_event, EmptyString(), aCallback); \
|
2013-08-16 14:06:24 +04:00
|
|
|
} else { \
|
2013-09-17 15:01:28 +04:00
|
|
|
SetEventHandler(nullptr, NS_LITERAL_STRING(#_event), aCallback); \
|
2013-08-16 14:06:24 +04:00
|
|
|
} \
|
2012-11-09 20:00:25 +04:00
|
|
|
}
|
|
|
|
|
2012-06-03 20:33:52 +04:00
|
|
|
/* Use this macro to declare functions that forward the behavior of this
|
|
|
|
* interface to another object.
|
|
|
|
* This macro doesn't forward PreHandleEvent because sometimes subclasses
|
|
|
|
* want to override it.
|
|
|
|
*/
|
|
|
|
#define NS_FORWARD_NSIDOMEVENTTARGET_NOPREHANDLEEVENT(_to) \
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD AddEventListener(const nsAString & type, nsIDOMEventListener *listener, bool useCapture, bool wantsUntrusted, uint8_t _argc) { \
|
2012-06-03 20:33:52 +04:00
|
|
|
return _to AddEventListener(type, listener, useCapture, wantsUntrusted, _argc); \
|
|
|
|
} \
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD AddSystemEventListener(const nsAString & type, nsIDOMEventListener *listener, bool aUseCapture, bool aWantsUntrusted, uint8_t _argc) { \
|
2012-06-03 20:33:52 +04:00
|
|
|
return _to AddSystemEventListener(type, listener, aUseCapture, aWantsUntrusted, _argc); \
|
|
|
|
} \
|
2012-07-07 00:31:49 +04:00
|
|
|
NS_IMETHOD RemoveEventListener(const nsAString & type, nsIDOMEventListener *listener, bool useCapture) { \
|
2012-06-03 20:33:52 +04:00
|
|
|
return _to RemoveEventListener(type, listener, useCapture); \
|
|
|
|
} \
|
|
|
|
NS_IMETHOD RemoveSystemEventListener(const nsAString & type, nsIDOMEventListener *listener, bool aUseCapture) { \
|
|
|
|
return _to RemoveSystemEventListener(type, listener, aUseCapture); \
|
|
|
|
} \
|
2012-07-07 00:31:49 +04:00
|
|
|
NS_IMETHOD DispatchEvent(nsIDOMEvent *evt, bool *_retval) { \
|
2012-06-03 20:33:52 +04:00
|
|
|
return _to DispatchEvent(evt, _retval); \
|
|
|
|
} \
|
2013-03-17 11:55:17 +04:00
|
|
|
virtual mozilla::dom::EventTarget* GetTargetForDOMEvent() { \
|
2012-06-03 20:33:52 +04:00
|
|
|
return _to GetTargetForDOMEvent(); \
|
|
|
|
} \
|
2013-03-17 11:55:17 +04:00
|
|
|
virtual mozilla::dom::EventTarget* GetTargetForEventTargetChain() { \
|
2012-06-03 20:33:52 +04:00
|
|
|
return _to GetTargetForEventTargetChain(); \
|
|
|
|
} \
|
2014-03-18 08:48:20 +04:00
|
|
|
virtual nsresult WillHandleEvent( \
|
|
|
|
mozilla::EventChainPostVisitor & aVisitor) { \
|
2012-06-03 20:33:52 +04:00
|
|
|
return _to WillHandleEvent(aVisitor); \
|
|
|
|
} \
|
2014-03-18 08:48:20 +04:00
|
|
|
virtual nsresult PostHandleEvent( \
|
|
|
|
mozilla::EventChainPostVisitor & aVisitor) { \
|
2012-06-03 20:33:52 +04:00
|
|
|
return _to PostHandleEvent(aVisitor); \
|
|
|
|
} \
|
2013-10-02 07:46:04 +04:00
|
|
|
virtual nsresult DispatchDOMEvent(mozilla::WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent, nsPresContext* aPresContext, nsEventStatus* aEventStatus) { \
|
2012-06-03 20:33:52 +04:00
|
|
|
return _to DispatchDOMEvent(aEvent, aDOMEvent, aPresContext, aEventStatus); \
|
|
|
|
} \
|
2014-03-17 10:56:53 +04:00
|
|
|
virtual mozilla::EventListenerManager* GetOrCreateListenerManager() { \
|
2013-10-23 03:32:04 +04:00
|
|
|
return _to GetOrCreateListenerManager(); \
|
|
|
|
} \
|
2014-03-17 10:56:53 +04:00
|
|
|
virtual mozilla::EventListenerManager* GetExistingListenerManager() const { \
|
2013-10-23 03:32:04 +04:00
|
|
|
return _to GetExistingListenerManager(); \
|
2012-06-03 20:33:52 +04:00
|
|
|
} \
|
2012-07-07 00:14:07 +04:00
|
|
|
virtual nsIScriptContext * GetContextForEventHandlers(nsresult *aRv) { \
|
2012-06-03 20:33:52 +04:00
|
|
|
return _to GetContextForEventHandlers(aRv); \
|
|
|
|
} \
|
|
|
|
virtual JSContext * GetJSContextForEventHandlers(void) { \
|
|
|
|
return _to GetJSContextForEventHandlers(); \
|
2013-04-17 01:16:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#define NS_REALLY_FORWARD_NSIDOMEVENTTARGET(_class) \
|
|
|
|
using _class::AddEventListener; \
|
|
|
|
using _class::RemoveEventListener; \
|
2013-10-23 03:32:04 +04:00
|
|
|
NS_FORWARD_NSIDOMEVENTTARGET(_class::) \
|
2014-03-17 10:56:53 +04:00
|
|
|
virtual mozilla::EventListenerManager* \
|
2015-03-27 21:52:19 +03:00
|
|
|
GetOrCreateListenerManager() override { \
|
2013-10-23 03:32:04 +04:00
|
|
|
return _class::GetOrCreateListenerManager(); \
|
|
|
|
} \
|
2014-03-17 10:56:53 +04:00
|
|
|
virtual mozilla::EventListenerManager* \
|
2015-03-27 21:52:19 +03:00
|
|
|
GetExistingListenerManager() const override { \
|
2013-10-23 03:32:04 +04:00
|
|
|
return _class::GetExistingListenerManager(); \
|
|
|
|
}
|
2012-06-03 20:33:52 +04:00
|
|
|
|
2014-04-01 10:13:50 +04:00
|
|
|
#endif // mozilla_DOMEventTargetHelper_h_
|