content/base/test/file_bug426646-2.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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 var win0 = null;
michael@0 7
michael@0 8 function soon(f) {
michael@0 9 return function() { setTimeout(f, 0); };
michael@0 10 }
michael@0 11
michael@0 12 function doe() {
michael@0 13 document.body.innerHTML = "<iframe src='about:blank'></iframe>";
michael@0 14 document.body.innerHTML += "<iframe src='about:blank'></iframe>";
michael@0 15 win0 = window.frames[0];
michael@0 16 win0.frameElement.onload = soon(doe2);
michael@0 17 win0.location.replace(url1);
michael@0 18 }
michael@0 19
michael@0 20 function doe2() {
michael@0 21 // Add some iframes/docshells. Session history should still work.
michael@0 22 var ifr1 = document.createElement("iframe");
michael@0 23 document.body.insertBefore(ifr1, document.body.firstChild);
michael@0 24 ifr1.onload = soon(doe3);
michael@0 25
michael@0 26 var ifr2 = document.createElement("iframe");
michael@0 27 document.body.insertBefore(ifr2, document.body.firstChild);
michael@0 28 ifr2.onload = soon(doe3);
michael@0 29
michael@0 30 var ifr3 = document.createElement("iframe");
michael@0 31 document.body.insertBefore(ifr3, document.body.firstChild);
michael@0 32 ifr3.onload = soon(doe3);
michael@0 33 }
michael@0 34
michael@0 35 var doe3_count = 0;
michael@0 36 function doe3() {
michael@0 37 // Wait until all three iframes have loaded about:blank before navigating
michael@0 38 // win0.
michael@0 39 doe3_count++;
michael@0 40 if (doe3_count < 3) {
michael@0 41 return;
michael@0 42 }
michael@0 43 if (doe3_count > 3) {
michael@0 44 ok(false, 'Unexpected ' + doe3_count + 'th call to doe3.');
michael@0 45 return;
michael@0 46 }
michael@0 47
michael@0 48 win0.frameElement.onload = soon(doe4);
michael@0 49 win0.location = 'data:text/html;charset=utf-8,2nd%20page';
michael@0 50 }
michael@0 51
michael@0 52 function doe4() {
michael@0 53 win0.frameElement.onload = soon(doe5);
michael@0 54 history.go(-1);
michael@0 55 }
michael@0 56
michael@0 57 function doe5() {
michael@0 58 opener.is(win0.location, url1, "History.go(-1) didn't work?");
michael@0 59 close();
michael@0 60 }
michael@0 61 </script>
michael@0 62 </head>
michael@0 63 <body onload="setTimeout(doe, 0);" onunload="opener.nextTest();">
michael@0 64 </body></html>

mercurial