Fix frame switching after frame redirect/creation

This fixes #967 and also resolves #1001.

This has been tested initially on [this sandbox](http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe) and then on [r/videos](http://www.reddit.com/r/videos) (you may need RES enabled).
Perhaps move this down to a separate `DOMContentLoaded` listener, beside line 1066; just to make the symmetry with `unregisterFrame` obvious.