tor-browser

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

helper_bug1637135_narrow_viewport.html (1671B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1637135
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <meta name="viewport" content="width=400px">
      9  <title>Test for Bug 1637135</title>
     10  <script src="/tests/SimpleTest/paint_listener.js"></script>
     11  <script src="/tests/SimpleTest/EventUtils.js"></script>
     12  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
     13  <script type="application/javascript" src="apz_test_utils.js"></script>
     14  <style>
     15    #target {
     16      margin-left: 450px;
     17      width: 100px;
     18      height: 100px;
     19    }
     20  </style>
     21 </head>
     22 <body>
     23  <div id="target">
     24  <script type="application/javascript">
     25 
     26 async function test() {
     27  // Tap the target element, which is located beyond x=400.
     28  // The bug occurs when we cannot hit it because the viewport
     29  // width of x=400 causes us to be unable to hit elements
     30  // beyond that point.
     31  let target = document.getElementById("target");
     32  let mouseDownEvent = null;
     33  let mouseDownPromise = new Promise(resolve => {
     34    target.addEventListener("mousedown", function(e) {
     35      mouseDownEvent = e;
     36      resolve();
     37    });
     38  });
     39 
     40  await synthesizeNativeTap(target, 10, 10);
     41  await mouseDownPromise;
     42 
     43  is(mouseDownEvent.target, target, "mousedown event targeted the correct element");
     44 }
     45 
     46 if (getPlatform() == "android") {
     47  waitUntilApzStable()
     48  .then(test)
     49  .then(subtestDone, subtestFailed);
     50 } else {
     51  // The fix for bug 1637135 is limited to Android, because
     52  // it breaks the ability to target scrollbars, so we can
     53  // only run this test on Android.
     54  ok(true, "This subtest is only run on Android");
     55  subtestDone();
     56 }
     57 
     58  </script>
     59 </body>
     60 </html>