Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / binary-x-user-defined.html
blobe60e9e4b12587c22ea9db7fad695144834c5f43f
1 <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=15555">bug 15555</a>:
2 XMLHttpRequest does not support charset "x-user-defined", which can facilitate loading of binary data.</p>
3 <script>
4 if (window.testRunner)
5 testRunner.dumpAsText();
7 try {
8 req = new XMLHttpRequest;
9 req.overrideMimeType("text/plain; charset=x-user-defined");
10 req.open("GET", "resources/256.bin", false);
11 req.send();
12 for (var i = 0; i < 128; i++) {
13 var byt = req.responseText.charCodeAt(i);
14 if (byt != i)
15 throw "incorrect byte: " + byt + " (should be " + i + ")";
18 for (var i = 128; i < 256; i++) {
19 var byt = req.responseText.charCodeAt(i);
20 if (byt != i + 0xf700)
21 throw "incorrect byte: " + byt + " (should be " + (i + 0xf700) + ")";
24 document.write("<div>SUCCESS</div>");
26 } catch (ex) {
27 document.write("<div>" + ex + "</div>");
29 </script>