Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(597)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-origin-header-in-isolated-world.html

Issue 2635023003: Fix a bug in origin header generation for CORS preflight in extensions (Closed)
Patch Set: a Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698