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.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=369950 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 369950</title> |
michael@0 | 8 | <script type="application/javascript" src="/MochiKit/MochiKit.js"></script> |
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=369950">Mozilla Bug 369950</a> |
michael@0 | 15 | <p id="display"> |
michael@0 | 16 | <iframe id="i" src="bug369950-subframe.xml" width="200" height="100"></iframe> |
michael@0 | 17 | </p> |
michael@0 | 18 | <div id="content" style="display: none"> |
michael@0 | 19 | |
michael@0 | 20 | </div> |
michael@0 | 21 | <pre id="test"> |
michael@0 | 22 | <script type="application/javascript"> |
michael@0 | 23 | |
michael@0 | 24 | /** Test for Bug 369950 **/ |
michael@0 | 25 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 26 | |
michael@0 | 27 | addLoadEvent(function() { |
michael@0 | 28 | // Can't just run our code here, because we might not have painting |
michael@0 | 29 | // unsuppressed yet. Do it async. |
michael@0 | 30 | SimpleTest.executeSoon(doTheTest); |
michael@0 | 31 | }); |
michael@0 | 32 | |
michael@0 | 33 | function doTheTest() { |
michael@0 | 34 | // do a layout flush |
michael@0 | 35 | var rect = $("i").getBoundingClientRect(); |
michael@0 | 36 | var rect2 = $("i").contentDocument.documentElement.getBoundingClientRect(); |
michael@0 | 37 | |
michael@0 | 38 | // And do the rest of it later |
michael@0 | 39 | SimpleTest.executeSoon(reallyDoTheTest); |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | function reallyDoTheTest() { |
michael@0 | 43 | var rect = $("i").getBoundingClientRect(); |
michael@0 | 44 | var rect2 = $("i").contentDocument.documentElement.getBoundingClientRect(); |
michael@0 | 45 | |
michael@0 | 46 | // We want coords relative to the iframe, so subtract off rect2.left/top. |
michael@0 | 47 | // 7px is a guess to get us from the bottom of the iframe into the scrollbar |
michael@0 | 48 | // groove for the horizontal scrollbar on the bottom. |
michael@0 | 49 | synthesizeMouse($("i").contentDocument.documentElement, |
michael@0 | 50 | -rect2.left + rect.width / 2, rect.height - rect2.top - 7, |
michael@0 | 51 | {}, $("i").contentWindow); |
michael@0 | 52 | // Scroll is async, so give it time |
michael@0 | 53 | SimpleTest.executeSoon(checkScroll); |
michael@0 | 54 | }; |
michael@0 | 55 | |
michael@0 | 56 | function checkScroll() { |
michael@0 | 57 | // do a layout flush |
michael@0 | 58 | var rect = $("i").getBoundingClientRect(); |
michael@0 | 59 | // And do the rest of it later |
michael@0 | 60 | SimpleTest.executeSoon(reallyCheckScroll); |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | function reallyCheckScroll() { |
michael@0 | 64 | var rect = $("i").getBoundingClientRect(); |
michael@0 | 65 | var rect2 = $("i").contentDocument.documentElement.getBoundingClientRect(); |
michael@0 | 66 | isnot($("i").contentWindow.scrollX, 0, "Clicking scrollbar should scroll"); |
michael@0 | 67 | |
michael@0 | 68 | // Not doing things below here, since avoiding the scroll arrows |
michael@0 | 69 | // cross-platform is a huge pain. |
michael@0 | 70 | SimpleTest.finish(); |
michael@0 | 71 | return; |
michael@0 | 72 | |
michael@0 | 73 | // 8px horizontal offset is a guess to get us into the scr |
michael@0 | 74 | synthesizeMouse($("i").contentDocument.documentElement, -rect2.left + 8, |
michael@0 | 75 | rect.height - rect2.top - 7, {}, $("i").contentWindow); |
michael@0 | 76 | // Scroll is async, so give it time |
michael@0 | 77 | SimpleTest.executeSoon(finishUp); |
michael@0 | 78 | } |
michael@0 | 79 | |
michael@0 | 80 | function finishUp() { |
michael@0 | 81 | is($("i").contentWindow.scrollX, 0, "Clicking scrollbar should scroll back"); |
michael@0 | 82 | SimpleTest.finish(); |
michael@0 | 83 | }; |
michael@0 | 84 | |
michael@0 | 85 | |
michael@0 | 86 | |
michael@0 | 87 | |
michael@0 | 88 | </script> |
michael@0 | 89 | </pre> |
michael@0 | 90 | </body> |
michael@0 | 91 | </html> |