When you load to iframe not HTML but XML page with XSLT transformation, you'll get incorrect document.location value. JavaScript in the iframe shows location of the parent window.
Created attachment 20272 [details] Simple testcase Open index.html from the archive.
Created attachment 20273 [details] Screenshot
Created attachment 20318 [details] proposed fix
Comment on attachment 20318 [details] proposed fix r=me
Committed revision 31947.