tor-browser

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

callback-timeRemaining-cross-realm-method.html (852B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <meta name="timeout" content="long">
      4 <title>IdleDeadline::timeRemaining() uses relevant global object as a high-res timestamp origin</title>
      5 <link rel="help" href="https://w3c.github.io/requestidlecallback/#dom-idledeadline-timeremaining">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 
      9 <body>
     10 <script>
     11 const t = async_test();
     12 t.step_timeout(() => {
     13  const iframeDelayed = document.createElement("iframe");
     14  iframeDelayed.onload = t.step_func(() => {
     15    requestIdleCallback(t.step_func_done(deadline => {
     16      assert_approx_equals(
     17        iframeDelayed.contentWindow.IdleDeadline.prototype.timeRemaining.call(deadline),
     18        deadline.timeRemaining(),
     19        5,
     20      );
     21    }));
     22  });
     23  document.body.append(iframeDelayed);
     24 }, 1000);
     25 </script>