test_bug580069.html (2028B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=580069 5 --> 6 <head> 7 <title>Test for Bug 580069</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script src="/tests/SimpleTest/EventUtils.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=580069">Mozilla Bug 580069</a> 14 15 <script type="application/javascript"> 16 17 add_task(async function() { 18 let iframe = document.createElement("iframe"); 19 iframe.setAttribute("src", "file_bug580069_1.html"); 20 21 // Insert the initial <iframe> document, and wait for page1Load to be called 22 // after it loads. 23 document.body.appendChild(iframe); 24 await new Promise(resolve => { 25 window.page1Load = resolve; 26 }); 27 let iframeCw = iframe.contentWindow; 28 29 info("iframe's location is: " + iframeCw.location + "\n"); 30 31 // Submit the forum and wait for the initial page load using a POST load. 32 iframeCw.document.getElementById("form").submit(); 33 let method1 = await new Promise(resolve => { 34 window.page2Load = resolve; 35 }); 36 info("iframe's location is: " + iframeCw.location + ", method is " + method1 + "\n"); 37 is(method1, "POST", "Method for first load should be POST."); 38 39 // Push a new state, and refresh the page. This refresh shouldn't pop up the 40 // "are you sure you want to refresh a page with POST data?" dialog. If it 41 // does, this test will hang and fail, and we'll see 'Refreshing iframe...' at 42 // the end of the test log. 43 iframeCw.history.replaceState("", "", "?replaced"); 44 45 info("Refreshing iframe...\n"); 46 iframeCw.location.reload(); 47 let method2 = await new Promise(resolve => { 48 window.page2Load = resolve; 49 }); 50 51 info("iframe's location is: " + iframeCw.location + ", method is " + method2 + "\n"); 52 is(method2, "GET", "Method for second load should be GET."); 53 is(iframeCw.location.search, "?replaced", "Wrong search on iframe after refresh."); 54 }); 55 </script> 56 57 </body> 58 </html>