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 | <?xml version="1.0"?> |
michael@0 | 2 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 3 | <window title="Mozilla Bug 522217" |
michael@0 | 4 | onload="start();" |
michael@0 | 5 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 6 | |
michael@0 | 7 | <script type="application/javascript" |
michael@0 | 8 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js" /> |
michael@0 | 9 | |
michael@0 | 10 | <body xmlns="http://www.w3.org/1999/xhtml" id="body"> |
michael@0 | 11 | </body> |
michael@0 | 12 | |
michael@0 | 13 | <script class="testbody" type="application/javascript"> |
michael@0 | 14 | <![CDATA[ |
michael@0 | 15 | |
michael@0 | 16 | function ok(aCondition, aMessage) |
michael@0 | 17 | { |
michael@0 | 18 | window.opener.wrappedJSObject.SimpleTest.ok(aCondition, aMessage); |
michael@0 | 19 | } |
michael@0 | 20 | |
michael@0 | 21 | function is(aLeft, aRight, aMessage) |
michael@0 | 22 | { |
michael@0 | 23 | window.opener.wrappedJSObject.SimpleTest.is(aLeft, aRight, aMessage); |
michael@0 | 24 | } |
michael@0 | 25 | |
michael@0 | 26 | function isnot(aLeft, aRight, aMessage) |
michael@0 | 27 | { |
michael@0 | 28 | window.opener.wrappedJSObject.SimpleTest.isnot(aLeft, aRight, aMessage); |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | function executeSoon(aFct) |
michael@0 | 32 | { |
michael@0 | 33 | window.opener.wrappedJSObject.SimpleTest.executeSoon(aFct); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | function start() { |
michael@0 | 37 | window.onfocus = function () { |
michael@0 | 38 | window.onfocus = null; |
michael@0 | 39 | var oldOuterWidth = window.outerWidth, oldOuterHeight = window.outerHeight; |
michael@0 | 40 | var oldInnerWidth = window.innerWidth, oldInnerHeight = window.innerHeight; |
michael@0 | 41 | document.documentElement.setAttribute("drawintitlebar", "true"); |
michael@0 | 42 | |
michael@0 | 43 | executeSoon(function() { |
michael@0 | 44 | is(window.outerWidth, oldOuterWidth, "drawintitlebar shouldn't change the window's outerWidth"); |
michael@0 | 45 | is(window.outerHeight, oldOuterHeight, "drawintitlebar shouldn't change the window's outerHeight"); |
michael@0 | 46 | is(window.innerWidth, oldOuterWidth, "if drawintitlebar is set, innerWidth and outerWidth should be the same"); |
michael@0 | 47 | is(window.innerHeight, oldOuterHeight, "if drawintitlebar is set, innerHeight and outerHeight should be the same"); |
michael@0 | 48 | window.fullScreen = true; |
michael@0 | 49 | window.fullScreen = false; |
michael@0 | 50 | is(window.outerWidth, oldOuterWidth, "wrong outerWidth after fullscreen mode"); |
michael@0 | 51 | is(window.outerHeight, oldOuterHeight, "wrong outerHeight after fullscreen mode"); |
michael@0 | 52 | is(window.innerWidth, oldOuterWidth, "wrong innerWidth after fullscreen mode"); |
michael@0 | 53 | is(window.innerHeight, oldOuterHeight, "wrong innerHeight after fullscreen mode"); |
michael@0 | 54 | document.documentElement.removeAttribute("drawintitlebar"); |
michael@0 | 55 | |
michael@0 | 56 | executeSoon(function() { |
michael@0 | 57 | is(window.outerWidth, oldOuterWidth, "wrong outerWidth after removing drawintitlebar"); |
michael@0 | 58 | is(window.outerHeight, oldOuterHeight, "wrong outerHeight after removing drawintitlebar"); |
michael@0 | 59 | is(window.innerWidth, oldInnerWidth, "wrong innerWidth after removing drawintitlebar"); |
michael@0 | 60 | is(window.innerHeight, oldInnerHeight, "wrong innerHeight after removing drawintitlebar"); |
michael@0 | 61 | window.opener.wrappedJSObject.SimpleTest.finish(); |
michael@0 | 62 | window.close(); |
michael@0 | 63 | }); |
michael@0 | 64 | }); |
michael@0 | 65 | } |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | |
michael@0 | 69 | ]]> |
michael@0 | 70 | </script> |
michael@0 | 71 | |
michael@0 | 72 | </window> |