зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1449631 part 9. Remove nsIDOMEventTarget::AddEventListener. r=smaug
Also switch the XPCOM-y version of EventTarget::AddEventListner to a Nullable<bool> for aWantsUntrusted. The three-arg overload of AddEventListener in ContentFrameMessageManager was never called, so all the AddEventListener overloads there are not needed. MozReview-Commit-ID: 4IhqHmPVWzE
This commit is contained in:
Родитель
14f26fccf6
Коммит
88937275cc
|
@ -192,7 +192,7 @@ RootAccessible::AddEventListeners()
|
|||
* const* e_end = ArrayEnd(kEventTypes);
|
||||
e < e_end; ++e) {
|
||||
nsresult rv = nstarget->AddEventListener(NS_ConvertASCIItoUTF16(*e),
|
||||
this, true, true, 2);
|
||||
this, true, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,26 +49,6 @@ public:
|
|||
GetSystemBindingNames(aCx, thisObj, aNames, aEnumerableOnly, aRv);
|
||||
}
|
||||
|
||||
nsresult AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture)
|
||||
{
|
||||
// By default add listeners only for trusted events!
|
||||
return DOMEventTargetHelper::AddEventListener(aType, aListener,
|
||||
aUseCapture, false, 2);
|
||||
}
|
||||
using DOMEventTargetHelper::AddEventListener;
|
||||
NS_IMETHOD AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture, bool aWantsUntrusted,
|
||||
uint8_t optional_argc) override
|
||||
{
|
||||
return DOMEventTargetHelper::AddEventListener(aType, aListener,
|
||||
aUseCapture,
|
||||
aWantsUntrusted,
|
||||
optional_argc);
|
||||
}
|
||||
|
||||
virtual already_AddRefed<nsPIDOMWindowOuter> GetContent(ErrorResult& aError) = 0;
|
||||
virtual already_AddRefed<nsIDocShell> GetDocShell(ErrorResult& aError) = 0;
|
||||
virtual already_AddRefed<nsIEventTarget> GetTabEventTarget() = 0;
|
||||
|
|
|
@ -4497,25 +4497,27 @@ nsGlobalWindowInner::DispatchEvent(Event& aEvent,
|
|||
return retval;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
bool
|
||||
nsGlobalWindowInner::ComputeWantsUntrusted(const Nullable<bool>& aWantsUntrusted)
|
||||
{
|
||||
if (!aWantsUntrusted.IsNull()) {
|
||||
return aWantsUntrusted.Value();
|
||||
}
|
||||
|
||||
return !nsContentUtils::IsChromeDoc(mDoc);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGlobalWindowInner::AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener *aListener,
|
||||
bool aUseCapture, bool aWantsUntrusted,
|
||||
uint8_t aOptionalArgc)
|
||||
bool aUseCapture,
|
||||
const Nullable<bool>& aWantsUntrusted)
|
||||
{
|
||||
NS_ASSERTION(!aWantsUntrusted || aOptionalArgc > 1,
|
||||
"Won't check if this is chrome, you want to set "
|
||||
"aWantsUntrusted to false or make the aWantsUntrusted "
|
||||
"explicit by making optional_argc non-zero.");
|
||||
|
||||
if (!aWantsUntrusted &&
|
||||
(aOptionalArgc < 2 && !nsContentUtils::IsChromeDoc(mDoc))) {
|
||||
aWantsUntrusted = true;
|
||||
}
|
||||
bool wantsUntrusted = ComputeWantsUntrusted(aWantsUntrusted);
|
||||
|
||||
EventListenerManager* manager = GetOrCreateListenerManager();
|
||||
NS_ENSURE_STATE(manager);
|
||||
manager->AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted);
|
||||
manager->AddEventListener(aType, aListener, aUseCapture, wantsUntrusted);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -4526,12 +4528,7 @@ nsGlobalWindowInner::AddEventListener(const nsAString& aType,
|
|||
const Nullable<bool>& aWantsUntrusted,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
bool wantsUntrusted;
|
||||
if (aWantsUntrusted.IsNull()) {
|
||||
wantsUntrusted = !nsContentUtils::IsChromeDoc(mDoc);
|
||||
} else {
|
||||
wantsUntrusted = aWantsUntrusted.Value();
|
||||
}
|
||||
bool wantsUntrusted = ComputeWantsUntrusted(aWantsUntrusted);
|
||||
|
||||
EventListenerManager* manager = GetOrCreateListenerManager();
|
||||
if (!manager) {
|
||||
|
|
|
@ -324,11 +324,20 @@ public:
|
|||
virtual mozilla::EventListenerManager*
|
||||
GetOrCreateListenerManager() override;
|
||||
|
||||
using mozilla::dom::EventTarget::AddEventListener;
|
||||
virtual void AddEventListener(const nsAString& aType,
|
||||
mozilla::dom::EventListener* aListener,
|
||||
const mozilla::dom::AddEventListenerOptionsOrBoolean& aOptions,
|
||||
const mozilla::dom::Nullable<bool>& aWantsUntrusted,
|
||||
mozilla::ErrorResult& aRv) override;
|
||||
virtual nsresult AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
const Nullable<bool>& aWantsUntrusted) override;
|
||||
/**
|
||||
* A helper to determine the wantsUntrusted value from the given Nullable<bool>.
|
||||
*/
|
||||
bool ComputeWantsUntrusted(const Nullable<bool>& aWantsUntrusted);
|
||||
virtual nsPIDOMWindowOuter* GetOwnerGlobalForBindings() override;
|
||||
|
||||
virtual nsIGlobalObject* GetOwnerGlobal() const override;
|
||||
|
|
|
@ -6466,14 +6466,14 @@ nsGlobalWindowOuter::DispatchEvent(Event& aEvent,
|
|||
FORWARD_TO_INNER(DispatchEvent, (aEvent, aCallerType, aRv), false);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsGlobalWindowOuter::AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener *aListener,
|
||||
bool aUseCapture, bool aWantsUntrusted,
|
||||
uint8_t aOptionalArgc)
|
||||
bool aUseCapture,
|
||||
const Nullable<bool>& aWantsUntrusted)
|
||||
{
|
||||
FORWARD_TO_INNER_CREATE(AddEventListener,
|
||||
(aType, aListener, aUseCapture, aWantsUntrusted, aOptionalArgc),
|
||||
(aType, aListener, aUseCapture, aWantsUntrusted),
|
||||
NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
|
||||
|
|
|
@ -281,11 +281,16 @@ public:
|
|||
virtual mozilla::EventListenerManager*
|
||||
GetOrCreateListenerManager() override;
|
||||
|
||||
using mozilla::dom::EventTarget::AddEventListener;
|
||||
virtual void AddEventListener(const nsAString& aType,
|
||||
mozilla::dom::EventListener* aListener,
|
||||
const mozilla::dom::AddEventListenerOptionsOrBoolean& aOptions,
|
||||
const mozilla::dom::Nullable<bool>& aWantsUntrusted,
|
||||
mozilla::ErrorResult& aRv) override;
|
||||
virtual nsresult AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
const Nullable<bool>& aWantsUntrusted) override;
|
||||
virtual nsPIDOMWindowOuter* GetOwnerGlobalForBindings() override;
|
||||
|
||||
virtual nsIGlobalObject* GetOwnerGlobal() const override;
|
||||
|
|
|
@ -1016,28 +1016,28 @@ nsINode::LookupNamespaceURI(const nsAString& aNamespacePrefix,
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
bool
|
||||
nsINode::ComputeWantsUntrusted(const Nullable<bool>& aWantsUntrusted)
|
||||
{
|
||||
if (!aWantsUntrusted.IsNull()) {
|
||||
return aWantsUntrusted.Value();
|
||||
}
|
||||
|
||||
return !nsContentUtils::IsChromeDoc(OwnerDoc());
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsINode::AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener *aListener,
|
||||
bool aUseCapture,
|
||||
bool aWantsUntrusted,
|
||||
uint8_t aOptionalArgc)
|
||||
const Nullable<bool>& aWantsUntrusted)
|
||||
{
|
||||
NS_ASSERTION(!aWantsUntrusted || aOptionalArgc > 1,
|
||||
"Won't check if this is chrome, you want to set "
|
||||
"aWantsUntrusted to false or make the aWantsUntrusted "
|
||||
"explicit by making aOptionalArgc non-zero.");
|
||||
|
||||
if (!aWantsUntrusted &&
|
||||
(aOptionalArgc < 2 &&
|
||||
!nsContentUtils::IsChromeDoc(OwnerDoc()))) {
|
||||
aWantsUntrusted = true;
|
||||
}
|
||||
bool wantsUntrusted = ComputeWantsUntrusted(aWantsUntrusted);
|
||||
|
||||
EventListenerManager* listener_manager = GetOrCreateListenerManager();
|
||||
NS_ENSURE_STATE(listener_manager);
|
||||
listener_manager->AddEventListener(aType, aListener, aUseCapture,
|
||||
aWantsUntrusted);
|
||||
wantsUntrusted);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1048,12 +1048,7 @@ nsINode::AddEventListener(const nsAString& aType,
|
|||
const Nullable<bool>& aWantsUntrusted,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
bool wantsUntrusted;
|
||||
if (aWantsUntrusted.IsNull()) {
|
||||
wantsUntrusted = !nsContentUtils::IsChromeDoc(OwnerDoc());
|
||||
} else {
|
||||
wantsUntrusted = aWantsUntrusted.Value();
|
||||
}
|
||||
bool wantsUntrusted = ComputeWantsUntrusted(aWantsUntrusted);
|
||||
|
||||
EventListenerManager* listener_manager = GetOrCreateListenerManager();
|
||||
if (!listener_manager) {
|
||||
|
|
|
@ -1029,12 +1029,20 @@ public:
|
|||
virtual mozilla::EventListenerManager*
|
||||
GetOrCreateListenerManager() override;
|
||||
|
||||
using nsIDOMEventTarget::AddEventListener;
|
||||
using mozilla::dom::EventTarget::AddEventListener;
|
||||
virtual void AddEventListener(const nsAString& aType,
|
||||
mozilla::dom::EventListener* aListener,
|
||||
const mozilla::dom::AddEventListenerOptionsOrBoolean& aOptions,
|
||||
const mozilla::dom::Nullable<bool>& aWantsUntrusted,
|
||||
mozilla::ErrorResult& aRv) override;
|
||||
virtual nsresult AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
const Nullable<bool>& aWantsUntrusted) override;
|
||||
/**
|
||||
* A helper to determine the wantsUntrusted value from the given Nullable<bool>.
|
||||
*/
|
||||
bool ComputeWantsUntrusted(const Nullable<bool>& aWantsUntrusted);
|
||||
using nsIDOMEventTarget::AddSystemEventListener;
|
||||
|
||||
virtual bool IsApzAware() const override;
|
||||
|
|
|
@ -84,20 +84,23 @@ nsWindowRoot::DispatchEvent(Event& aEvent, CallerType aCallerType,
|
|||
return retval;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
bool
|
||||
nsWindowRoot::ComputeWantsUntrusted(const Nullable<bool>& aWantsUntrusted)
|
||||
{
|
||||
return !aWantsUntrusted.IsNull() && aWantsUntrusted.Value();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsWindowRoot::AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener *aListener,
|
||||
bool aUseCapture, bool aWantsUntrusted,
|
||||
uint8_t aOptionalArgc)
|
||||
bool aUseCapture,
|
||||
const Nullable<bool>& aWantsUntrusted)
|
||||
{
|
||||
NS_ASSERTION(!aWantsUntrusted || aOptionalArgc > 1,
|
||||
"Won't check if this is chrome, you want to set "
|
||||
"aWantsUntrusted to false or make the aWantsUntrusted "
|
||||
"explicit by making optional_argc non-zero.");
|
||||
bool wantsUntrusted = ComputeWantsUntrusted(aWantsUntrusted);
|
||||
|
||||
EventListenerManager* elm = GetOrCreateListenerManager();
|
||||
NS_ENSURE_STATE(elm);
|
||||
elm->AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted);
|
||||
elm->AddEventListener(aType, aListener, aUseCapture, wantsUntrusted);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -108,7 +111,7 @@ nsWindowRoot::AddEventListener(const nsAString& aType,
|
|||
const Nullable<bool>& aWantsUntrusted,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
bool wantsUntrusted = !aWantsUntrusted.IsNull() && aWantsUntrusted.Value();
|
||||
bool wantsUntrusted = ComputeWantsUntrusted(aWantsUntrusted);
|
||||
EventListenerManager* elm = GetOrCreateListenerManager();
|
||||
if (!elm) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
|
|
|
@ -37,6 +37,14 @@ public:
|
|||
const mozilla::dom::AddEventListenerOptionsOrBoolean& aOptions,
|
||||
const mozilla::dom::Nullable<bool>& aWantsUntrusted,
|
||||
mozilla::ErrorResult& aRv) override;
|
||||
virtual nsresult AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
const Nullable<bool>& aWantsUntrusted) override;
|
||||
/**
|
||||
* A helper to determine the wantsUntrusted value from the given Nullable<bool>.
|
||||
*/
|
||||
bool ComputeWantsUntrusted(const Nullable<bool>& aWantsUntrusted);
|
||||
|
||||
bool DispatchEvent(mozilla::dom::Event& aEvent,
|
||||
mozilla::dom::CallerType aCallerType,
|
||||
|
|
|
@ -173,26 +173,38 @@ DOMEventTargetHelper::GetDocumentIfCurrent() const
|
|||
return win->GetDoc();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
bool
|
||||
DOMEventTargetHelper::ComputeWantsUntrusted(const Nullable<bool>& aWantsUntrusted,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if (!aWantsUntrusted.IsNull()) {
|
||||
return aWantsUntrusted.Value();
|
||||
}
|
||||
|
||||
bool wantsUntrusted;
|
||||
nsresult rv = WantsUntrusted(&wantsUntrusted);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return false;
|
||||
}
|
||||
return wantsUntrusted;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DOMEventTargetHelper::AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
bool aWantsUntrusted,
|
||||
uint8_t aOptionalArgc)
|
||||
const Nullable<bool>& aWantsUntrusted)
|
||||
{
|
||||
NS_ASSERTION(!aWantsUntrusted || aOptionalArgc > 1,
|
||||
"Won't check if this is chrome, you want to set "
|
||||
"aWantsUntrusted to false or make the aWantsUntrusted "
|
||||
"explicit by making aOptionalArgc non-zero.");
|
||||
|
||||
if (aOptionalArgc < 2) {
|
||||
nsresult rv = WantsUntrusted(&aWantsUntrusted);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
ErrorResult rv;
|
||||
bool wantsUntrusted = ComputeWantsUntrusted(aWantsUntrusted, rv);
|
||||
if (rv.Failed()) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
EventListenerManager* elm = GetOrCreateListenerManager();
|
||||
NS_ENSURE_STATE(elm);
|
||||
elm->AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted);
|
||||
elm->AddEventListener(aType, aListener, aUseCapture, wantsUntrusted);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -203,15 +215,9 @@ DOMEventTargetHelper::AddEventListener(const nsAString& aType,
|
|||
const Nullable<bool>& aWantsUntrusted,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
bool wantsUntrusted;
|
||||
if (aWantsUntrusted.IsNull()) {
|
||||
nsresult rv = WantsUntrusted(&wantsUntrusted);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
wantsUntrusted = aWantsUntrusted.Value();
|
||||
bool wantsUntrusted = ComputeWantsUntrusted(aWantsUntrusted, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
EventListenerManager* elm = GetOrCreateListenerManager();
|
||||
|
|
|
@ -79,6 +79,15 @@ public:
|
|||
const dom::AddEventListenerOptionsOrBoolean& aOptions,
|
||||
const dom::Nullable<bool>& aWantsUntrusted,
|
||||
ErrorResult& aRv) override;
|
||||
virtual nsresult AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
const Nullable<bool>& aWantsUntrusted) override;
|
||||
/**
|
||||
* A helper to determine the wantsUntrusted value from the given Nullable<bool>.
|
||||
*/
|
||||
bool ComputeWantsUntrusted(const Nullable<bool>& aWantsUntrusted,
|
||||
ErrorResult& aRv);
|
||||
|
||||
using EventTarget::DispatchEvent;
|
||||
bool DispatchEvent(dom::Event& aEvent, dom::CallerType aCallerType,
|
||||
|
|
|
@ -54,7 +54,6 @@ public:
|
|||
// WebIDL API
|
||||
static already_AddRefed<EventTarget> Constructor(const GlobalObject& aGlobal,
|
||||
ErrorResult& aRv);
|
||||
using nsIDOMEventTarget::AddEventListener;
|
||||
virtual void AddEventListener(const nsAString& aType,
|
||||
EventListener* aCallback,
|
||||
const AddEventListenerOptionsOrBoolean& aOptions,
|
||||
|
@ -64,6 +63,39 @@ public:
|
|||
EventListener* aCallback,
|
||||
const EventListenerOptionsOrBoolean& aOptions,
|
||||
ErrorResult& aRv);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* This method allows addition of event listeners represented by
|
||||
* nsIDOMEventListener, with almost the same semantics as the
|
||||
* standard AddEventListener. The one difference is that it just
|
||||
* has a "use capture" boolean, not an EventListenerOptions.
|
||||
*/
|
||||
virtual nsresult AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
const Nullable<bool>& aWantsUntrusted) = 0;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Helper methods to make the nsIDOMEventListener version of
|
||||
* AddEventListener simpler to call for consumers.
|
||||
*/
|
||||
nsresult AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture)
|
||||
{
|
||||
return AddEventListener(aType, aListener, aUseCapture, Nullable<bool>());
|
||||
}
|
||||
nsresult AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
bool aWantsUntrusted)
|
||||
{
|
||||
return AddEventListener(aType, aListener, aUseCapture,
|
||||
Nullable<bool>(aWantsUntrusted));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method allows the removal of event listeners represented by
|
||||
* nsIDOMEventListener from the event target, with the same semantics as the
|
||||
|
|
|
@ -45,39 +45,6 @@ interface nsIDOMEvent;
|
|||
[uuid(9a78ac3c-9507-4d00-b2d6-10b508d2ec31)]
|
||||
interface nsIDOMEventTarget : nsISupports
|
||||
{
|
||||
/**
|
||||
* This method allows the registration of event listeners on the event target.
|
||||
* If an EventListener is added to an EventTarget while it is processing an
|
||||
* event, it will not be triggered by the current actions but may be
|
||||
* triggered during a later stage of event flow, such as the bubbling phase.
|
||||
*
|
||||
* If multiple identical EventListeners are registered on the same
|
||||
* EventTarget with the same parameters the duplicate instances are
|
||||
* discarded. They do not cause the EventListener to be called twice
|
||||
* and since they are discarded they do not need to be removed with the
|
||||
* removeEventListener method.
|
||||
*
|
||||
* @param type The event type for which the user is registering
|
||||
* @param listener The listener parameter takes an interface
|
||||
* implemented by the user which contains the methods
|
||||
* to be called when the event occurs.
|
||||
* @param useCapture If true, useCapture indicates that the user
|
||||
* wishes to initiate capture. After initiating
|
||||
* capture, all events of the specified type will be
|
||||
* dispatched to the registered EventListener before
|
||||
* being dispatched to any EventTargets beneath them
|
||||
* in the tree. Events which are bubbling upward
|
||||
* through the tree will not trigger an
|
||||
* EventListener designated to use capture.
|
||||
* @param wantsUntrusted If false, the listener will not receive any
|
||||
* untrusted events (see above), if true, the
|
||||
* listener will receive events whether or not
|
||||
* they're trusted
|
||||
*/
|
||||
[optional_argc] void addEventListener(in DOMString type,
|
||||
in nsIDOMEventListener listener,
|
||||
[optional] in boolean useCapture,
|
||||
[optional] in boolean wantsUntrusted);
|
||||
|
||||
/**
|
||||
* addSystemEventListener() adds an event listener of aType to the system
|
||||
|
@ -102,21 +69,6 @@ interface nsIDOMEventTarget : nsISupports
|
|||
[optional] in boolean aWantsUntrusted);
|
||||
|
||||
%{C++
|
||||
// non-virtual so it won't affect the vtable
|
||||
nsresult AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture)
|
||||
{
|
||||
return AddEventListener(aType, aListener, aUseCapture, false, 1);
|
||||
}
|
||||
// non-virtual so it won't affect the vtable
|
||||
nsresult AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
bool aWantsUntrusted)
|
||||
{
|
||||
return AddEventListener(aType, aListener, aUseCapture, aWantsUntrusted, 2);
|
||||
}
|
||||
// non-virtual so it won't affect the vtable
|
||||
nsresult AddSystemEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
|
|
|
@ -21,7 +21,7 @@ TelemetryScrollProbe::Create(TabChildGlobal* aWebFrame)
|
|||
nsWeakPtr webNav = do_GetWeakReference(aWebFrame->mTabChild->WebNavigation());
|
||||
RefPtr<TelemetryScrollProbe> probe = new TelemetryScrollProbe(webNav);
|
||||
|
||||
aWebFrame->AddEventListener(NS_LITERAL_STRING("pagehide"), probe, true, false, 0);
|
||||
aWebFrame->AddEventListener(NS_LITERAL_STRING("pagehide"), probe, true);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIWebNavigation>
|
||||
|
|
|
@ -180,7 +180,7 @@ NS_IMPL_ISUPPORTS(MediaDevices::GumRejecter, nsIDOMGetUserMediaErrorCallback)
|
|||
|
||||
already_AddRefed<Promise>
|
||||
MediaDevices::GetUserMedia(const MediaStreamConstraints& aConstraints,
|
||||
CallerType aCallerType,
|
||||
CallerType aCallerType,
|
||||
ErrorResult &aRv)
|
||||
{
|
||||
RefPtr<Promise> p = Promise::Create(GetParentObject(), aRv);
|
||||
|
@ -191,7 +191,7 @@ MediaDevices::GetUserMedia(const MediaStreamConstraints& aConstraints,
|
|||
|
||||
aRv = MediaManager::Get()->GetUserMedia(GetOwner(), aConstraints,
|
||||
resolver, rejecter,
|
||||
aCallerType);
|
||||
aCallerType);
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
|
@ -273,31 +273,30 @@ MediaDevices::SetOndevicechange(mozilla::dom::EventHandlerNonNull* aCallback)
|
|||
|
||||
nsresult
|
||||
MediaDevices::AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture, bool aWantsUntrusted,
|
||||
uint8_t optional_argc)
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
const Nullable<bool>& aWantsUntrusted)
|
||||
{
|
||||
MediaManager::Get()->AddDeviceChangeCallback(this);
|
||||
|
||||
return mozilla::DOMEventTargetHelper::AddEventListener(aType, aListener,
|
||||
aUseCapture,
|
||||
aWantsUntrusted,
|
||||
optional_argc);
|
||||
return DOMEventTargetHelper::AddEventListener(aType, aListener,
|
||||
aUseCapture,
|
||||
aWantsUntrusted);
|
||||
}
|
||||
|
||||
void
|
||||
MediaDevices::AddEventListener(const nsAString& aType,
|
||||
dom::EventListener* aListener,
|
||||
const dom::AddEventListenerOptionsOrBoolean& aOptions,
|
||||
const dom::Nullable<bool>& aWantsUntrusted,
|
||||
ErrorResult& aRv)
|
||||
EventListener* aListener,
|
||||
const AddEventListenerOptionsOrBoolean& aOptions,
|
||||
const Nullable<bool>& aWantsUntrusted,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
MediaManager::Get()->AddDeviceChangeCallback(this);
|
||||
|
||||
return mozilla::DOMEventTargetHelper::AddEventListener(aType, aListener,
|
||||
aOptions,
|
||||
aWantsUntrusted,
|
||||
aRv);
|
||||
return DOMEventTargetHelper::AddEventListener(aType, aListener,
|
||||
aOptions,
|
||||
aWantsUntrusted,
|
||||
aRv);
|
||||
}
|
||||
|
||||
JSObject*
|
||||
|
|
|
@ -51,15 +51,15 @@ public:
|
|||
|
||||
void SetOndevicechange(mozilla::dom::EventHandlerNonNull* aCallback);
|
||||
|
||||
NS_IMETHOD AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture, bool aWantsUntrusted,
|
||||
uint8_t optional_argc) override;
|
||||
nsresult AddEventListener(const nsAString& aType,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
const Nullable<bool>& aWantsUntrusted) override;
|
||||
|
||||
virtual void AddEventListener(const nsAString& aType,
|
||||
dom::EventListener* aListener,
|
||||
const dom::AddEventListenerOptionsOrBoolean& aOptions,
|
||||
const dom::Nullable<bool>& aWantsUntrusted,
|
||||
const AddEventListenerOptionsOrBoolean& aOptions,
|
||||
const Nullable<bool>& aWantsUntrusted,
|
||||
ErrorResult& aRv) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -461,7 +461,7 @@ public:
|
|||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
if (NS_FAILED(mXHR->AddEventListener(mEventType, this, false, false, 2))) {
|
||||
if (NS_FAILED(mXHR->AddEventListener(mEventType, this, false, false))) {
|
||||
NS_WARNING("Failed to add event listener!");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -219,9 +219,8 @@ HTMLEditor::CreateGrabber(nsIContent& aParentContent)
|
|||
}
|
||||
|
||||
// add the mouse listener so we can detect a click on a resizer
|
||||
nsCOMPtr<nsIDOMEventTarget> evtTarget = do_QueryInterface(ret);
|
||||
evtTarget->AddEventListener(NS_LITERAL_STRING("mousedown"),
|
||||
mEventListener, false);
|
||||
ret->AddEventListener(NS_LITERAL_STRING("mousedown"),
|
||||
mEventListener, false);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -359,12 +358,12 @@ HTMLEditor::GrabberClicked()
|
|||
mMouseMotionListenerP = new ResizerMouseMotionListener(*this);
|
||||
if (!mMouseMotionListenerP) {return NS_ERROR_NULL_POINTER;}
|
||||
|
||||
nsIDOMEventTarget* piTarget = GetDOMEventTarget();
|
||||
EventTarget* piTarget = GetDOMEventTarget();
|
||||
NS_ENSURE_TRUE(piTarget, NS_ERROR_FAILURE);
|
||||
|
||||
rv = piTarget->AddEventListener(NS_LITERAL_STRING("mousemove"),
|
||||
mMouseMotionListenerP,
|
||||
false, false);
|
||||
mMouseMotionListenerP,
|
||||
false, false);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),
|
||||
"failed to register mouse motion listener");
|
||||
}
|
||||
|
|
|
@ -113,9 +113,8 @@ HTMLEditor::CreateResizer(int16_t aLocation,
|
|||
}
|
||||
|
||||
// add the mouse listener so we can detect a click on a resizer
|
||||
nsCOMPtr<nsIDOMEventTarget> evtTarget = do_QueryInterface(ret);
|
||||
evtTarget->AddEventListener(NS_LITERAL_STRING("mousedown"), mEventListener,
|
||||
true);
|
||||
ret->AddEventListener(NS_LITERAL_STRING("mousedown"), mEventListener,
|
||||
true);
|
||||
|
||||
nsAutoString locationStr;
|
||||
switch (aLocation) {
|
||||
|
@ -341,7 +340,7 @@ HTMLEditor::ShowResizersInner(Element& aResizedElement)
|
|||
nsCOMPtr<nsIDocument> doc = GetDocument();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(doc->GetWindow());
|
||||
nsCOMPtr<EventTarget> target = do_QueryInterface(doc->GetWindow());
|
||||
if (!target) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
@ -508,7 +507,7 @@ HTMLEditor::StartResizing(nsIDOMElement* aHandle)
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsIDOMEventTarget* target = GetDOMEventTarget();
|
||||
EventTarget* target = GetDOMEventTarget();
|
||||
NS_ENSURE_TRUE(target, NS_ERROR_FAILURE);
|
||||
|
||||
result = target->AddEventListener(NS_LITERAL_STRING("mousemove"),
|
||||
|
|
|
@ -178,10 +178,9 @@ HTMLEditor::DoInlineTableEditingAction(const Element& aElement)
|
|||
void
|
||||
HTMLEditor::AddMouseClickListener(Element* aElement)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> evtTarget(do_QueryInterface(aElement));
|
||||
if (evtTarget) {
|
||||
evtTarget->AddEventListener(NS_LITERAL_STRING("click"),
|
||||
mEventListener, true);
|
||||
if (aElement) {
|
||||
aElement->AddEventListener(NS_LITERAL_STRING("click"),
|
||||
mEventListener, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -221,12 +221,8 @@ ScrollbarActivity::StartListeningForScrollAreaEvents()
|
|||
return;
|
||||
|
||||
nsIFrame* scrollArea = do_QueryFrame(mScrollableFrame);
|
||||
nsCOMPtr<nsIDOMEventTarget> scrollAreaTarget
|
||||
= do_QueryInterface(scrollArea->GetContent());
|
||||
if (scrollAreaTarget) {
|
||||
scrollAreaTarget->AddEventListener(NS_LITERAL_STRING("mousemove"), this,
|
||||
true);
|
||||
}
|
||||
scrollArea->GetContent()->AddEventListener(NS_LITERAL_STRING("mousemove"),
|
||||
this, true);
|
||||
mListeningForScrollAreaEvents = true;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче