mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:28:11 +00:00

The condition here is flipped. From the spec: A network error is a response whose ... body is null ...
35 lines
993 B
HTML
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>
|