blob: e401ca7f2c2bd190d107a1e1c6663f4ae1185fe7 [file] [log] [blame]
<!DOCTYPE html>
<!-- Regression test for https://crbug.com/464876. On a CORS failure, multiple
error messages should not be logged, even if preload occurs. -->
<head>
</head>
<script src="/js-test-resources/js-test.js"></script>
<script>
window.jsTestIsAsync = true;
description('Preload of script with CORS failure only shows one error');
var result = "PASS";
var scriptLoad = function() {
testFailed('Script loaded.');
};
var scriptError = function() {
if (result === 'PASS')
testPassed('Script error.');
else
testFailed('Script ran.');
finishJSTest();
};
var checkForPreload = function(url) {
if (internals.isPreloaded(url))
testPassed("Did preload.");
};
</script>
<!-- Force a preload -->
<script src="http://127.0.0.1:8000/resources/slow-script.pl?delay=100"></script>
<script>
checkForPreload("http://localhost:8000/security/resources/cors-script.php?delay=100&cors=false&value=FAIL");
</script>
<script crossorigin="anonymous" src="http://localhost:8000/security/resources/cors-script.php?delay=100&cors=false&value=FAIL" onload="scriptLoad()" onerror="scriptError();"></script>