content/base/test/file_bug426646-1.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <html><head>
michael@0 2 <title>Bug 426646, Using location.replace breaks iframe history</title>
michael@0 3 <script type="text/javascript">
michael@0 4 var url1 = "data:text/html;charset=utf-8,1st%20page";
michael@0 5
michael@0 6 function soon(f) {
michael@0 7 return function() { setTimeout(f, 0); };
michael@0 8 }
michael@0 9
michael@0 10 function doe() {
michael@0 11 document.body.innerHTML = "<iframe src='about:blank'></iframe>";
michael@0 12 document.body.innerHTML += "<iframe src='about:blank'></iframe>";
michael@0 13 window.frames[0].frameElement.onload = soon(doe2);
michael@0 14 window.frames[0].location.replace(url1);
michael@0 15 }
michael@0 16
michael@0 17 function doe2() {
michael@0 18 window.frames[0].location = 'data:text/html;charset=utf-8,2nd%20page';
michael@0 19 window.frames[0].frameElement.onload = soon(doe3);
michael@0 20 }
michael@0 21
michael@0 22 function doe3() {
michael@0 23 window.frames[0].frameElement.onload = soon(doe4);
michael@0 24 history.go(-1);
michael@0 25 }
michael@0 26
michael@0 27 function doe4() {
michael@0 28 opener.is(window.frames[0].location, url1, "History.go(-1) didn't work?");
michael@0 29 opener.is(window.frames[1].location, "about:blank",
michael@0 30 "History.go(-1) didn't work?");
michael@0 31 close();
michael@0 32 }
michael@0 33 </script>
michael@0 34 </head>
michael@0 35 <body onload="doe();" onunload="opener.nextTest();">
michael@0 36 </body></html>

mercurial