tor-browser

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

loaf-promise.html (1736B)


      1 <!DOCTYPE HTML>
      2 <meta charset=utf-8>
      3 <title>Long Animation Frame Timing: promise resolvers</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/get-host-info.sub.js"></script>
      8 <script src="resources/utils.js"></script>
      9 
     10 <body>
     11 <h1>Long Animation Frame: promise resolvers</h1>
     12 <div id="log"></div>
     13 <script type="module">
     14 
     15 const {REMOTE_ORIGIN} = get_host_info();
     16 
     17 test_promise_script(async (t, busy_wait) => {
     18    await fetch("/common/dummy.xml");
     19    busy_wait(very_long_frame_duration);
     20 }, "resolve", "Window.fetch.then");
     21 
     22 test_promise_script(async (t, busy_wait) => {
     23    const response = await fetch("/common/dummy.xml");
     24    await response.text();
     25    busy_wait(very_long_frame_duration);
     26 }, "resolve", "Response.text.then");
     27 
     28 test_promise_script(async (t, busy_wait) => {
     29    const response = await fetch("/common/dummy.xml");
     30    await response.arrayBuffer();
     31    busy_wait(very_long_frame_duration);
     32 }, "resolve", "Response.arrayBuffer.then");
     33 
     34 test_promise_script(async (t, busy_wait) => {
     35    const response = await fetch("/fetch/api/resources/data.json");
     36    await response.json();
     37    busy_wait(very_long_frame_duration);
     38 }, "resolve", "Response.json.then");
     39 
     40 test_promise_script(async (t, busy_wait) => {
     41    const response = await import("/loading/resources/dummy.js");
     42    busy_wait(very_long_frame_duration);
     43 }, "resolve", "import.then");
     44 
     45 test_promise_script(async (t, busy_wait) => {
     46    fetch(new URL("/common/dummy.xml", REMOTE_ORIGIN).href, {mode: "cors"})
     47        .catch(() => {
     48            busy_wait(very_long_frame_duration);
     49        })
     50 }, "reject", "Window.fetch.catch" );
     51 </script>
     52 </body>