Bug 240779

Summary: [compat] loadededdata event should be fired once the current frame has been displayed.
Product: WebKit Reporter: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ap, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=240780

Description Jean-Yves Avenard [:jya] 2022-05-22 17:55:08 PDT
similar to bug 236755.

Consider the following code:

```
    function loadeddata()
    {
        if (!modified) {
            canvas = document.createElement("canvas");
            canvas.width = 2.5 * video.videoWidth;
            canvas.height = 2.5 * video.videoHeight;
            document.body.appendChild(canvas);

            context = canvas.getContext("2d");
            context.fillStyle = context.createPattern(video, "repeat");

            video.src = findMediaFile("video", "../../media/content/counting");
            modified = !modified;
        } else {
            context.fillRect(0, 0, canvas.width, canvas.height);

            expectedResults.forEach(function(element) {
                checkPixels(context, element[0], element[1], element[2], element[3], element[4], videoCanvasPixelComparisonTolerance());
            });

            finishJSTest();
        }
    }
```
(from LayoutTests/fast/canvas/canvas-createPattern-video-modify.html)

This waits for the loadeddata event to read the canvas. However it will intermittently read black because the frame hasn't been painted.

Loadeddata should be fired only once a frame has been painted.
Comment 1 Radar WebKit Bug Importer 2022-05-22 17:55:30 PDT
<rdar://problem/93731741>