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/paint-timing/with-first-paint/sibling-painting-first-image.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/paint-timing/with-first-paint/sibling-painting-first-image.html')
-rw-r--r-- | testing/web-platform/tests/paint-timing/with-first-paint/sibling-painting-first-image.html | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/testing/web-platform/tests/paint-timing/with-first-paint/sibling-painting-first-image.html b/testing/web-platform/tests/paint-timing/with-first-paint/sibling-painting-first-image.html new file mode 100644 index 0000000000..d393795e2d --- /dev/null +++ b/testing/web-platform/tests/paint-timing/with-first-paint/sibling-painting-first-image.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + <!-- This iframe will have a sibling that paints, we want to ensure it does not detect that paint. --> +<iframe id="listening-iframe" src="../resources/subframe-sending-paint.html"></iframe> +<script> +setup({"hide_test_state": true}); +var entriesExpectToReceive = [ + { + 'entryType': 'paint', + 'name': 'first-paint' + }, + { + 'entryType': 'paint', + 'name': 'first-contentful-paint' + } +]; +async_test(function (t) { + assert_implements(window.PerformancePaintTiming, "Paint Timing isn't supported."); + let paintingIframeHasDispatchedEntries = false; + window.addEventListener('message', t.step_func(e => { + if (!paintingIframeHasDispatchedEntries) { + // Check paint-timing entries from the painting iframe. + for (let i = 0; i < entriesExpectToReceive.length; i++) { + if (entriesExpectToReceive[i].entryType == e.data.entryType && + entriesExpectToReceive[i].name == e.data.name) { + entriesExpectToReceive.splice(i, 1); + break; + } + } + if (entriesExpectToReceive.length == 0) { + paintingIframeHasDispatchedEntries = true; + // Ask the listening iframe to send its paint-timing entries. + document.getElementById('listening-iframe'). + contentWindow.postMessage('', '*'); + } + return; + } + // Check the paint-timing entries from the listening iframe. + assert_equals(e.data, '0'); + // Check that current frame receives first-paint but not first-contentful-paint. + const bufferedEntries = performance.getEntriesByType('paint'); + assert_equals(bufferedEntries.length, 1); + assert_equals(bufferedEntries[0].entryType, 'paint'); + assert_equals(bufferedEntries[0].name, 'first-paint'); + t.done(); + })); +}, 'Frame ignores paint-timing events fired from sibling frame.'); +</script> +<!-- This iframe is where all of the painting occurs. --> +<iframe id="painting-iframe" src="../resources/subframe-painting.html"></iframe> +</body> +</html> |