Bug 839103 - part 2 - enable chrome dispatching of nsIDOMEvents in nsAsyncDOMEvent; r=bz

This commit is contained in:
Nathan Froyd 2013-03-27 14:15:58 -04:00
Родитель 03b09e99e0
Коммит 424fb29697
1 изменённых файлов: 20 добавлений и 4 удалений

Просмотреть файл

@ -24,10 +24,26 @@ nsAsyncDOMEvent::nsAsyncDOMEvent(nsINode *aEventNode, nsEvent &aEvent)
NS_IMETHODIMP nsAsyncDOMEvent::Run()
{
if (mEvent) {
NS_ASSERTION(!mDispatchChromeOnly, "Can't do that");
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mEventNode);
bool defaultActionEnabled; // This is not used because the caller is async
target->DispatchEvent(mEvent, &defaultActionEnabled);
if (mDispatchChromeOnly) {
MOZ_ASSERT(mEvent->InternalDOMEvent()->IsTrusted());
nsCOMPtr<nsIDocument> ownerDoc = mEventNode->OwnerDoc();
nsPIDOMWindow* window = ownerDoc->GetWindow();
if (!window) {
return NS_ERROR_INVALID_ARG;
}
nsCOMPtr<nsIDOMEventTarget> target = window->GetParentTarget();
if (!target) {
return NS_ERROR_INVALID_ARG;
}
nsEventDispatcher::DispatchDOMEvent(target, nullptr, mEvent,
nullptr, nullptr);
} else {
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mEventNode);
bool defaultActionEnabled; // This is not used because the caller is async
target->DispatchEvent(mEvent, &defaultActionEnabled);
}
} else {
nsIDocument* doc = mEventNode->OwnerDoc();
if (mDispatchChromeOnly) {