1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:28:11 +00:00
serenity/Tests/LibWeb/Text/input/video-failed-load.html
Timothy Flynn 2b22402c6a LibWeb: Correctly categorize Fetch responses as network errors
The condition here is flipped. From the spec:

     A network error is a response whose ... body is null ...
2024-01-18 23:10:56 +01:00

35 lines
993 B
HTML

<script src="include.js"></script>
<script type="text/javascript">
const SOURCES = [
"data:",
"file:///i-do-no-exist-i-swear",
"https://i-do-no-exist-i-swear.net.uk",
];
const runTest = source => {
let video = document.createElement("video");
return new Promise((resolve, reject) => {
video.addEventListener("loadedmetadata", () => {
reject(`successfully loaded: "${video.src}"`);
});
video.addEventListener("error", () => {
resolve(`failed to load: "${video.src}"`);
});
video.src = source;
});
};
asyncTest(done => {
let promises = SOURCES.map(source => runTest(source));
Promise.allSettled(promises)
.then(results => {
const values = results.map(result => result.value);
values.sort().forEach(println);
})
.finally(done);
});
</script>