[css-paint-api] IDL for PaintWorkletGlobalScope is invalid
Opened this issue · 3 comments
Related to #907
web-platform-tests/wpt#17551 introduces a test to catch this case, which causes /css/css-paint-api/idlharness.html
in WPT to regress, e.g.
https://wpt.fyi/results/css/css-paint-api/idlharness.html?diff&filter=ADC&run_id=251400002&run_id=261060002
As far as I can tell and based on the follow up discussion in #907 the current PaintWorklet definition is correct.
[Exposed=Worklet]
interface WorkletGlobalScope {};
[Global=(Worklet,PaintWorklet),Exposed=PaintWorklet]
interface PaintWorkletGlobalScope : WorkletGlobalScope {}
This is because "Global" affects exposure sets which is what happens is these particular cases. See @tabatkins comment for more detail
You may want to adjust the idlharness test to make sure it does take this into account.
I think my confusion lies in the way that Worklet
is used in idlharness; for Worker
, it actually expands out into DedicatedWorker
, ServiceWorker
, etc.
@tabatkins Should we be doing the same thing with Worklet
? Seems like the idlharness has a hard-coded list of the globals that are aliasing as Worker
, which isn't very flexible, but I'm not sure how we would dynamically produce a list.
Yes, it looks like this is a problem in the harness, where it's not using sufficient global knowledge to understand that PaintWorklet is a subset of Worklet.
The current structure of the Global
attribute is... weird for its requirements. I think the correct way to tell is to globally collect all the things that advertise Global=PaintWorklet
and all the things that advertise Global=Worklet
, verify that the first is a subset of the second, and thus conclude that Exposed=PaintWorklet
on a subclass is valid when the superclass is Exposed=Worklet
.
(A better structure would probably be to have a more explicit "subclassing" of global names, so that you could declare, say, [Global=Worklet:Paint]
and automatically be targeted by Exposed=Worklet
and Exposed=Worklet:Paint
, without having to do this global collection/intersection/etc. Different issue tho.)