|
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 type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <script type="application/javascript" 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 <iframe id='iframe' src='file_bug580069_1.html'></iframe> |
|
16 |
|
17 <script type="application/javascript"> |
|
18 |
|
19 SimpleTest.expectAssertions(1); |
|
20 |
|
21 SimpleTest.waitForExplicitFinish(); |
|
22 |
|
23 var iframe = document.getElementById('iframe'); |
|
24 var iframeCw = iframe.contentWindow; |
|
25 |
|
26 // Called when file_bug580069_1.html loads. |
|
27 function page1Load() { |
|
28 // This should cause us to load file 2. |
|
29 dump('page1Load\n'); |
|
30 iframeCw.document.getElementById('form').submit(); |
|
31 } |
|
32 |
|
33 // Called when file_bug580069_2.html loads. |
|
34 var page2Loads = 0; |
|
35 function page2Load(method) { |
|
36 |
|
37 dump("iframe's location is: " + iframeCw.location + ", method is " + method + "\n"); |
|
38 |
|
39 if (page2Loads == 0) { |
|
40 is(method, "POST", "Method for first load should be POST."); |
|
41 iframeCw.history.replaceState('', '', '?replaced'); |
|
42 |
|
43 // This refresh shouldn't pop up the "are you sure you want to refresh a page |
|
44 // with POST data?" dialog. If it does, this test will hang and fail, and |
|
45 // we'll see 'Refreshing iframe...' at the end of the test log. |
|
46 dump('Refreshing iframe...\n'); |
|
47 iframeCw.location.reload(); |
|
48 } |
|
49 else if (page2Loads == 1) { |
|
50 is(method, "GET", "Method for second load should be GET."); |
|
51 is(iframeCw.location.search, "?replaced", "Wrong search on iframe after refresh."); |
|
52 SimpleTest.finish(); |
|
53 } |
|
54 else { |
|
55 ok(false, "page2Load should only be called twice."); |
|
56 } |
|
57 |
|
58 page2Loads++; |
|
59 } |
|
60 </script> |
|
61 |
|
62 </body> |
|
63 </html> |