https://github.com/web-platform-tests/wpt
Raw File
Tip revision: e46d835e8e757a910dadc70f4f6e6b581fac2af4 authored by James Graham on 16 October 2013, 16:59:22 UTC
Add rewriten path for web idl parser
Tip revision: e46d835
overridemimetype-open-state-force-xml.htm
<!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="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#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>
back to top