Bug 240779 - [compat] loadededdata event should be fired once the current frame has been displayed.
Summary: [compat] loadededdata event should be fired once the current frame has been d...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-05-22 17:55 PDT by Jean-Yves Avenard [:jya]
Modified: 2022-05-23 20:11 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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>