<!DOCTYPE html>
<html>
<head>
<title>Module script tags with crossorigin attribute must load data URLs</title>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
</head>
<body>
<script type="module" src="data:application/javascript;charset=utf-8,window.noCrossOrigin%20%3D%20true%3B"></script>
<script type="module" crossorigin="anonymous" src="data:application/javascript;charset=utf-8,window.anonymous%20%3D%20true%3B"></script>
<script type="module" crossorigin="use-credentials" src="data:application/javascript;charset=utf-8,window.credentials%20%3D%20true%3B"></script>
<script type="module">
import "data:application/javascript;charset=utf-8,window.noCrossOriginImport%20%3D%20true%3B";
</script>
<script type="module" crossorigin="anonymous">
import "data:application/javascript;charset=utf-8,window.anonymousImport%20%3D%20true%3B";
</script>
<script type="module" crossorigin="use-credentials">
import "data:application/javascript;charset=utf-8,window.credentialsImport%20%3D%20true%3B";
</script>
<script>
waitForLoadEvent = new Promise((resolve) => {
    window.onload = resolve;
});

promise_test(() => {
    return waitForLoadEvent.then(() => {
        assert_equals(window.noCrossOrigin, true);
        assert_equals(window.anonymous, true);
        assert_equals(window.credentials, true);
        assert_equals(window.noCrossOriginImport, true);
        assert_equals(window.anonymousImport, true);
        assert_equals(window.credentialsImport, true);
    });
}, 'Module script tags with crossorigin attribute must load data URLs');

</script>
</body>
</html>
