mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
90b5c814e8
ErrorResult is in a separate header file so it can be included from all over the place without having to pull in mozilla/dom/Utils.h and all the xpconnect gunk that needs.
72 lines
1.7 KiB
C++
72 lines
1.7 KiB
C++
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
|
/* 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/. */
|
|
|
|
#ifndef mozilla_dom_workers_eventtarget_h__
|
|
#define mozilla_dom_workers_eventtarget_h__
|
|
|
|
#include "mozilla/dom/workers/bindings/DOMBindingBase.h"
|
|
|
|
// I hate having to export this...
|
|
#include "mozilla/dom/workers/bindings/EventListenerManager.h"
|
|
|
|
#include "mozilla/dom/Nullable.h"
|
|
#include "mozilla/ErrorResult.h"
|
|
|
|
using namespace mozilla::dom;
|
|
|
|
BEGIN_WORKERS_NAMESPACE
|
|
|
|
class EventTarget : public DOMBindingBase
|
|
{
|
|
EventListenerManager mListenerManager;
|
|
|
|
protected:
|
|
EventTarget(JSContext* aCx)
|
|
: DOMBindingBase(aCx)
|
|
{ }
|
|
|
|
virtual ~EventTarget()
|
|
{ }
|
|
|
|
public:
|
|
virtual void
|
|
_Trace(JSTracer* aTrc) MOZ_OVERRIDE;
|
|
|
|
virtual void
|
|
_Finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
|
|
|
|
void
|
|
AddEventListener(const nsAString& aType, JSObject* aListener,
|
|
bool aCapture, Nullable<bool> aWantsUntrusted,
|
|
ErrorResult& aRv);
|
|
|
|
void
|
|
RemoveEventListener(const nsAString& aType, JSObject* aListener,
|
|
bool aCapture, ErrorResult& aRv);
|
|
|
|
bool
|
|
DispatchEvent(JSObject* aEvent, ErrorResult& aRv) const
|
|
{
|
|
return mListenerManager.DispatchEvent(GetJSContext(), *this, aEvent, aRv);
|
|
}
|
|
|
|
JSObject*
|
|
GetEventListener(const nsAString& aType, ErrorResult& aRv) const;
|
|
|
|
void
|
|
SetEventListener(const nsAString& aType, JSObject* aListener,
|
|
ErrorResult& aRv);
|
|
|
|
bool
|
|
HasListeners() const
|
|
{
|
|
return mListenerManager.HasListeners();
|
|
}
|
|
};
|
|
|
|
END_WORKERS_NAMESPACE
|
|
|
|
#endif // mozilla_dom_workers_eventtarget_h__
|