tor-browser

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

test_bug567938-2.html (1823B)


      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  element.onclick = function() { form.submit(); element.type='text'; };
     43  form.action = gTestData[gCurrentTest];
     44  form.appendChild(element);
     45 
     46  sendMouseEvent({type: 'click'}, 'i');
     47 }
     48 
     49 function runTests()
     50 {
     51  document.getElementById('iframe').addEventListener('load', function(aEvent) {
     52    is(frames.submit_frame.location.href,
     53       `${location.origin}/tests/dom/html/test/${gTestData[gCurrentTest]}?`,
     54       "The form should have been submitted");
     55    gCurrentTest++;
     56    if (gCurrentTest < gTestData.length) {
     57      initializeNextTest();
     58    } else {
     59      aEvent.target.removeEventListener('load', arguments.callee);
     60      SimpleTest.finish();
     61    }
     62    });
     63 
     64  initializeNextTest();
     65 }
     66 
     67 </script>
     68 </pre>
     69 </body>
     70 </html>