author Cosmin Sabou <>
Sun, 05 Feb 2023 19:37:33 +0000
changeset 651812 d8601249f1eb8c52c742b0c19c9ca0fa8f2e31fe
parent 616557 918ef225713fa9fc188f42355a6cd4a2bfb3b64c
permissions -rw-r--r--
Bug 1806090 - temporarily disable browser_quickactions.js on linux for frequent failures. r=intermittent-reviewers,MasterWayZ Differential Revision:

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width; initial-scale=1.0">
  <title>Simple wheel scroll cancellation</title>
  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
  <script type="application/javascript" src="apz_test_utils.js"></script>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
  <script type="application/javascript">

async function test() {
  let wheelEventPromise = new Promise(resolve => {
    // Add a non-passive listener on the document, so that we have a document-level
    // APZ-aware listener, and the entire document is put in the dispatch-to-content
    // region
    document.addEventListener("wheel", function(e) {
      // spin for 2 seconds to give APZ time to scroll, if the event region override
      // is broken and it decides not to wait for the main thread. Note that it's
      // possible the APZ controller thread is busy for whatever reason so APZ
      // may not scroll. That might cause this test to only fail intermittently
      // instead of consistently if the behaviour being tested regresses.
      var now =;
      while ( - now < 2000);

      // Cancel the scroll. If this works then we know APZ waited for this listener
      // to run.
    }, { passive: false });

  // Ensure APZ gets a paint with the d-t-c region
  await promiseApzFlushedRepaints();

  await synthesizeNativeWheel(document.body, 100, 100, 0, -50);
  dump("Finished native wheel, waiting for listener to run...\n");

  await wheelEventPromise;
  await promiseOnlyApzControllerFlushed();

  is(window.scrollY, 0, "check that the window didn't scroll");

if ( != window) {
    dump("Running inside an iframe! stealing functions from\n");
    window.subtestDone =;
    window.SimpleTest =; =;
    window.ok =;


<body style="height: 5000px; background-image: linear-gradient(green,red);">
  This page should not be wheel-scrollable.