layout/base/tests/test_bug851485.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial