If we synchronously shut down the prompt, that will exit modal state while we're
still processing our mouse or key event, which happens _before_ Gecko runnable
processing. Exiting modal state will generally post a runnable to run timeouts,
so we can end up processing that runnable before we return from processNextEvent
and unwind to whatever code did the alert() call on the web page. The upshot is
that the webpage will see timeouts fire before the alert() call returns.
If we exit modal state off a Gecko runnable instead, that will ensure that we
return to the nsPrompter code immediately after exiting modal state, see that
the prompt is no longer active, and return to the calling web page code _before_
processing any more runnables.