summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/resource-timing/resource-timing-failed-fetch.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/resource-timing/resource-timing-failed-fetch.html
parentInitial commit. (diff)
downloadfirefox-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.html34
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