test_bug580069.html 1.8 KB

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