Automatic update from web-platform-tests Add tests for text modules This is to support the spec changes in: - https://github.com/tc39/proposal-import-text - https://github.com/whatwg/html/pull/11933 - https://github.com/whatwg/fetch/pull/1898 - https://github.com/w3c/webappsec-csp/pull/794 -- wpt-commits: 5419f98d72f4b1ae49980581a6a66710d6a3dee7 wpt-pr: 56812
26 lines
830 B
HTML
26 lines
830 B
HTML
<!doctype html>
|
|
<meta charset=utf-8>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<body>
|
|
<script>
|
|
function attachAndWaitForLoad(element) {
|
|
return new Promise((resolve, reject) => {
|
|
element.onload = resolve;
|
|
element.onerror = reject;
|
|
document.body.appendChild(element);
|
|
});
|
|
}
|
|
|
|
promise_test(function(t) {
|
|
const link = document.createElement('link');
|
|
link.rel = 'modulepreload';
|
|
link.as = 'text';
|
|
link.href = 'resources/dummy.txt';
|
|
return attachAndWaitForLoad(link).then(() => {
|
|
const absoluteURL = new URL(link.href, location.href).href;
|
|
assert_equals(performance.getEntriesByName(absoluteURL).length, 1, absoluteURL);
|
|
});
|
|
}, 'link rel=modulepreload with as=text should preload text module');
|
|
</script>
|