content/html/content/test/test_bug388558.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=388558
     5 -->
     6 <head>
     7   <title>Test for Bug 388558</title>
     8   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    10 </head>
    11 <body>
    12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=388558">Mozilla Bug 388558</a>
    13 <p id="display"></p>
    14 <div id="content">
    15   <input type="text" id="input" onchange="++inputChange;">
    16   <textarea id="textarea" onchange="++textareaChange;"></textarea>
    17 </div>
    18 <pre id="test">
    19 <script class="testbody" type="text/javascript">
    21 /** Test for Bug 388558 **/
    22 var inputChange = 0;
    23 var textareaChange = 0;
    25 function testUserInput() {
    26   var input = document.getElementById("input");
    27   var textarea = SpecialPowers.wrap(document.getElementById("textarea"));
    29   input.focus();
    30   SpecialPowers.wrap(input).setUserInput("foo");
    31   input.blur();
    32   is(inputChange, 1, "Input element should have got one change event.");
    34   input.focus();
    35   input.value = "bar";
    36   input.blur();
    37   is(inputChange, 1,
    38      "Change event dispatched when setting the value of the input element");
    40   input.value = "";
    41   is(inputChange, 1, 
    42      "Change event dispatched when setting the value of the input element (2).");
    44   SpecialPowers.wrap(input).setUserInput("foo");
    45   is(inputChange, 1,
    46      "Change event dispatched when input element doesn't have focus.");
    48   textarea.focus();
    49   textarea.setUserInput("foo");
    50   textarea.blur();
    51   is(textareaChange, 1, "Textarea element should have got one change event.");
    53   textarea.focus();
    54   textarea.value = "bar";
    55   textarea.blur();
    56   is(textareaChange, 1,
    57      "Change event dispatched when setting the value of the textarea element.");
    59   textarea.value = "";
    60   is(textareaChange, 1,
    61      "Change event dispatched when setting the value of the textarea element (2).");
    63   textarea.setUserInput("foo");
    64   is(textareaChange, 1,
    65      "Change event dispatched when textarea element doesn't have focus.");
    66 }
    68 SimpleTest.waitForExplicitFinish();
    69 addLoadEvent(testUserInput);
    70 addLoadEvent(SimpleTest.finish);
    72 </script>
    73 </pre>
    74 </body>
    75 </html>

mercurial