tor-browser

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

test-document-onload.html (2519B)


      1 <!DOCTYPE html>
      2 <html>
      3    <head>
      4        <meta charset="utf-8">
      5        <title>window.performance.navigation attributes</title>
      6        <link rel="author" title="Mozilla" href="https://www.mozilla.org/" />
      7        <link rel="help" href="https://www.w3.org/TR/navigation-timing-2/#processing-model"/>
      8        <script src="/resources/testharness.js"></script>
      9        <script src="/resources/testharnessreport.js"></script>
     10        <script src="/common/performance-timeline-utils.js"></script>
     11        <script src="resources/webperftestharness.js"></script>
     12    </head>
     13    <body>
     14        <h1>Description</h1>
     15        <p>This test checks that the transferSize, encodedBodySize and decodedBodySize attributes have correct values when checked in the onload handler</p>
     16 
     17        <div id="log"></div>
     18 
     19        <script>
     20            async_test(function (t) {
     21                document.addEventListener("DOMContentLoaded", t.step_func_done(() => {
     22                    let entry = window.performance.getEntriesByType("navigation")[0];
     23                    assert_greater_than(entry.transferSize, 1000, "descr");
     24                    assert_greater_than(entry.encodedBodySize, 1000, "descr");
     25                    assert_greater_than(entry.decodedBodySize, 1000, "descr");
     26                }));
     27            }, "Test that the attributes have a proper value during DOMContentLoaded");
     28 
     29            async_test(function (t) {
     30                window.addEventListener("load", t.step_func_done(() => {
     31                    let entry = window.performance.getEntriesByType("navigation")[0];
     32                    assert_greater_than(entry.transferSize, 1000, "descr");
     33                    assert_greater_than(entry.encodedBodySize, 1000, "descr");
     34                    assert_greater_than(entry.decodedBodySize, 1000, "descr");
     35                    async_test(function (t) {
     36                        setTimeout(t.step_func_done(() => {
     37                          let entry = window.performance.getEntriesByType("navigation")[0];
     38                          assert_greater_than(entry.transferSize, 1000, "descr");
     39                          assert_greater_than(entry.encodedBodySize, 1000, "descr");
     40                          assert_greater_than(entry.decodedBodySize, 1000, "descr");
     41                        }), 0);
     42                    }, "Test that the attributes have a proper value during a task after onload");
     43                }));
     44            }, "Test that the attributes have a proper value during onload");
     45 
     46        </script>
     47    </body>
     48 </html>