tor-browser

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

abort-after-receive.any.js (951B)


      1 // META: title=XMLHttpRequest: abort() after successful receive should not fire "abort" event
      2 
      3      var test = async_test();
      4 
      5      test.step(function() {
      6        var client = new XMLHttpRequest();
      7 
      8        client.onreadystatechange = test.step_func(function() {
      9          if (client.readyState == 4) {
     10            // abort should not cause the "abort" event to fire
     11 
     12            client.abort();
     13 
     14            assert_equals(client.readyState, 0);
     15 
     16            test.step_timeout(function(){ // use a timeout to catch any implementation that might queue an abort event for later - just in case
     17              test.done()
     18            }, 200);
     19          }
     20        });
     21 
     22        client.onabort = test.step_func(function () {
     23            // this should not fire!
     24 
     25            assert_unreached("abort() should not cause the abort event to fire");
     26        });
     27 
     28        client.open("GET", "resources/well-formed.xml", true);
     29        client.send(null);
     30      });