1
0
Fork 0
firefox/dom/serviceworkers/test/performance/time_fetch.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

38 lines
664 B
HTML

<!DOCTYPE HTML>
<html>
<head>
<script>
"use strict";
async function time_fetch(url) {
let start = performance.now();
let res = await fetch(url);
let elapsed = performance.now() - start;
return {
elapsed_ms : elapsed,
status : res.status,
data : await res.text()
};
}
async function time_xhr(url) {
let xhr = new XMLHttpRequest();
xhr.open("GET", url, false);
let start = performance.now();
xhr.send();
let elapsed = performance.now() - start;
return {
elapsed_ms : elapsed,
status : xhr.status,
data : xhr.responseText
}
}
</script>
</head>
<body>
</body>
</html>