Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / response-json-not-affected-by-substitution.html
blob62ae9a90b0b8ac43718cd971e749e358f95f8aaf
1 <html>
2 <body>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script>
7 var test = async_test("Test setting the JSON object to undefined doesn't break XMLHttpRequest for responseType='json'.");
8 test.step(function() {
9 assert_equals("hello", window.JSON.parse('"hello"'));
10 window.JSON = undefined;
12 var xhr = new XMLHttpRequest;
13 xhr.responseType = 'json';
14 xhr.open('GET', 'resources/test.json', true);
15 xhr.onreadystatechange = test.step_func(function() {
16 if (xhr.readyState != 4)
17 return;
19 assert_equals(xhr.status, 200, 'xhr.status');
21 assert_equals(xhr.response.length, 4, 'xhr.response.length')
22 assert_equals(xhr.response[0], 'a', 'xhr.response[0]');
24 test.done();
25 });
26 xhr.send();
27 });
29 </script>
30 </body>
31 </html>