Bug 916373 - Allow atomless JSEventHandlers, r=nsm

--HG--
extra : rebase_source : 6fa611eb7f078141e4bf6025c50693cfa403d757
This commit is contained in:
Olli Pettay 2013-09-14 03:22:39 +03:00
parent a54b64414e
commit 66e5b8a663
2 changed files with 7 additions and 2 deletions

View File

@ -951,7 +951,9 @@ nsEventListenerManager::HandleEventSubType(nsListenerStruct* aListenerStruct,
}
if (NS_SUCCEEDED(result)) {
nsAutoMicroTask mt;
if (mIsMainThreadELM) {
nsContentUtils::EnterMicroTask();
}
// nsIDOMEvent::currentTarget is set in nsEventDispatcher.
if (aListener.HasWebIDLCallback()) {
ErrorResult rv;
@ -961,6 +963,9 @@ nsEventListenerManager::HandleEventSubType(nsListenerStruct* aListenerStruct,
} else {
result = aListener.GetXPCOMCallback()->HandleEvent(aDOMEvent);
}
if (mIsMainThreadELM) {
nsContentUtils::LeaveMicroTask();
}
}
return result;

View File

@ -273,7 +273,7 @@ NS_NewJSEventListener(nsIScriptContext* aContext, JSObject* aScopeObject,
{
MOZ_ASSERT(aContext || aHandler.HasEventHandler(),
"Must have a handler if we don't have an nsIScriptContext");
NS_ENSURE_ARG(aEventType);
NS_ENSURE_ARG(aEventType || !NS_IsMainThread());
nsJSEventListener* it =
new nsJSEventListener(aContext, aScopeObject, aTarget, aEventType,
aHandler);