<!doctype html>
<html>
<head>
<title>XMLHttpRequest: overrideMimeType() in open state, XML MIME type with UTF-8 charset</title>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-overridemimetype()-method" data-tested-assertations="/following::ol/li[3] /following::ol/li[4]" />
</head>
<body>
<div id="log"></div>
<script>
var test = async_test();
test.step(function() {
var client = new XMLHttpRequest();
client.onreadystatechange = function() {
if (client.readyState !== 4) return;
try{
var str = client.responseXML.documentElement.tagName+client.responseXML.documentElement.firstChild.tagName+client.responseXML.documentElement.firstChild.textContent;
}catch(e){
assert_unreached('Exception when reading responseXML');
}
assert_equals( client.responseXML.documentElement.tagName, 'test' );
assert_equals( client.responseXML.documentElement.firstChild.tagName, 'message' );
assert_equals( client.responseXML.documentElement.firstChild.textContent, 'Hello World!' );
test.done();
};
client.open("GET", "resources/status.py?type="+encodeURIComponent('text/plain;charset=Shift-JIS')+'&content='+encodeURIComponent('<test><message>Hello World!</message></test>'));
client.overrideMimeType('application/xml;charset=UTF-8');
client.send();
});
</script>
</body>
</html>