Commit 43d9c3bb authored by Yutaka Hirano's avatar Yutaka Hirano Committed by Commit Bot

Split suborigin-cors-xhr-failure-output.php into two

async_test can be executed out of order, which leads to flaky console
output. This CL splits the file to avoid the issue.

Bug: 705125
Change-Id: I3dda81b84e05a6c50e786030d1a883e085fb80a0
Reviewed-on: https://chromium-review.googlesource.com/677165Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504337}
parent aa9d1da9
......@@ -1584,7 +1584,6 @@ crbug.com/667560 virtual/mojo-loading/http/tests/devtools/editor/text-editor-sea
# These tests have test harness errors and PASS lines that have a
# non-deterministic order.
crbug.com/705125 fast/mediacapturefromelement/CanvasCaptureMediaStream-capture-out-of-DOM-element.html [ Failure ]
crbug.com/705125 virtual/mojo-loading/http/tests/security/suborigins/crossorigin/suborigin-cors-xhr-failure-output.php [ Failure Pass ]
# Skip the non-virtualized CORS-RFC1918 tests:
crbug.com/763830 http/tests/security/cors-rfc1918/ [ Skip ]
......
CONSOLE ERROR: Failed to load http://127.0.0.1:8000/security/resources/cors-script.php?cors=false&with-preflight: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http-so://foobar.127.0.0.1:8000' is therefore not allowed access.
This is a testharness.js-based test.
PASS Custom headers causes preflight failure
Harness: the test ran to completion.
<?php
header("Suborigin: foobar");
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>XHRs from suborigins require responses with valid Access-Control-Allow-Suborigin header</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
async_test(t => {
var xhr = new XMLHttpRequest();
xhr.onerror = t.step_func_done();
xhr.onload = t.unreached_func('XHR succeeded');
// with-preflight is attached to distinguish console error outputs.
xhr.open('GET', 'http://127.0.0.1:8000/security/resources/' +
'cors-script.php?cors=false&with-preflight');
xhr.setRequestHeader('x-custom-header', 'foobar');
xhr.send();
}, 'Custom headers causes preflight failure');
</script>
</body>
</html>
CONSOLE ERROR: Failed to load http://127.0.0.1:8000/security/resources/cors-script.php?cors=false&with-preflight: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http-so://foobar.127.0.0.1:8000' is therefore not allowed access.
CONSOLE ERROR: Failed to load http://127.0.0.1:8000/security/resources/cors-script.php?cors=false&without-preflight: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http-so://foobar.127.0.0.1:8000' is therefore not allowed access.
This is a testharness.js-based test.
PASS Custom headers causes preflight failure
PASS Lack of Access-Control-Allow-Suborigin on response causes failure
Harness: the test ran to completion.
......@@ -11,17 +11,6 @@ header("Suborigin: foobar");
</head>
<body>
<script>
async_test(t => {
var xhr = new XMLHttpRequest();
xhr.onerror = t.step_func_done();
xhr.onload = t.unreached_func('XHR succeeded');
// with-preflight is attached to distinguish console error outputs.
xhr.open('GET', 'http://127.0.0.1:8000/security/resources/' +
'cors-script.php?cors=false&with-preflight');
xhr.setRequestHeader('x-custom-header', 'foobar');
xhr.send();
}, 'Custom headers causes preflight failure');
async_test(t => {
var xhr = new XMLHttpRequest();
xhr.onerror = t.step_func_done();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment