Thu, 15 Jan 2015 15:59:08 +0100
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=424698 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 424698</title> |
michael@0 | 8 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <script type="text/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=424698">Mozilla Bug 424698</a> |
michael@0 | 14 | <p id="display"> |
michael@0 | 15 | <input id="i1"> |
michael@0 | 16 | <input id="target"> |
michael@0 | 17 | <textarea id="i2"></textarea> |
michael@0 | 18 | <textarea id="target2"></textarea> |
michael@0 | 19 | </p> |
michael@0 | 20 | <div id="content" style="display: none"> |
michael@0 | 21 | |
michael@0 | 22 | </div> |
michael@0 | 23 | <pre id="test"> |
michael@0 | 24 | <script class="testbody" type="text/javascript"> |
michael@0 | 25 | |
michael@0 | 26 | /** Test for Bug 424698 **/ |
michael@0 | 27 | var i = $("i1"); |
michael@0 | 28 | is(i.value, "", "Value should be empty string"); |
michael@0 | 29 | i.defaultValue = "test"; |
michael@0 | 30 | is(i.value, "test", "Setting defaultValue should work"); |
michael@0 | 31 | i.defaultValue = "test2"; |
michael@0 | 32 | is(i.value, "test2", "Setting defaultValue multiple times should work"); |
michael@0 | 33 | |
michael@0 | 34 | // Now let's hide and reshow things |
michael@0 | 35 | i.style.display = "none"; |
michael@0 | 36 | is(i.offsetWidth, 0, "Input didn't hide?"); |
michael@0 | 37 | i.style.display = ""; |
michael@0 | 38 | isnot(i.offsetWidth, 0, "Input didn't show?"); |
michael@0 | 39 | is(i.value, "test2", "Hiding/showing should not affect value"); |
michael@0 | 40 | i.defaultValue = "test3"; |
michael@0 | 41 | is(i.value, "test3", "Setting defaultValue after hide/show should work"); |
michael@0 | 42 | |
michael@0 | 43 | // Make sure typing works ok |
michael@0 | 44 | i = $("target"); |
michael@0 | 45 | i.focus(); // Otherwise editor gets confused when we send the key events |
michael@0 | 46 | is(i.value, "", "Value should be empty string in second control"); |
michael@0 | 47 | sendString("2test2"); |
michael@0 | 48 | is(i.value, "2test2", 'We just typed the string "2test2"'); |
michael@0 | 49 | i.defaultValue = "2test3"; |
michael@0 | 50 | is(i.value, "2test2", "Setting defaultValue after typing should not work"); |
michael@0 | 51 | i.style.display = "none"; |
michael@0 | 52 | is(i.offsetWidth, 0, "Second input didn't hide?"); |
michael@0 | 53 | i.style.display = ""; |
michael@0 | 54 | isnot(i.offsetWidth, 0, "Second input didn't show?"); |
michael@0 | 55 | is(i.value, "2test2", "Hiding/showing second input should not affect value"); |
michael@0 | 56 | i.defaultValue = "2test4"; |
michael@0 | 57 | is(i.value, "2test2", "Setting defaultValue after hide/show should not work if we typed"); |
michael@0 | 58 | |
michael@0 | 59 | i = $("i2"); |
michael@0 | 60 | is(i.value, "", "Textarea value should be empty string"); |
michael@0 | 61 | i.defaultValue = "test"; |
michael@0 | 62 | is(i.value, "test", "Setting textarea defaultValue should work"); |
michael@0 | 63 | i.defaultValue = "test2"; |
michael@0 | 64 | is(i.value, "test2", "Setting textarea defaultValue multiple times should work"); |
michael@0 | 65 | |
michael@0 | 66 | // Now let's hide and reshow things |
michael@0 | 67 | i.style.display = "none"; |
michael@0 | 68 | is(i.offsetWidth, 0, "Textarea didn't hide?"); |
michael@0 | 69 | i.style.display = ""; |
michael@0 | 70 | isnot(i.offsetWidth, 0, "Textarea didn't show?"); |
michael@0 | 71 | is(i.value, "test2", "Hiding/showing textarea should not affect value"); |
michael@0 | 72 | i.defaultValue = "test3"; |
michael@0 | 73 | is(i.value, "test3", "Setting textarea defaultValue after hide/show should work"); |
michael@0 | 74 | |
michael@0 | 75 | // Make sure typing works ok |
michael@0 | 76 | i = $("target2"); |
michael@0 | 77 | i.focus(); // Otherwise editor gets confused when we send the key events |
michael@0 | 78 | is(i.value, "", "Textarea value should be empty string in second control"); |
michael@0 | 79 | sendString("2test2"); |
michael@0 | 80 | is(i.value, "2test2", 'We just typed the string "2test2"'); |
michael@0 | 81 | i.defaultValue = "2test3"; |
michael@0 | 82 | is(i.value, "2test2", "Setting textarea defaultValue after typing should not work"); |
michael@0 | 83 | i.style.display = "none"; |
michael@0 | 84 | is(i.offsetWidth, 0, "Second textarea didn't hide?"); |
michael@0 | 85 | i.style.display = ""; |
michael@0 | 86 | isnot(i.offsetWidth, 0, "Second textarea didn't show?"); |
michael@0 | 87 | is(i.value, "2test2", "Hiding/showing second textarea should not affect value"); |
michael@0 | 88 | i.defaultValue = "2test4"; |
michael@0 | 89 | is(i.value, "2test2", "Setting textarea defaultValue after hide/show should not work if we typed"); |
michael@0 | 90 | </script> |
michael@0 | 91 | </pre> |
michael@0 | 92 | </body> |
michael@0 | 93 | </html> |
michael@0 | 94 |