Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / cross-origin-preflight-get.html
blob7a026c3c2bef6dfe047f5a78c5a725c67594386e
1 <html>
2 <body>
3 <p>The "Origin" header must be sent with a "non-simple" cross-origin resource sharing request that uses the GET method.</p>
4 <pre id="console"></pre>
5 <script>
6 if (window.testRunner) {
7 testRunner.dumpAsText();
8 testRunner.waitUntilDone();
11 function log(message)
13 document.getElementById('console').appendChild(document.createTextNode(message + '\n'));
17 function test()
19 var xhr = new XMLHttpRequest();
20 xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/cross-origin-preflight-get.php", true);
21 // Make this a "non-simple" cross-origin request by adding a custom header.
22 xhr.setRequestHeader("X-Proprietary-Header", "foo");
23 xhr.onerror = function() { log("onerror") }
24 xhr.onload = function() {
25 log(xhr.responseText);
26 if (window.testRunner)
27 testRunner.notifyDone();
29 xhr.send(null);
32 test();
33 </script>
34 </body>
35 </html>