| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script> |
| description('This tests that the XMLHttpRequest responseType attribute is not modifiable for synchronous HTTP(S) requests.'); |
| var xhr; |
| |
| // HTTP |
| xhr = new XMLHttpRequest(); |
| xhr.open('GET', 'http://mydomain/', false); |
| shouldThrow("xhr.responseType = 'document';"); |
| |
| // HTTPS |
| xhr = new XMLHttpRequest(); |
| xhr.open('GET', 'https://mysecuredomain/', false); |
| shouldThrow("xhr.responseType = 'document';"); |
| |
| // FILE |
| shouldBeEqualToString('window.location.protocol', 'file:'); |
| xhr = new XMLHttpRequest(); |
| xhr.open('GET', window.location.href, false); |
| evalAndLog("xhr.responseType = 'document';"); |
| shouldBeEqualToString('xhr.responseType', 'document'); |
| |
| // DATA |
| var dataUrl = 'data:text/html;charset=utf-8,%3C%21DOCTYPE%20' + |
| 'html%3E%0D%0A%3Chtml%20lang%3D%22en%22%3E%0D%0A%3Chead%' + |
| '3E%3Ctitle%3EEmbedded%20Window%3C%2Ftitle%3E%3C%2Fhead%' + |
| '3E%0D%0A%3Cbody%3E%3Ch1%3E42%3C%2Fh1%3E%3C%2Fbody%3E%0A' + |
| '%3C%2Fhtml%3E%0A%0D%0A'; |
| xhr = new XMLHttpRequest(); |
| xhr.open('GET', dataUrl, false); |
| evalAndLog("xhr.responseType = 'document';"); |
| shouldBeEqualToString('xhr.responseType', 'document'); |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </head> |
| <body> |
| <div id="description"></div> |
| <div id="console"></div> |
| </body> |
| </html> |