https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 97f459900c52d3a0b66180001c8a6ec5275ee851 authored by Josh Matthews on 26 March 2018, 14:23:24 UTC
Add base protocol to ConnectionlessProtocol.
Tip revision: 97f4599
sibling-painting-first-image.html
<!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>
async_test(function (t) {
    let paintingIframeHasDispatchedEntries = false;
    window.addEventListener('message', t.step_func(e => {
        if (!paintingIframeHasDispatchedEntries) {
            // Check paint-timing entries from the painting iframe.
            assert_equals(e.data, '2 paint first-paint paint first-contentful-paint');
            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>
back to top