tor-browser

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

test_bug1277814.html (3581B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1277814
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 1277814</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <script src="/tests/SimpleTest/paint_listener.js"></script>
     11  <script type="application/javascript" src="apz_test_utils.js"></script>
     12  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
     13  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     14  <script type="application/javascript">
     15    async function test() {
     16      // Trigger the buggy scenario
     17      var subframe = document.getElementById("bug1277814-div");
     18      subframe.classList.add("a");
     19 
     20      // The transform change is animated, so let's step through 1s of animation
     21      var utils = SpecialPowers.getDOMWindowUtils(window);
     22      for (var i = 0; i < 60; i++) {
     23        utils.advanceTimeAndRefresh(16);
     24      }
     25      utils.restoreNormalRefresh();
     26 
     27      // Wait for the layer tree with any updated dispatch-to-content region to
     28      // get pushed over to the APZ
     29      await promiseAllPaintsDone();
     30      await promiseOnlyApzControllerFlushed();
     31 
     32      // Trigger layerization of the subframe by scrolling the wheel over it
     33      await promiseMoveMouseAndScrollWheelOver(subframe, 10, 10);
     34 
     35      // Give APZ the chance to compute a displayport, and content
     36      // to render based on it.
     37      await promiseApzFlushedRepaints();
     38 
     39      // Examine the content-side APZ test data
     40      var contentTestData = utils.getContentAPZTestData();
     41 
     42      // Test that the scroll frame for the div 'bug1277814-div' appears in
     43      // the APZ test data. The bug this test is for causes the displayport
     44      // calculation for this scroll frame to go wrong, causing it not to
     45      // become layerized.
     46      contentTestData = convertTestData(contentTestData);
     47      var foundIt = false;
     48      for (var seqNo in contentTestData.paints) {
     49        var paint = contentTestData.paints[seqNo];
     50        for (var scrollId in paint) {
     51          var scrollFrame = paint[scrollId];
     52          if ("contentDescription" in scrollFrame &&
     53              scrollFrame.contentDescription.includes("bug1277814-div")) {
     54            foundIt = true;
     55          }
     56        }
     57      }
     58      SimpleTest.ok(foundIt, "expected to find APZ test data for bug1277814-div");
     59    }
     60 
     61    if (isApzEnabled()) {
     62      SimpleTest.waitForExplicitFinish();
     63 
     64      pushPrefs([["apz.test.logging_enabled", true]])
     65        .then(waitUntilApzStable)
     66        .then(test)
     67        .then(SimpleTest.finish, SimpleTest.finishWithFailure);
     68    }
     69  </script>
     70  <style>
     71    #bug1277814-div
     72    {
     73      position: absolute;
     74      left: 0;
     75      top: 0;
     76      padding: .5em;
     77      overflow: auto;
     78      color: white;
     79      background: green;
     80      max-width: 30em;
     81      max-height: 6em;
     82      visibility: hidden;
     83      transform: scaleY(0);
     84      transition: transform .15s ease-out, visibility 0s ease .15s;
     85    }
     86    #bug1277814-div.a
     87    {
     88      visibility: visible;
     89      transform: scaleY(1);
     90      transition: transform .15s ease-out;
     91    }
     92  </style>
     93 </head>
     94 <body>
     95  <!-- Use a unique id because we'll be checking for it in the content
     96       description logged in the APZ test data -->
     97  <div id="bug1277814-div">
     98    CoolCmd<br>CoolCmd<br>CoolCmd<br>CoolCmd<br>
     99    CoolCmd<br>CoolCmd<br>CoolCmd<br>CoolCmd<br>
    100    CoolCmd<br>CoolCmd<br>CoolCmd<br>CoolCmd<br>
    101    CoolCmd<br>CoolCmd<br>CoolCmd<br>CoolCmd<br>
    102    CoolCmd<br>CoolCmd<br>CoolCmd<br>CoolCmd<br>
    103  <button>click me</button>
    104 </body>
    105 </html>