content/html/content/test/test_bug567938-2.html

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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">
    23 /** Test for Bug 567938 **/
    25 SimpleTest.waitForExplicitFinish();
    26 addLoadEvent(runTests);
    28 var gTestData = ["submit", "image"];
    29 var gCurrentTest = 0;
    31 function initializeNextTest()
    32 {
    33   var form = document.forms[0];
    35   // Cleaning-up.
    36   form.textContent = "";
    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);
    46   sendMouseEvent({type: 'click'}, 'i');
    47 }
    49 function runTests()
    50 {
    51   document.getElementById('iframe').addEventListener('load', function(aEvent) {
    52     is(frames['submit_frame'].location.href,
    53        "http://mochi.test:8888/tests/content/html/content/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, false);
    60       SimpleTest.finish();
    61     }
    62     }, false);
    64   initializeNextTest();
    65 }
    67 </script>
    68 </pre>
    69 </body>
    70 </html>

mercurial