2 <script src="/js-test-resources/js-test.js"></script>
4 description("Testing the handling of CORS-enabled <script> fetch in the presence of 'No CORS' redirects.");
6 // Explain the short form descriptions ('=>' representing the redirect.)
7 debug("PASS/FAIL descriptions are of the form, 'CORS request type': 'redirect CORS type' => 'resource'");
10 var redirect_cors = "no";
12 window.jsTestIsAsync = true;
13 if (window.testRunner)
14 testRunner.dumpAsText();
17 if (window.testRunner)
22 debug("FAIL: " + this.description);
27 debug("PASS: " + this.description);
31 // All redirects are non-CORS, no fetches expected to complete.
33 { description: "Anonymous request: no-CORS => no-CORS script resource.",
34 url: "http://localhost:8000/security/resources/localScript.js",
37 { description: "Anonymous request: no-CORS => anonymous-CORS script resource.",
38 url: "http://localhost:8000/security/resources/script-allow-star.php",
41 { description: "Credentialled request: no-CORS => credential-CORS script resource (same origin.)",
42 url: "http://localhost:8000/security/resources/script-allow-credentials.php",
44 access: "use-credentials"},
45 { description: "Credentialled request: no-CORS => credential-CORS script resource (cross origin.)",
46 url: "http://127.0.0.1:8000/security/resources/script-allow-credentials.php",
48 access: "use-credentials"},
51 function runNextTest() {
56 var test = tests.shift();
57 var script = document.createElement("script");
58 script.onload = test.success ? pass : fail;
59 script.onerror = test.success ? fail : pass;
60 script.crossOrigin = test.access;
61 script.description = test.description;
62 var args = [ "mode=" + redirect_cors,
64 script.src = "http://localhost:8000/security/resources/cors-redirect.php?" + args.join("&");
65 document.body.appendChild(script);
67 window.onload = runNextTest;