chromium/third_party/blink/web_tests/http/tests/preload/preload-fetch-mode-mismatch.html

<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<body>
<script>
var t = async_test('Test that XHR (CORS) is not matched with a preload without crossorigin attribute');
var action;

const URL = 'resources/timestamp.php?from=preload-fetch-mode-mismatch.html';

var test = t.step_func(function() {
    var entries = performance.getEntriesByType("resource");
    var resources = 0;
    for (var i = 0; i < entries.length; ++i) {
        if (entries[i].name.indexOf("timestamp") != -1)
            ++resources;
    }
    assert_equals(resources, 2);
    t.done();
});

var loadTimestampWithXHR = t.step_func(function() {
    var xhr = new XMLHttpRequest;
    xhr.withCredentials = true;
    xhr.open("GET", URL);
    xhr.send();
    xhr.onload = t.step_func(function() {
        setTimeout(test, 0);
    });
});

var loadTimestampWithLink = (function() {
    var l = document.createElement('link');
    l.setAttribute('rel', 'preload');
    l.setAttribute('href', URL);
    l.setAttribute('as', 'fetch');
    l.onload = loadTimestampWithXHR;
    document.body.appendChild(l);
});

loadTimestampWithLink();
</script>