file_sessionhistory_iframe_removal.html (1508B)
1 <html> 2 <head> 3 <script> 4 async function wait() { 5 return opener.SpecialPowers.spawnChrome([], function() { /*dummy */ }); 6 } 7 async function run() { 8 var counter = 0; 9 while(true) { 10 // Push new history entries until we hit the limit and start removing 11 // entries from the front. 12 var len = history.length; 13 document.getElementById("ifr1").contentWindow.history.pushState(++counter, null, null); 14 await wait(); 15 if (len == history.length) { 16 opener.ok(true, "Found max length " + len); 17 document.getElementById("ifr2").contentWindow.history.pushState(++counter, null, null); 18 await wait(); 19 document.getElementById("ifr1").contentWindow.history.pushState(++counter, null, null); 20 await wait(); 21 opener.is(len, history.length, "Adding session history entries in different iframe should behave the same way"); 22 // This should remove all the history entries for ifr1, leaving just 23 // the ones for ifr2. 24 document.getElementById("ifr1").remove(); 25 opener.is(history.length, 2, "Should have entries for the initial load and the pushState for ifr2"); 26 opener.finishTest(); 27 break; 28 } 29 } 30 } 31 </script> 32 </head> 33 <body onload="setTimeout(run)"> 34 <iframe src="blank.html" id="ifr1"></iframe> 35 <iframe src="blank.html" id="ifr2"></iframe> 36 </body> 37 </html>