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
.testRunner
) {
11 testRunner
.dumpAsText();
12 testRunner
.waitUntilDone();
15 var console_messages
= document
.createElement("ol");
16 document
.body
.appendChild(console_messages
);
22 var item
= document
.createElement("li");
23 item
.appendChild(document
.createTextNode(message
));
24 console_messages
.appendChild(item
);
27 function get(url
, async
)
29 if (window
.XMLHttpRequest
) {
30 req
= new XMLHttpRequest();
33 req
= new ActiveXObject("Msxml2.XMLHTTP");
35 req
= new ActiveXObject("Microsoft.XMLHTTP");
40 req
.onreadystatechange
= processStateChange
;
42 req
.open('GET', url
, async
);
48 function processStateChange(){
49 if (req
.readyState
== 4) {
50 log("Async: HTML, charset determined by a META: " + req
.responseText
.replace(/\s/g, "").replace(/.*<body>(.*)<\/body>.*/, "$1"));
51 if (window
.testRunner
)
52 testRunner
.notifyDone();
57 req
= get('resources/1251.html', false);
58 log("HTML, charset determined by a META: " + req
.responseText
.replace(/\s/g, "").replace(/.*<body>(.*)<\/body>.*/, "$1"));
60 log("Exception: " + ex
.description
);
63 get('resources/1251.html', true);