yet another JS race condition fix

this should greatly reduce the number of timeouts seen in the JS tests

I've been beating my head against this most of this week, the culprit seems to
have been the fact that Casper can end up "clicking" the interrupt kernel menu
item *before* the execution even starts. Extra credit to @takluyver who put up
with many expletives I shouted out while trying to get to the bottom of this.