mirror of
https://github.com/ManchildProductions/UXP-Fixed.git
synced 2026-07-21 03:48:43 +00:00
Issue #1792 - Part 4: Implement constructors for the EventTarget interface.
This commit is contained in:
@@ -293,7 +293,6 @@ DOMInterfaces = {
|
||||
# We can also get rid of the UnwrapArg bits in
|
||||
# the dom QueryInterface (in BindingUtils.cpp) at that point.
|
||||
'hasXPConnectImpls': True,
|
||||
'concrete': False,
|
||||
'jsImplParent': 'mozilla::DOMEventTargetHelper',
|
||||
'implicitJSContext': [ 'dispatchEvent' ]
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -42,6 +42,8 @@ public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_EVENTTARGET_IID)
|
||||
|
||||
// WebIDL API
|
||||
static already_AddRefed<EventTarget> Constructor(const GlobalObject& aGlobal,
|
||||
ErrorResult& aRv);
|
||||
using nsIDOMEventTarget::AddEventListener;
|
||||
using nsIDOMEventTarget::RemoveEventListener;
|
||||
using nsIDOMEventTarget::DispatchEvent;
|
||||
|
||||
@@ -23,7 +23,8 @@ dictionary AddEventListenerOptions : EventListenerOptions {
|
||||
boolean once = false;
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker,WorkerDebugger,System)]
|
||||
[Constructor,
|
||||
Exposed=(Window,Worker,WorkerDebugger,System)]
|
||||
interface EventTarget {
|
||||
/* Passing null for wantsUntrusted means "default behavior", which
|
||||
differs in content and chrome. In content that default boolean
|
||||
|
||||
Reference in New Issue
Block a user