test_bug567938-2.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=567938
  5. -->
  6. <head>
  7. <title>Test for Bug 567938</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=567938">Mozilla Bug 567938</a>
  14. <p id="display"></p>
  15. <iframe id='iframe' name="submit_frame" style="visibility: hidden;"></iframe>
  16. <div id="content" style="display: none">
  17. <form id='f' method='get' target='submit_frame'>
  18. </form>
  19. </div>
  20. <pre id="test">
  21. <script type="application/javascript">
  22. /** Test for Bug 567938 **/
  23. SimpleTest.waitForExplicitFinish();
  24. addLoadEvent(runTests);
  25. var gTestData = ["submit", "image"];
  26. var gCurrentTest = 0;
  27. function initializeNextTest()
  28. {
  29. var form = document.forms[0];
  30. // Cleaning-up.
  31. form.textContent = "";
  32. // Add the new element.
  33. var element = document.createElement("input");
  34. element.id = 'i';
  35. element.type = gTestData[gCurrentTest];
  36. element.onclick = function() { form.submit(); element.type='text'; };
  37. form.action = gTestData[gCurrentTest];
  38. form.appendChild(element);
  39. sendMouseEvent({type: 'click'}, 'i');
  40. }
  41. function runTests()
  42. {
  43. document.getElementById('iframe').addEventListener('load', function(aEvent) {
  44. is(frames['submit_frame'].location.href,
  45. "http://mochi.test:8888/tests/dom/html/test/" + gTestData[gCurrentTest],
  46. "The form should have been submitted");
  47. gCurrentTest++;
  48. if (gCurrentTest < gTestData.length) {
  49. initializeNextTest();
  50. } else {
  51. aEvent.target.removeEventListener('load', arguments.callee, false);
  52. SimpleTest.finish();
  53. }
  54. }, false);
  55. initializeNextTest();
  56. }
  57. </script>
  58. </pre>
  59. </body>
  60. </html>