Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
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=764240 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <meta charset="utf-8"> |
michael@0 | 8 | <title>Test for Bug 764240</title> |
michael@0 | 9 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 11 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 12 | </head> |
michael@0 | 13 | <body> |
michael@0 | 14 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=764240">Mozilla Bug 764240</a> |
michael@0 | 15 | <p id="display"></p> |
michael@0 | 16 | <div id="content"> |
michael@0 | 17 | <button onclick="test();">run test</button> |
michael@0 | 18 | </div> |
michael@0 | 19 | <pre id="test"> |
michael@0 | 20 | <script type="application/javascript"> |
michael@0 | 21 | |
michael@0 | 22 | /** Test for Bug 764240 **/ |
michael@0 | 23 | |
michael@0 | 24 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 25 | |
michael@0 | 26 | // Error margin allowed for the window's size. Windows has varying minimum |
michael@0 | 27 | // sizes depending on the os due to outer window chrome. Unix is given 5 |
michael@0 | 28 | // pixels to protect against minor variances. |
michael@0 | 29 | var epsilon = navigator.platform.indexOf("Win") == -1 ? 5 : 20; |
michael@0 | 30 | |
michael@0 | 31 | // Windows 8 has a minimum 122 pixel inner window width due to |
michael@0 | 32 | // outer window chrome. |
michael@0 | 33 | var isWin8 = (navigator.userAgent.indexOf("Windows NT 6.2") != -1); |
michael@0 | 34 | |
michael@0 | 35 | var innerWidthMin = (isWin8 ? 120 : 100); |
michael@0 | 36 | var innerWidthMax = (isWin8 ? 125 : 100); |
michael@0 | 37 | |
michael@0 | 38 | function test() { |
michael@0 | 39 | var w = window.open('data:text/html,null', null, 'width=300,height=300'); |
michael@0 | 40 | var nbResize = 0; |
michael@0 | 41 | |
michael@0 | 42 | SimpleTest.waitForFocus(function() { |
michael@0 | 43 | w.onresize = function() { |
michael@0 | 44 | nbResize++; |
michael@0 | 45 | |
michael@0 | 46 | if (nbResize == 1) { |
michael@0 | 47 | return; |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | ok(w.innerWidth + epsilon >= innerWidthMin && w.innerWidth - epsilon <= innerWidthMax, |
michael@0 | 51 | "innerWidth should be between " + innerWidthMin + " and " + innerWidthMax); |
michael@0 | 52 | ok(w.innerHeight + epsilon >= 100 && w.innerHeight - epsilon <= 100, |
michael@0 | 53 | "innerHeight should be around 100"); |
michael@0 | 54 | |
michael@0 | 55 | // It's not clear why 2 events are coming... |
michael@0 | 56 | is(nbResize, 2, "We should get 2 events."); |
michael@0 | 57 | |
michael@0 | 58 | w.close(); |
michael@0 | 59 | |
michael@0 | 60 | SimpleTest.waitForFocus(function() { |
michael@0 | 61 | SimpleTest.finish(); |
michael@0 | 62 | }); |
michael@0 | 63 | }; |
michael@0 | 64 | w.sizeToContent(); |
michael@0 | 65 | }, w); |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | SimpleTest.waitForFocus(function() { |
michael@0 | 69 | synthesizeMouseAtCenter(document.getElementsByTagName('button')[0], {}); |
michael@0 | 70 | }); |
michael@0 | 71 | |
michael@0 | 72 | </script> |
michael@0 | 73 | </pre> |
michael@0 | 74 | </body> |
michael@0 | 75 | </html> |