There were a few related problems in this bug. The first and most
major was that during the message loop in WindowsHelper.c, the event
object being used might be destroyed during processing of one of the
messages, and if this happened, the previous code would go into an
infinite loop due to an incorrect termination condition. This was
probably the cause of other mysterious problems in this code seen
earlier. Fixed this and simplified the message loop to re-check the
event object after each message dispatched.
The ModalitySupport class needed to re-notify the browser's main
thread after consuming one notification, to properly unwind the stack
if multiple message loops were running on the stack. Similar code
exists in for example AbstractPlugin.doJavaObjectOp().
A couple of additional error checks were also added to the
WindowsEvent and WindowsHelper classes.
The preexisting test case in the workspace was enhanced and brought in
sync with the regression test for this bug.