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=347174 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 347174</title> |
michael@0 | 8 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=347174">Mozilla Bug 347174</a> |
michael@0 | 13 | <p id="display"></p> |
michael@0 | 14 | |
michael@0 | 15 | <div id="content" style="display: none"> |
michael@0 | 16 | |
michael@0 | 17 | </div> |
michael@0 | 18 | <pre id="test"> |
michael@0 | 19 | <script class="testbody" type="text/javascript"> |
michael@0 | 20 | |
michael@0 | 21 | /** Test for Bug 347174 **/ |
michael@0 | 22 | // simple test of readyState during loading, DOMContentLoaded, and complete |
michael@0 | 23 | // this test passes in IE7 |
michael@0 | 24 | window.readyStateText = []; |
michael@0 | 25 | window.loaded = false; |
michael@0 | 26 | function attachCustomEventListener(element, eventName, command) { |
michael@0 | 27 | if (window.addEventListener && !window.opera) |
michael@0 | 28 | element.addEventListener(eventName, command, true); |
michael@0 | 29 | else if (window.attachEvent) |
michael@0 | 30 | element.attachEvent("on" + eventName, command); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | function showMessage(msg) { |
michael@0 | 34 | window.readyStateText.push(msg); |
michael@0 | 35 | document.getElementById("display").innerHTML = readyStateText.join("<br>"); |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | function frameLoad() { |
michael@0 | 39 | var doc = $('iframe').contentWindow.document; |
michael@0 | 40 | is(doc.readyState, "complete", "frame document.readyState should be 'complete' on load"); |
michael@0 | 41 | showMessage("frame load: " + doc.readyState); |
michael@0 | 42 | if (window.loaded) SimpleTest.finish(); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | function load() { |
michael@0 | 46 | window.loaded = true; |
michael@0 | 47 | |
michael@0 | 48 | var imgsrc = "<img onload ='window.parent.imgLoad()' src='image.png'>\n"; |
michael@0 | 49 | var doc = $('iframe').contentWindow.document; |
michael@0 | 50 | doc.writeln(imgsrc); |
michael@0 | 51 | doc.close(); |
michael@0 | 52 | showMessage("frame after document.write: " + doc.readyState); |
michael@0 | 53 | isnot(doc.readyState, "complete", "frame document.readyState should not be 'complete' after document.write"); |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | function imgLoad() { |
michael@0 | 57 | var doc = $('iframe').contentWindow.document; |
michael@0 | 58 | showMessage("frame after imgLoad: " + doc.readyState); |
michael@0 | 59 | is(doc.readyState, "interactive", "frame document.readyState should still be 'interactive' after img loads"); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | window.onload=load; |
michael@0 | 63 | |
michael@0 | 64 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 65 | |
michael@0 | 66 | </script> |
michael@0 | 67 | </pre> |
michael@0 | 68 | <iframe src="404doesnotexist" id="iframe" onload="frameLoad();"></iframe> |
michael@0 | 69 | </body> |
michael@0 | 70 | </html> |