tor-browser

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

firing-events-http-no-content-length.html (1089B)


      1 <!doctype html>
      2 <html>
      3  <head>
      4    <title>ProgressEvent: firing events for HTTP with no Content-Length</title>
      5    <script src="/resources/testharness.js"></script>
      6    <script src="/resources/testharnessreport.js"></script>
      7  </head>
      8  <body>
      9    <div id="log"></div>
     10    <script>
     11      async_test(t => {
     12        const xhr = new XMLHttpRequest();
     13        let progressHappened = false;
     14 
     15        xhr.onprogress = t.step_func(pe => {
     16          assert_equals(pe.type, "progress");
     17          assert_greater_than_equal(pe.loaded, 0, "loaded");
     18          assert_false(pe.lengthComputable, "lengthComputable");
     19          assert_equals(pe.total, 0, "total");
     20          progressHappened = true;
     21        });
     22 
     23        // "loadstart", "error", "abort", "load" tests are out of scope.
     24        // They SHOULD be tested in each spec that implement ProgressEvent.
     25 
     26        xhr.onloadend = t.step_func_done(() => {
     27          assert_true(progressHappened);
     28        });
     29 
     30        xhr.open("GET", "resources/trickle.py?ms=0&count=100", true);
     31        xhr.send(null);
     32      });
     33    </script>
     34  </body>
     35 </html>