Bug 1028843 - Improve wait for b2g to be resistant to JavaScript exceptions

Oops, I fixed this in my ipython script but not in my patch! Thanks.