tor-browser

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

test_input_vsync_alignment_inner_event_loop.html (1478B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      5  <script src="/tests/SimpleTest/EventUtils.js"></script>
      6  <link rel="stylesheet" href="/tests/SimpleTest/test.css">
      7 </head>
      8 <body >
      9 <input />
     10 <script type="text/javascript">
     11  SimpleTest.waitForExplicitFinish();
     12 
     13  function runTest() {
     14    function checkResult() {
     15      ok(true, "didn't crash");
     16      SimpleTest.finish();
     17    }
     18 
     19    // Dispatch an vsync event to the queue
     20    window.requestAnimationFrame(() => {
     21      window.requestAnimationFrame(() => {
     22      });
     23    });
     24 
     25    // Dispatch the first input tasks. Since there's a vsync
     26    // task in the queue, so this task takes the priority and runs
     27    // first.
     28    SpecialPowers.Services.tm.dispatchToMainThread(function() {
     29      let secondInputRun = false;
     30 
     31      // Dispatch the second input task to the queue.
     32      SpecialPowers.Services.tm.dispatchToMainThread(function() {
     33        secondInputRun = true;
     34      }, SpecialPowers.Ci.nsIRunnablePriority.PRIORITY_INPUT_HIGH);
     35 
     36      // Inner event loop runs and picks the second input task to run.
     37      SpecialPowers.Services.tm.spinEventLoopUntil(
     38        "Test(vsync_alignment_inner_event_loop.html)", () => secondInputRun);
     39 
     40      setTimeout(checkResult, 0);
     41    }, SpecialPowers.Ci.nsIRunnablePriority.PRIORITY_INPUT_HIGH);
     42  }
     43 
     44  SpecialPowers.pushPrefEnv({
     45      set: [["dom.input_events.strict_input_vsync_alignment", true]]
     46  }, runTest());
     47 </script>
     48 </body>
     49 </html>