| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="/js-test-resources/js-test.js"></script> |
| <script> |
| description("Tests that a cross-origin xhr load fails if the server blocks it with a 'From-Origin: same' response header, even though the server includes an Access-Control-Allow-Origin response header."); |
| jsTestIsAsync = true; |
| |
| function transferComplete() { |
| if (xhr.responseText === "xhr") |
| testFailed("Xhr succeeded."); |
| else |
| testFailed("Unknown xhr response: " + xhr.responseText); |
| finishJSTest(); |
| } |
| |
| function transferFailed() { |
| testPassed("Xhr blocked. " + xhr.statusText); |
| finishJSTest(); |
| } |
| |
| var xhr = new XMLHttpRequest(); |
| xhr.addEventListener("load", transferComplete); |
| xhr.addEventListener("error", transferFailed); |
| xhr.open("GET", "http://localhost:8000/from-origin/resources/xhr.php?fromOrigin=same"); |
| xhr.send(); |
| </script> |
| </head> |
| <body> |
| </body> |
| </html> |