test_srcdoc-2.html (1554B)
1 <!doctype html> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=802895 5 --> 6 <head> 7 <title>Test session history for srcdoc iframes introduced in bug 802895</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 10 <link rel="stylesheet" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=802895">Mozilla Bug 802895</a> 14 15 <iframe id="pframe" name="pframe" src="file_srcdoc-2.html"></iframe> 16 <pre id="test"> 17 <script> 18 19 SimpleTest.waitForExplicitFinish(); 20 var pframe = $("pframe"); 21 22 //disable bfcache 23 pframe.contentWindow.addEventListener("unload", function () { }); 24 25 var loadState = 0; 26 pframe.onload = function () { 27 SimpleTest.executeSoon(function () { 28 29 var pDoc = pframe.contentDocument; 30 31 if (loadState == 0) { 32 var div = pDoc.createElement("div"); 33 div.id = "modifyCheck"; 34 div.innerHTML = "hello again"; 35 pDoc.body.appendChild(div); 36 ok(pDoc.getElementById("modifyCheck"), "Child element not created"); 37 pframe.src = "about:blank"; 38 loadState = 1; 39 } 40 else if (loadState == 1) { 41 loadState = 2; 42 window.history.back(); 43 } 44 else if (loadState == 2) { 45 ok(!pDoc.getElementById("modifyCheck"), "modifyCheck element shouldn't be present"); 46 is(pDoc.getElementById("iframe").contentDocument.body.innerHTML, 47 "Hello World", "srcdoc iframe not present"); 48 SimpleTest.finish(); 49 } 50 51 }) 52 }; 53 54 </script> 55 </pre> 56 </body> 57 </html>