CSS Factories exposed to Worker context - #1177
Conversation
|
|
||
| <xmp class=idl> | ||
| [Exposed=(Window, Worker)] | ||
| partial namespace CSS { |
There was a problem hiding this comment.
This should be [Exposed=(Window, Worker, PaintWorklet, LayoutWorklet)], but also I think a partial with a wider exposure than the namespace itself is not legal in WebIDL so we should fix CSSOM and co too.
There was a problem hiding this comment.
I have realized that this would require a cross-spec PR to change the exposure of the different namespace CSS partial definitions, so that we declared them Window only explicitly. In addition, you have risen the concern of future partial definitions not being ware of the Worker exposure by default.
I'm already working on such PR, as it seems there was some agreement in issue 14229, but perhaps this needs more discussion ? When we merged the PR 61330) for the tests I thought this spec change was easier.
There was a problem hiding this comment.
I have submitted the PR 14245 to fix the CSSOM and co, as requested.
That PR for cssom-1 would make the explicit exposure of the css-typed-on-1 partial definition redundant; even more, if eventually the CSS namespace exposure in cssom-1 is shortened, the css-typed-om-1 declaration won't be compliant with the WebIDL subset-rule about partials.
…ets #14229 The factory functions were [Exposed=(Window, Worker)] while the types they return (CSSUnitValue and friends) are already [Exposed=(Window, Worker, PaintWorklet, LayoutWorklet)], so worklet code could receive a CSSUnitValue from StylePropertyMapReadOnly but could not call CSS.px() to construct one. Match the factories to their return types, and pin the document-side partials to the exposure they have today: * css-paint-api: paintWorklet pinned to [Exposed=Window] * css-layout-api: layoutWorklet pinned to [Exposed=Window] * css-properties-values-api: registerProperty() pinned to [Exposed=Window] Depends on the companion csswg-drafts change widening the base CSS namespace; without it this partial violates WebIDL's partial-exposure subset rule.
5ff80a2 to
686a180
Compare
The CSS namespace is only exposed to Window context. The CSS factories are very convenient to implement tests of CSS TypedOM features that are exposed to Workes.
This PR makes the CSS namespace extension proposed by CSS TypedOM to be exposed to Worker contexts.
It's been discussed in the csswg issue 14229 in the context of allowing partial extensions of the CSS namespace to be exported to contexts different than Window.
The WPT PR 61330 modifies some of the current CSS TypedOM tests so that they are run in Workers, requiring these CSS Factories to be exported to Worker contexts as well.