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).
See my other comment re. the representation of `frames`.  This would be super simple and super concise if it could be expressed as a list comprehension.