blob: b5d83203eac21eb2dbff010a1d8086cb732d1ab9 [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script>
description("Test that a linked stylesheet with a crossorigin=use-credentials attributes loads expected CORS enabled resources.")
</script>
<script src="resources/link-crossorigin-common.js"></script>
</head>
<body>
<link crossorigin="use-credentials" rel="stylesheet" href="http://localhost:8080/security/resources/green-background-allow-credentials.php?1" onload="pass(event)" onerror="fail(event)">
<link crossorigin="use-credentials" rel="stylesheet" href="http://localhost:8080/security/resources/green-background-allow-star.php?1" onload="fail(event)" onerror="pass(event)">
<script>
function runTest()
{
// Test that dynamically inserted <link> elements are handled the same way.
var link = document.createElement("link");
link.rel = "stylesheet";
link.crossOrigin = "use-credentials";
link.onload = pass;
link.onerror = fail;
link.href = "http://localhost:8080/security/resources/green-background-allow-credentials.php?2";
document.body.appendChild(link);
link = document.createElement("link");
link.rel = "stylesheet";
link.crossOrigin = "use-credentials";
link.onload = fail;
link.onerror = pass;
link.href = "http://localhost:8080/security/resources/green-background-allow-star.php?2";
document.body.appendChild(link);
}
window.onload = runTest;
</script>
</body>
</html>