A number of places in JS need to drain the current thread's event queue, which cannot be done with nsIThreadManager::spinEventLoopUntil, since we need to not wait for an incoming event when attempting to process one.