Revision 0b94ea95c4e0639d9363cee4603545324f047456 authored by James Graham on 11 April 2018, 14:49:07 UTC, committed by James Graham on 11 April 2018, 14:49:07 UTC
1 parent 72160f1
responsexml-non-document-types.htm
<!doctype html>
<html>
<head>
<title>XMLHttpRequest: responseXML/responseText on other responseType</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-responsexml-attribute" data-tested-assertations="following::ol[1]/li[1]" />
<link rel="help" href="https://xhr.spec.whatwg.org/#the-responsetext-attribute" data-tested-assertations="following::ol[1]/li[1]" />
<link rel="help" href="https://xhr.spec.whatwg.org/#the-responsetype-attribute" data-tested-assertations="following::ol[1]/li[4]" />
</head>
<body>
<div id="log"></div>
<script>
function request(type) {
var test = async_test(document.title+' ('+type+')')
test.step(function() {
var client = new XMLHttpRequest()
client.responseType = type
client.open("GET", "resources/well-formed.xml", true)
client.onload = function(){
test.step(function(){
if(type !== 'document'){
assert_throws("InvalidStateError", function() {
var x = client.responseXML;
}, 'responseXML throw for '+type)
}
if(type !== 'text'){
assert_throws("InvalidStateError", function() {
var x = client.responseText;
}, 'responseText throws for '+type)
}
test.done()
})
}
client.send(null)
})
}
request("arraybuffer")
request("blob")
request("json")
request("text")
request("document")
</script>
</body>
</html>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...