Revision eb9f8a917a751b5bd2e4ed86840eac8b5c4445f2 authored by Brian Birtles on 15 March 2018, 06:57:09 UTC, committed by Brian Birtles on 15 March 2018, 06:57:09 UTC
This patch also drops the test that an AnimationEffectTiming object is
created in the appropriate realm since it is no longer the case that
a separate timing object is created.
1 parent df2153f
Raw File
overridemimetype-blob.html
<!doctype html>
<title>XMLHttpRequest: overrideMimeType() and responseType = "blob"</title>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
async_test(t => {
  const client = new XMLHttpRequest()
  client.onload = t.step_func_done(() => {
    assert_equals(client.getResponseHeader("Content-Type"), "")
    assert_equals(client.response.type, "text/xml")
  })
  client.open("GET", "resources/status.py")
  client.responseType = "blob"
  client.send()
}, "Use text/xml as fallback MIME type")

async_test(t => {
  const client = new XMLHttpRequest()
  client.onload = t.step_func_done(() => {
    assert_equals(client.getResponseHeader("Content-Type"), "")
    assert_equals(client.response.type, "text/xml")
  })
  client.open("GET", "resources/status.py?content=thisshouldnotmakeadifferencebutdoes")
  client.responseType = "blob"
  client.send()
}, "Use text/xml as fallback MIME type, 2")

async_test(t => {
  const client = new XMLHttpRequest()
  client.onload = t.step_func_done(() => {
    assert_equals(client.getResponseHeader("Content-Type"), "")
    assert_equals(client.response.type, "application/octet-stream")
  })
  client.open("GET", "resources/status.py")
  client.responseType = "blob"
  client.overrideMimeType("bogus")
  client.send()
}, "Bogus MIME type should end up as application/octet-stream")

async_test(t => {
  const client = new XMLHttpRequest()
  client.onload = t.step_func_done(() => {
    assert_equals(client.getResponseHeader("Content-Type"), "")
    assert_equals(client.response.type, "application/octet-stream")
  })
  client.open("GET", "resources/status.py")
  client.responseType = "blob"
  client.overrideMimeType("text/xml;charset=†")
  client.send()
}, "Bogus MIME type should end up as application/octet-stream, 2")

async_test(t => {
  const client = new XMLHttpRequest()
  client.onload = t.step_func_done(() => {
    assert_equals(client.getResponseHeader("Content-Type"), "")
    assert_equals(client.response.type, "hi/x")
  })
  client.open("GET", "resources/status.py")
  client.responseType = "blob"
  client.overrideMimeType("HI/x;test=test")
  client.send()
}, "Valid MIME types need to be normalized")
</script>
back to top