https://github.com/web-platform-tests/wpt
Raw File
Tip revision: a3e01e5be250ecebeeefc5e5faf65a8a47f89e64 authored by James Graham on 13 February 2017, 10:16:48 UTC
Pass --enable-experimental-web-platform-features to Chrome instability checker
Tip revision: a3e01e5
abort-during-done.htm
<!doctype html>
<html>
  <head>
    <title>XMLHttpRequest: abort() during DONE</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <link rel="help" href="https://xhr.spec.whatwg.org/#the-abort()-method" data-tested-assertations="following-sibling::ol/li[4] following-sibling::ol/li[5]" />
  </head>
  <body>
    <div id="log"></div>
    <script>
      var test = async_test()
      test.step(function() {
        var client = new XMLHttpRequest(),
            result = [],
            expected = [1, 4] // open() -> 1, send() -> 4
        client.onreadystatechange = function() {
          test.step(function() {
            result.push(client.readyState)
          })
        }
        client.open("GET", "resources/well-formed.xml", false)
        client.send(null)
        assert_equals(client.readyState, 4)
        assert_equals(client.status, 200)
        assert_equals(client.responseXML.documentElement.localName, "html")
        client.abort()
        assert_equals(client.readyState, 0)
        assert_equals(client.status, 0)
        assert_equals(client.statusText, "")
        assert_equals(client.responseXML, null)
        assert_equals(client.getAllResponseHeaders(), "")
        assert_array_equals(result, expected)
        test.done()
      })
    </script>
  </body>
</html>
back to top