tor-browser

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

event-timeout-order.any.js (790B)


      1 // META: title=XMLHttpRequest: event - timeout (order of events)
      2 // META: script=resources/xmlhttprequest-event-order.js
      3 
      4 var test = async_test();
      5 test.step(function () {
      6    var xhr = new XMLHttpRequest();
      7    prepare_xhr_for_event_order_test(xhr);
      8    xhr.addEventListener("loadend", function () {
      9        test.step(function () {
     10            assert_xhr_event_order_matches([1, "loadstart(0,0,false)", "upload.loadstart(0,12,true)", 4, "upload.timeout(0,0,false)", "upload.loadend(0,0,false)", "timeout(0,0,false)", "loadend(0,0,false)"]);
     11            test.done();
     12        });
     13    });
     14 
     15    xhr.timeout = 5;
     16    xhr.open("POST", "resources/delay.py?ms=20000");
     17    xhr.send("Test Message");
     18    test.step_timeout(() => {
     19        assert_unreached("ontimeout not called.");
     20    }, 2000);
     21 });