tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug567938-3.html (1891B)


      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 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=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 
     23 /** Test for Bug 567938 */
     24 
     25 SimpleTest.waitForExplicitFinish();
     26 addLoadEvent(runTests);
     27 
     28 var gTestData = ["submit", "image"];
     29 var gCurrentTest = 0;
     30 
     31 function initializeNextTest()
     32 {
     33  var form = document.forms[0];
     34 
     35  // Cleaning-up.
     36  form.textContent = "";
     37 
     38  // Add the new element.
     39  var element = document.createElement("input");
     40  element.id = 'i';
     41  element.type = gTestData[gCurrentTest];
     42  // eslint-disable-next-line no-implied-eval
     43  element.onclick = function() { setTimeout("document.forms[0].submit();",0); return false; };
     44  form.appendChild(element);
     45  form.action = gTestData[gCurrentTest];
     46 
     47  sendMouseEvent({type: 'click'}, 'i');
     48 }
     49 
     50 function runTests()
     51 {
     52  document.getElementById('iframe').addEventListener('load', function(aEvent) {
     53    is(frames.submit_frame.location.href,
     54      `${location.origin}/tests/dom/html/test/${gTestData[gCurrentTest]}?`,
     55       "The form should have been submitted");
     56    gCurrentTest++;
     57    if (gCurrentTest < gTestData.length) {
     58      initializeNextTest();
     59    } else {
     60      aEvent.target.removeEventListener('load', arguments.callee);
     61      SimpleTest.finish();
     62    }
     63    });
     64 
     65  initializeNextTest();
     66 }
     67 
     68 </script>
     69 </pre>
     70 </body>
     71 </html>