3 <title>Test XmlHttpRequest response encoding handling
</title>
6 <p>Test for
<a href=
"http://bugs.webkit.org/show_bug.cgi?id=14288">bug
14288</a>:
7 XMLHttpRequest doesn't use a correct content type for file:// URLs.
</p>
10 if (window
.layoutTestController
)
11 layoutTestController
.dumpAsText();
13 var console_messages
= document
.createElement("ol");
14 document
.body
.appendChild(console_messages
);
20 var item
= document
.createElement("li");
21 item
.appendChild(document
.createTextNode(message
));
22 console_messages
.appendChild(item
);
25 function get(url
, async
)
27 if (window
.XMLHttpRequest
) {
28 req
= new XMLHttpRequest();
31 req
= new ActiveXObject("Msxml2.XMLHTTP");
33 req
= new ActiveXObject("Microsoft.XMLHTTP");
38 req
.onreadystatechange
= processStateChange
;
40 req
.open('GET', url
, async
);
46 function processStateChange(){
47 if (req
.readyState
== 4)
48 log("Async: HTML, charset determined by a META: " + req
.responseText
.replace(/\s/g, "").replace(/.*<body>(.*)<\/body>.*/, "$1"));
52 req
= get('resources/1251.html', false);
53 log("HTML, charset determined by a META: " + req
.responseText
.replace(/\s/g, "").replace(/.*<body>(.*)<\/body>.*/, "$1"));
55 log("Exception: " + ex
.description
);
58 get('resources/1251.html', true);