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