Bug 1027232 - Restart b2g at each app. Wait for the homescreen to be ready

nit: No `!=` or `==`. See bonsaiden.github.io/JavaScript-Garden/#types.equality for a nice discussion there. Also unless there's a good reason, it's idiomatic in js to store the result of boolean operations in a variable if you're only going to use it in a regular old conditional block.