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