content/html/content/test/test_bug618948.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.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=618948
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 618948</title>
michael@0 8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
michael@0 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 11 </head>
michael@0 12 <body>
michael@0 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=618948">Mozilla Bug 618948</a>
michael@0 14 <p id="display"></p>
michael@0 15 <div id="content">
michael@0 16 <form>
michael@0 17 <input type='email' id='i'>
michael@0 18 <button>submit</button>
michael@0 19 </form>
michael@0 20 </div>
michael@0 21 <pre id="test">
michael@0 22 <script type="application/javascript">
michael@0 23
michael@0 24 /** Test for Bug 618948 **/
michael@0 25
michael@0 26 var events = ["focus", "input", "change", "invalid" ];
michael@0 27
michael@0 28 var handled = ({});
michael@0 29
michael@0 30 function eventHandler(event)
michael@0 31 {
michael@0 32 dump("\n" + event.type + "\n");
michael@0 33 handled[event.type] = true;
michael@0 34 }
michael@0 35
michael@0 36 function beginTest()
michael@0 37 {
michael@0 38 for (var e of events) {
michael@0 39 handled[e] = false;
michael@0 40 }
michael@0 41
michael@0 42 i.focus();
michael@0 43 }
michael@0 44
michael@0 45 function endTest()
michael@0 46 {
michael@0 47 for (var e of events) {
michael@0 48 ok(handled[e], "on" + e + " should have been called");
michael@0 49 }
michael@0 50
michael@0 51 SimpleTest.finish();
michael@0 52 }
michael@0 53
michael@0 54 var i = document.getElementsByTagName('input')[0];
michael@0 55 var b = document.getElementsByTagName('button')[0];
michael@0 56
michael@0 57 i.onfocus = function(event) {
michael@0 58 eventHandler(event);
michael@0 59 synthesizeKey('f', {});
michael@0 60 i.onfocus = null;
michael@0 61 };
michael@0 62
michael@0 63 i.oninput = function(event) {
michael@0 64 eventHandler(event);
michael@0 65 b.focus();
michael@0 66 i.oninput = null;
michael@0 67 };
michael@0 68
michael@0 69 i.onchange = function(event) {
michael@0 70 eventHandler(event);
michael@0 71 i.onchange = null;
michael@0 72 synthesizeMouseAtCenter(b, {});
michael@0 73 };
michael@0 74
michael@0 75 i.oninvalid = function(event) {
michael@0 76 eventHandler(event);
michael@0 77 i.oninvalid = null;
michael@0 78 endTest();
michael@0 79 };
michael@0 80
michael@0 81 SimpleTest.waitForExplicitFinish();
michael@0 82
michael@0 83 SimpleTest.waitForFocus(beginTest);
michael@0 84
michael@0 85 </script>
michael@0 86 </pre>
michael@0 87 </body>
michael@0 88 </html>

mercurial