diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/event-timing/buffered-flag.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/event-timing/buffered-flag.html')
-rw-r--r-- | testing/web-platform/tests/event-timing/buffered-flag.html | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/testing/web-platform/tests/event-timing/buffered-flag.html b/testing/web-platform/tests/event-timing/buffered-flag.html new file mode 100644 index 0000000000..7ee152be93 --- /dev/null +++ b/testing/web-platform/tests/event-timing/buffered-flag.html @@ -0,0 +1,46 @@ +<!DOCTYPE html> +<html> +<meta charset=utf-8 /> +<title>Event Timing: PerformanceObserver sees entries with buffered flag</title> +<button id='button'>Generate a 'click' event</button> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=/resources/testdriver.js></script> +<script src=/resources/testdriver-vendor.js></script> +<script src=resources/event-timing-test-utils.js></script> +<script> + let firstInputSeen = false; + let eventSeen = false; + async_test(t => { + assert_implements(window.PerformanceEventTiming, 'Event Timing is not supported.'); + const validateEntry = t.step_func(entry => { + if (entry.entryType === 'first-input') + firstInputSeen = true; + else if (entry.entryType === 'event') + eventSeen = true; + else + assert_unreached('Should only observe Event Timing entries!'); + }); + // First observer creates second in callback to ensure the entry has been dispatched by the time + // the second observer begins observing. + new PerformanceObserver((list, obs) => { + list.getEntries().forEach(validateEntry); + if (!firstInputSeen || !eventSeen) + return; + + obs.disconnect(); + firstInputSeen = false; + eventSeen = false; + // Second observer requires 'buffered: true' to see entries. + const bufferedObserver = new PerformanceObserver(entryList => { + entryList.getEntries().forEach(validateEntry); + if (firstInputSeen && eventSeen) + t.done(); + }); + bufferedObserver.observe({type: "event", buffered: true}); + bufferedObserver.observe({type: 'first-input', buffered: true}); + }).observe({entryTypes: ['event', 'first-input']}); + clickAndBlockMain('button'); + }, "PerformanceObserver with buffered flag sees previous Event Timing entries"); +</script> +</html> |