Bug 1125422 - Change EventDispatcher::Dispatch to take an nsTArray instead of a nsCOMArray. r=smaug

This commit is contained in:
Kartikaya Gupta 2015-02-10 16:28:07 -05:00
parent 33e1ee03aa
commit fde7d819d1
3 changed files with 6 additions and 6 deletions

View File

@ -397,7 +397,7 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
nsIDOMEvent* aDOMEvent,
nsEventStatus* aEventStatus,
EventDispatchingCallback* aCallback,
nsCOMArray<EventTarget>* aTargets)
nsTArray<EventTarget*>* aTargets)
{
PROFILER_LABEL("EventDispatcher", "Dispatch",
js::ProfileEntry::Category::EVENTS);
@ -476,7 +476,7 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
}
#ifdef DEBUG
if (!nsContentUtils::IsSafeToRunScript()) {
if (aEvent->message != NS_EVENT_NULL && !nsContentUtils::IsSafeToRunScript()) {
nsresult rv = NS_ERROR_FAILURE;
if (target->GetContextForEventHandlers(&rv) ||
NS_FAILED(rv)) {
@ -625,7 +625,7 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
aTargets->Clear();
aTargets->SetCapacity(chain.Length());
for (uint32_t i = 0; i < chain.Length(); ++i) {
aTargets->AppendObject(chain[i].CurrentTarget()->GetTargetForDOMEvent());
aTargets->AppendElement(chain[i].CurrentTarget()->GetTargetForDOMEvent());
}
} else {
// Event target chain is created. Handle the chain.

View File

@ -255,7 +255,7 @@ public:
nsIDOMEvent* aDOMEvent = nullptr,
nsEventStatus* aEventStatus = nullptr,
EventDispatchingCallback* aCallback = nullptr,
nsCOMArray<dom::EventTarget>* aTargets = nullptr);
nsTArray<dom::EventTarget*>* aTargets = nullptr);
/**
* Dispatches an event.

View File

@ -171,11 +171,11 @@ EventListenerService::GetEventTargetChainFor(nsIDOMEventTarget* aEventTarget,
*aOutArray = nullptr;
NS_ENSURE_ARG(aEventTarget);
WidgetEvent event(true, NS_EVENT_NULL);
nsCOMArray<EventTarget> targets;
nsTArray<EventTarget*> targets;
nsresult rv = EventDispatcher::Dispatch(aEventTarget, nullptr, &event,
nullptr, nullptr, nullptr, &targets);
NS_ENSURE_SUCCESS(rv, rv);
int32_t count = targets.Count();
int32_t count = targets.Length();
if (count == 0) {
return NS_OK;
}