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

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: 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 side-by-side diff with in-line comments
Download patch
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..0e6f4bb0fc11e4b10942026647fa37a6cdc7a170
--- /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");
yhirano 2017/01/18 05:28:03 Please use double-quotation and quotation consiste
tyoshino (SeeGerritForStatus) 2017/01/18 06:53:42 Done.
+ 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>

Powered by Google App Engine
This is Rietveld 408576698