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

Unified 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: Rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-origin-header-in-isolated-world.php » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-origin-header-in-isolated-world.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-origin-header-in-isolated-world.html b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-origin-header-in-isolated-world.html
new file mode 100644
index 0000000000000000000000000000000000000000..65904723fb01096436048a230e7630cd8b52a15c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/access-control-origin-header-in-isolated-world.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<script src="/js-test-resources/testharness.js"></script>
+<script src="/js-test-resources/testharnessreport.js"></script>
+<script>
+if (window.testRunner) {
+ // Testing with "http" scheme than "chrome-extension://" since content_shell
+ // doesn't register the extension scheme as a web safe isolated scheme.
+ testRunner.setIsolatedWorldSecurityOrigin(1, 'http://example.com');
+}
+
+function runTest() {
+ const xhr = new XMLHttpRequest();
+ xhr.open('GET', 'http://localhost:8000/xmlhttprequest/resources/access-control-origin-header-in-isolated-world.php');
+ xhr.setRequestHeader('X-Custom-Header', 'PASS');
+ xhr.onerror = () => {
+ postMessage('FAIL: XHR errored', '*');
+ };
+ xhr.onload = () => {
+ postMessage(xhr.responseText, '*');
+ };
+ xhr.send();
+}
+
+async_test(t => {
+ addEventListener('message', t.step_func(event => {
+ assert_equals(event.data, 'PASS');
+ t.done();
+ }));
+ testRunner.evaluateScriptInIsolatedWorld(1, String(eval('runTest')) + '\nrunTest();');
+}, 'The Origin header contains the origin of the isolated world where the script is running');
+
+done();
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/resources/access-control-origin-header-in-isolated-world.php » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698