Bug 1094248 - Process remaining Promise microtasks before blocking inside a nested event loop in the main thread. r=bz

This commit is contained in:
Paolo Amadini 2014-11-06 14:00:06 +00:00
Родитель ba9efacd5d
Коммит b5b99e684e
1 изменённых файлов: 7 добавлений и 0 удалений

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

@ -1026,6 +1026,13 @@ NS_IMETHODIMP
nsXPConnect::OnProcessNextEvent(nsIThreadInternal *aThread, bool aMayWait, nsXPConnect::OnProcessNextEvent(nsIThreadInternal *aThread, bool aMayWait,
uint32_t aRecursionDepth) uint32_t aRecursionDepth)
{ {
// If ProcessNextEvent was called during a Promise "then" callback, we
// must process any pending microtasks before blocking in the event loop,
// otherwise we may deadlock until an event enters the queue later.
if (aMayWait) {
Promise::PerformMicroTaskCheckpoint();
}
// Record this event. // Record this event.
mEventDepth++; mEventDepth++;