зеркало из https://github.com/mozilla/gecko-dev.git
Bug 839103 - part 2 - enable chrome dispatching of nsIDOMEvents in nsAsyncDOMEvent; r=bz
This commit is contained in:
Родитель
03b09e99e0
Коммит
424fb29697
|
@ -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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче