<!DOCTYPE html>
<script src="/js-test-resources/js-test.js"></script>
<script>
jsTestIsAsync = true;
function testOverrideMimeType(xhr) {
debug("Testing overrideMimeType when readyState is " + xhr.readyState);
var isAllowed = xhr.readyState < XMLHttpRequest.LOADING;
if (isAllowed) {
shouldNotThrow("xhr.overrideMimeType('text/plain')");
} else {
shouldThrow("xhr.overrideMimeType('text/plain')");
}
}
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
testOverrideMimeType(xhr);
if (xhr.readyState == XMLHttpRequest.DONE)
finishJSTest();
}
testOverrideMimeType(xhr);
xhr.open("GET", "resources/get.txt", true);
testOverrideMimeType(xhr);
xhr.send(null);
testOverrideMimeType(xhr);
</script>