tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug564115.html (1497B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=564115
      5 -->
      6 <head>
      7  <title>Test for Bug 564115</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     10 
     11 </head>
     12 <body>
     13 <p><a target="_blank" href="https://bugzilla.mozilla.org/show_bug?id=564115">Mozilla Bug 564115</a>
     14 
     15 <pre id="test">
     16 <script>
     17 
     18 const TEST_URL = "/tests/layout/forms/test/bug564115_window.html";
     19 
     20 addLoadEvent(function() {
     21  var win = open(TEST_URL, "", "width=600,height=600");
     22  SimpleTest.waitForFocus(function() {
     23    var doc = win.document;
     24    var input = doc.querySelector("input");
     25 
     26    // Focus the input box, and wait for the focus to actually happen
     27    input.focus();
     28    win.requestAnimationFrame(function() {
     29      win.requestAnimationFrame(function() {
     30        // Scroll down a bit
     31        win.scrollTo(0, 5000);
     32 
     33        setTimeout(function() {
     34          is(Math.round(win.pageYOffset), 5000, "Page should be scrolled correctly");
     35 
     36          // Refocus the window
     37          SimpleTest.waitForFocus(function() {
     38            SimpleTest.waitForFocus(function() {
     39              is(Math.round(win.pageYOffset), 5000,
     40                 "The page's scroll offset should not have been changed");
     41 
     42              win.close();
     43              SimpleTest.finish();
     44            }, win);
     45          });
     46        }, 0);
     47      });
     48    });
     49  }, win);
     50 });
     51 
     52 SimpleTest.waitForExplicitFinish();
     53 </script>
     54 </pre>
     55 
     56 </body>
     57 </html>