Test case for race condition in #153

This is fairly straightforward - just call many times js callback from native code and hopefully will catch race condition.  

I tested on my home box and with 5000 iterations it was almost guaranteed to enter infinite cond_wait with test failing with timeout error. 

Any suggestions welcome, I'm not that familiar with JS testing best practices.