| <html> |
| <body> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script> |
| |
| var test = async_test("Test setting the JSON object to undefined doesn't break XMLHttpRequest for responseType='json'."); |
| test.step(function() { |
| assert_equals("hello", window.JSON.parse('"hello"')); |
| window.JSON = undefined; |
| |
| var xhr = new XMLHttpRequest; |
| xhr.responseType = 'json'; |
| xhr.open('GET', 'resources/test.json', true); |
| xhr.onreadystatechange = test.step_func(function() { |
| if (xhr.readyState != 4) |
| return; |
| |
| assert_equals(xhr.status, 200, 'xhr.status'); |
| |
| assert_equals(xhr.response.length, 4, 'xhr.response.length') |
| assert_equals(xhr.response[0], 'a', 'xhr.response[0]'); |
| |
| test.done(); |
| }); |
| xhr.send(); |
| }); |
| |
| </script> |
| </body> |
| </html> |