tor-browser

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

loaf-script-nested-callback.html (1719B)


      1 <!DOCTYPE HTML>
      2 <meta charset=utf-8>
      3 <title>Long Animation Frame Timing: nested scripts</title>
      4 <meta name="timeout" content="long">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/common/utils.js"></script>
      8 <script src="resources/utils.js"></script>
      9 
     10 <body>
     11 <h1>Long Animation Frame: nested scripts</h1>
     12 <div id="log"></div>
     13 <div id="dummy"></div>
     14 <script>
     15 promise_test(async t => {
     16  const [entry, script] = await expect_long_frame_with_script((t, busy_wait) => {
     17    const script_element = document.createElement("script");
     18    script_element.async = true;
     19    script_element.src = "resources/loaf-after-callback.js";
     20    t.add_cleanup(() => script_element.remove());
     21    document.body.appendChild(script_element);
     22  }, script =>
     23    script.invoker === new URL("resources/loaf-after-callback.js", location.href).href,
     24    t);
     25  assert_greater_than_equal(script.duration, very_long_frame_duration);
     26 }, "a callback inside a script block should not mask LoAFs that come afterwards")
     27 
     28 promise_test(async t => {
     29  const [entry, script] = await expect_long_frame_with_script((t, busy_wait) => {
     30    const script_element = document.createElement("script");
     31    script_element.async = true;
     32    script_element.src = "resources/loaf-in-microtask-after-callback.js";
     33    t.add_cleanup(() => script_element.remove());
     34    document.body.appendChild(script_element);
     35  }, script =>
     36    script.invoker === new URL("resources/loaf-in-microtask-after-callback.js", location.href).href,
     37    t);
     38  assert_greater_than_equal(script.duration, very_long_frame_duration);
     39 }, "a callback inside a script block should not mask LoAFs in a microtask")
     40 </script>
     41 </body>