1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/docshell/test/test_bug580069.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,63 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=580069 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 580069</title> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.14 +</head> 1.15 +<body> 1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=580069">Mozilla Bug 580069</a> 1.17 + 1.18 +<iframe id='iframe' src='file_bug580069_1.html'></iframe> 1.19 + 1.20 +<script type="application/javascript"> 1.21 + 1.22 +SimpleTest.expectAssertions(1); 1.23 + 1.24 +SimpleTest.waitForExplicitFinish(); 1.25 + 1.26 +var iframe = document.getElementById('iframe'); 1.27 +var iframeCw = iframe.contentWindow; 1.28 + 1.29 +// Called when file_bug580069_1.html loads. 1.30 +function page1Load() { 1.31 + // This should cause us to load file 2. 1.32 + dump('page1Load\n'); 1.33 + iframeCw.document.getElementById('form').submit(); 1.34 +} 1.35 + 1.36 +// Called when file_bug580069_2.html loads. 1.37 +var page2Loads = 0; 1.38 +function page2Load(method) { 1.39 + 1.40 + dump("iframe's location is: " + iframeCw.location + ", method is " + method + "\n"); 1.41 + 1.42 + if (page2Loads == 0) { 1.43 + is(method, "POST", "Method for first load should be POST."); 1.44 + iframeCw.history.replaceState('', '', '?replaced'); 1.45 + 1.46 + // This refresh shouldn't pop up the "are you sure you want to refresh a page 1.47 + // with POST data?" dialog. If it does, this test will hang and fail, and 1.48 + // we'll see 'Refreshing iframe...' at the end of the test log. 1.49 + dump('Refreshing iframe...\n'); 1.50 + iframeCw.location.reload(); 1.51 + } 1.52 + else if (page2Loads == 1) { 1.53 + is(method, "GET", "Method for second load should be GET."); 1.54 + is(iframeCw.location.search, "?replaced", "Wrong search on iframe after refresh."); 1.55 + SimpleTest.finish(); 1.56 + } 1.57 + else { 1.58 + ok(false, "page2Load should only be called twice."); 1.59 + } 1.60 + 1.61 + page2Loads++; 1.62 +} 1.63 +</script> 1.64 + 1.65 +</body> 1.66 +</html>