diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/resource-timing/resource-timing-failed-fetch.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/resource-timing/resource-timing-failed-fetch.html')
-rw-r--r-- | testing/web-platform/tests/resource-timing/resource-timing-failed-fetch.html | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/testing/web-platform/tests/resource-timing/resource-timing-failed-fetch.html b/testing/web-platform/tests/resource-timing/resource-timing-failed-fetch.html new file mode 100644 index 0000000000..5bab39e276 --- /dev/null +++ b/testing/web-platform/tests/resource-timing/resource-timing-failed-fetch.html @@ -0,0 +1,34 @@ +<!doctype html> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<link rel="stylesheet" href="resources/empty_style.css"> +<link rel="stylesheet" href="resources/non_exist.css"> + +<script> + promise_test(async () => { + const css_resource_timing_entries = await new Promise(resolve => { + new PerformanceObserver((list, observer) => { + let css_resource_timing_entries = list.getEntries().filter(e => e.name.includes('css')); + if (css_resource_timing_entries.length >= 2) { + resolve(css_resource_timing_entries); + } + }).observe({ 'type': 'resource', 'buffered': true }); + }); + + assert_equals(css_resource_timing_entries.length, 2, + 'There should be two resource timing entries for css resources'); + + assert_equals(css_resource_timing_entries.filter( + e => e.name.includes('empty_style.css')).length, 1, + 'There should be one resource timing entry for successfully fetched resource.'); + + assert_equals(css_resource_timing_entries.filter( + e => e.name.includes('non_exist.css')).length, 1, + 'There should be one resource timing entry for fetching failed resource.'); + + }, 'Resource fetched by HTTP protocol should have resource timing entry emitted, \ + even when the fetch failed.'); +</script> + +</html>
\ No newline at end of file |