Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=851485 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <meta charset="utf-8"> |
michael@0 | 8 | <title>Test for Bug 851485</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 | <script type="application/javascript"> |
michael@0 | 13 | |
michael@0 | 14 | /** Test for Bug 851485 **/ |
michael@0 | 15 | |
michael@0 | 16 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 17 | |
michael@0 | 18 | function delayedVerifyScroll(win) { |
michael@0 | 19 | ok(win.scrollY > 3000); |
michael@0 | 20 | SimpleTest.finish(); |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | function verifyScroll(event) { |
michael@0 | 24 | var win = event.target.defaultView; |
michael@0 | 25 | win.onscroll = ""; |
michael@0 | 26 | setTimeout(function(){delayedVerifyScroll(win)},500) |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | function clickLink(link,win) { |
michael@0 | 30 | win.document.body.offsetHeight; |
michael@0 | 31 | synthesizeMouseAtCenter(link, {type: "mousedown"}, win); |
michael@0 | 32 | synthesizeMouseAtCenter(link, {type: "mouseup"}, win); |
michael@0 | 33 | sendMouseEvent({type: "click"}, link, win); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | function verifyAfterLoad() { |
michael@0 | 37 | var e = document.getElementsByTagName('iframe')[0]; |
michael@0 | 38 | var win = e.contentWindow; |
michael@0 | 39 | if (win.location.hash != '') { |
michael@0 | 40 | is(win.scrollY,500); |
michael@0 | 41 | var link = win.document.getElementsByTagName('a')[0]; |
michael@0 | 42 | win.onscroll = verifyScroll; |
michael@0 | 43 | clickLink(link,win); |
michael@0 | 44 | return; |
michael@0 | 45 | } |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | function runTest() { |
michael@0 | 49 | var e = document.getElementsByTagName('iframe')[0]; |
michael@0 | 50 | var win = e.contentWindow; |
michael@0 | 51 | if (win.location.hash != '') { |
michael@0 | 52 | return; |
michael@0 | 53 | } |
michael@0 | 54 | win.location.hash='#anchor' |
michael@0 | 55 | win.scrollTo(0,500); |
michael@0 | 56 | e.setAttribute("onload","verifyAfterLoad()"); |
michael@0 | 57 | win.location.reload() |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | |
michael@0 | 61 | </script> |
michael@0 | 62 | </head> |
michael@0 | 63 | <body> |
michael@0 | 64 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=851485">Mozilla Bug 851485</a> |
michael@0 | 65 | <p id="display"></p> |
michael@0 | 66 | <div id="content" style="display: none"> |
michael@0 | 67 | </div> |
michael@0 | 68 | <pre id="test"> |
michael@0 | 69 | </pre> |
michael@0 | 70 | <iframe src="file_bug842853.html"></iframe> |
michael@0 | 71 | <script> |
michael@0 | 72 | |
michael@0 | 73 | </script> |
michael@0 | 74 | </body> |
michael@0 | 75 | </html> |