Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="/js-test-resources/testharness.js"></script> | |
| 3 <script src="/js-test-resources/testharnessreport.js"></script> | |
| 4 <script> | |
| 5 if (window.testRunner) { | |
| 6 // Testing with "http" scheme than "chrome-extension://" since content_shell | |
| 7 // doesn't register the extension scheme as a web safe isolated scheme. | |
| 8 testRunner.setIsolatedWorldSecurityOrigin(1, 'http://example.com'); | |
| 9 } | |
| 10 | |
| 11 function runTest() { | |
| 12 const xhr = new XMLHttpRequest(); | |
| 13 xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control -origin-header-in-isolated-world.php"); | |
|
yhirano
2017/01/18 05:28:03
Please use double-quotation and quotation consiste
tyoshino (SeeGerritForStatus)
2017/01/18 06:53:42
Done.
| |
| 14 xhr.setRequestHeader("X-Custom-Header", "PASS"); | |
| 15 xhr.onerror = () => { | |
| 16 postMessage('FAIL: XHR errored', '*'); | |
| 17 }; | |
| 18 xhr.onload = () => { | |
| 19 postMessage(xhr.responseText, '*'); | |
| 20 }; | |
| 21 xhr.send(); | |
| 22 } | |
| 23 | |
| 24 async_test(t => { | |
| 25 addEventListener('message', t.step_func(event => { | |
| 26 assert_equals(event.data, 'PASS'); | |
| 27 t.done(); | |
| 28 })); | |
| 29 testRunner.evaluateScriptInIsolatedWorld(1, String(eval('runTest')) + '\nrunTe st();'); | |
| 30 }, 'The Origin header contains the origin of the isolated world where the script is running'); | |
| 31 | |
| 32 done(); | |
| 33 </script> | |
| OLD | NEW |