tor-browser

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

open-during-abort.htm (1000B)


      1 <!doctype html>
      2 <html>
      3  <head>
      4    <title>XMLHttpRequest: open() during abort()</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      test(function() {
     12        var client = new XMLHttpRequest(),
     13            abort_flag = false,
     14            result = [],
     15            expected = [1, 4, 1] // open() => 1, abort() => 4, open() => 1
     16 
     17        client.onreadystatechange = this.step_func(function() {
     18          result.push(client.readyState)
     19          if (abort_flag) {
     20            abort_flag = false
     21            client.open("GET", "...")
     22          }
     23        })
     24        client.open("GET", "resources/well-formed.xml")
     25        client.send(null)
     26        abort_flag = true
     27        client.abort()
     28        assert_array_equals(result, expected)
     29        assert_equals(client.readyState, 1) // abort() should only set state to UNSENT when DONE
     30      })
     31    </script>
     32  </body>
     33 </html>