summaryrefslogtreecommitdiff
path: root/dom/events/EventTarget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/events/EventTarget.cpp')
-rw-r--r--dom/events/EventTarget.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/dom/events/EventTarget.cpp b/dom/events/EventTarget.cpp
index cf69dcb859..5f9228c21c 100644
--- a/dom/events/EventTarget.cpp
+++ b/dom/events/EventTarget.cpp
@@ -7,11 +7,26 @@
#include "mozilla/dom/Event.h"
#include "mozilla/dom/EventTarget.h"
#include "mozilla/dom/EventTargetBinding.h"
+#include "mozilla/dom/ConstructibleEventTarget.h"
+#include "nsIGlobalObject.h"
#include "nsThreadUtils.h"
namespace mozilla {
namespace dom {
+/* static */
+already_AddRefed<EventTarget>
+EventTarget::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
+{
+ nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
+ if (!global) {
+ aRv.Throw(NS_ERROR_UNEXPECTED);
+ return nullptr;
+ }
+ RefPtr<EventTarget> target = new ConstructibleEventTarget(global);
+ return target.forget();
+}
+
void
EventTarget::RemoveEventListener(const nsAString& aType,
EventListener* aListener,