Reftest screenshots can miss frames presented over ImageBridge, such as OffscreenCanvas frames
Categories
(Core :: Graphics, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | fixed |
People
(Reporter: aosmond, Assigned: aosmond)
References
(Blocks 1 open bug)
Details
Attachments
(1 external file)
The reftest and WPT reftest harnesses call nsIDOMWindowUtils.updateLayerTree() in the content process before the parent takes the screenshot with drawWindow(..., DRAWWINDOW_USE_WIDGET_LAYERS). updateLayerTree paints and waits for the layer transaction to be processed, but frames presented over ImageBridge are not part of that transaction:
- an OffscreenCanvas frame, from a DOM worker or from the main thread, is handed to the content process ImageBridge thread by
ImageBridgeChild::UpdateCompositableand sent on the PImageBridge channel; - video frames go through the same path (
VideoFrameContaineruses an asynchronousImageContainer).
If the ImageBridge thread has not sent the update yet when the harness flushes, the screenshot is taken without the frame and the canvas or video is missing.
This shows up as intermittent failures of WPT reftests that draw to a transferControlToOffscreen() canvas right before finishing, for example /html/canvas/offscreen/manual/text/canvas.2d.offscreen.transferred.lang.html and its inherit variants on Android, where the emulator is slow enough for the ImageBridge thread to fall behind. Adding a 300 ms delay before the ImageBridge send in ImageBridgeChild::UpdateCompositable reproduces it every time on an Android emulator: the canvases are missing (maximum difference 255).
Proposed fix: call ImageBridgeChild::WaitFlushTasks() in nsDOMWindowUtils::UpdateLayerTree before painting. The ImageBridge updates are then sent before the layer transaction that updateLayerTree waits on. With that change and the same delay, the canvases are drawn. It adds no IPC and only affects callers of updateLayerTree, which are test harnesses.
It does not close every gap: the ImageBridge update and the layer transaction travel on different channels, so the compositor could in principle still handle them out of order, and an OffscreenCanvas commit that has not run yet on the main thread is not flushed.
| Assignee | ||
Comment 1•4 days ago
|
||
Frames presented through ImageBridge, such as those of an OffscreenCanvas or a
video, are not part of the layer transaction, so a compositor snapshot taken
after updateLayerTree could miss them.
Comment 3•4 days ago
|
||
| bugherder | ||
Description
•