Bug 852847 - Part 4: Fix a child-process shutdown leak around nested event loops. r=smaug

This also fixes a non-shutdown leak which occurs if you remove an
<iframe mozbrowser> from the DOM while it's processing an alert().