tor-browser

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

event-readystatechange-loaded.any.js (716B)


      1 // META: title=XMLHttpRequest: the LOADING state change may be emitted multiple times
      2 
      3 var test = async_test();
      4 
      5 test.step(function () {
      6    var client = new XMLHttpRequest();
      7    var countedLoading = 0;
      8 
      9    client.onreadystatechange = test.step_func(function () {
     10        if (client.readyState === 3) {
     11            countedLoading += 1;
     12        }
     13 
     14        if (client.readyState === 4) {
     15            assert_greater_than(countedLoading, 1, "LOADING state change may be emitted multiple times");
     16 
     17            test.done();
     18        }
     19    });
     20 
     21    client.open("GET", "resources/trickle.py?count=10"); // default timeout in trickle.py is 1/2 sec, so this request will take 5 seconds to complete
     22    client.send(null);
     23 });