-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tag everything with worker support? #7849
Comments
You're right that we ought to be more consistent about this. A couple thoughts on how we might do this: First, I suppose we should have a worker support entry for things which have been specified as having worker support (stuff with Second, when documenting worker support, we should use the |
https://github.com/foolip/mdn-bcd-collector does test for support in workers, but the scripts don't yet update the One problem we'll have here is with global methods like We'd also need to figure out a way to represent that an interface is exposed in workers, but that certain of its members are not. This is rare, but happens, for example with I suspect this issue may also interest @saschanaz. |
Yes! The TypeScript types generator currently only depends on Web IDL [Exposed] attribute regardless of the real situation, but a general |
Thanks all. So I guess first thing to do is fix the known broken ones. Started that in #8014. Already a bit stuck with the right way to show that some things are supported in different types of workers in different versions. I simply don't understand BCD well enough to know the right way to do do this yet.
That means that we'll have to tag everything and let people know they have to check every feature to be sure if it is implemented - right? With respect to scopes we perhaps don't need to go to specific class since any global worker context is access by Thoughts? |
I think there are less than 20 cases of this on the web platform, so while it needs to be handled, we should probably do it in a way that doesn't make all features look complicated to consumers. One way would be to say that
Things are defined on a global scope (Window or *GlobalScope interfaces) don't really need I was thinking a few steps into the future with changes I'd like to see:
|
OK, now I have to cop to not knowing very much about workers. Can someone point me toward something that explains the different workers? This has me wondering what our current
Maybe we could bless certain features as inherited, then actually cascade them down the tree as part of a compilation step unless a feature already has its own worker-support feature (that is, more specific data would overrule inherited data). Then consumers wouldn't have to learn resolve an inheritance on their own. |
@ddbeck
Chrome workers are FF only.
I don't know, but my feeling is "probably". |
FYI Added #8783 to sort out CacheStorage |
FYI Added #8784 for PushManager. |
After #11518 we have a bit of a mixed situation in the api/_globals/ folder. Most entries have a "worker_support" entry, except scheduler.json. But for the most part the subfeatures just have the same data, and any differences are just mistakes. I prepared a PR (#17260) to remove subfeatures that I think don't add any information, but then remembered this issue. So what should we do, always add the subfeature, or only when it adds information? |
@foolip I think you are saying if that any subfeature has matching information to the parent then it should not be documented. That would imply that if a function of an interface was introduced at the same time, you wouldn't document it. Which I would find annoying because then I'd have no link for the spec, and I think I'd probably assume it was an omission. That might indeed be "what we do" :-( To me the subfeature does add information - once you remove this there is nothing on the page to tell a user that (say) Assuming I do understand the point, I see this as a little like tagging for secure process. IMO that would be best done following the IDL. Mostly because it makes absolutely clear how things work and requires no thinking from anyone. |
@hamishwillee that isn't quite what I mean, no. Worker support should definitely be documented, on MDN. I think about this similarly to Worker support is bit different because it's been so common that worker support came later in the past. It hasn't been as common lately though, and I'd be surprised if this trend reversed. |
@foolip Ah, thanks. So "yes" to all you said. Your PR is correct. Workers are currently treated the same way as everything else in BCD. As you say, they should only get a worker subfeature if support in workers appeared at a different release than the feature (in one or more browser). That said, the root problem still exists - we need to properly document when things are supported by workers, and that needs to match the IDL. But the summary of this thread should probably should be "the place worker support info comes form is not BCD". Should we close this issue and reopen on the mdn or yari repo? My thinking is that it would be ideal if yari could get the information direct from IDL on a regular basis and automatically add a worker support note based on that data. If not, if we could have a page metadata for it and tooling to match up IDL and docs on a regular basis. |
@hamishwillee right, that information should come from https://www.npmjs.com/package/@webref/idl, I'd say. But I think we still need to update https://github.com/mdn/browser-compat-data/blob/main/docs/data-guidelines.md#web-workers-worker_support to say when the subfeature should be added and not. |
@foolip I did a first shot at updating the data guidelines in #17352 I did it generally rather than specific to worker support, because that was missing. The example I used was a bit irritating because it does not comply with the rules we have discussed here. So I think we need confirmation of that PR before we close this one. EDIT. Actually the guidelines are not clear.
|
Actually, I have been using the term "subfeature" to refer to any JSON node below a top-level feature as well. 🙃 I also use the term "behavioral subfeature" for behaviors, options, etc. -- they're not good terms and I'd love to find better ones! (P.S. @hamishwillee, you referred to me as a "he", not a "she" -- I changed your above comment to fix the pronouns!) |
Thanks so much. Sorry about that. Don't know what was going through my head way back then. I understand how this works now at least, which is nice. |
Worker support of APIs is quite a challenge to track and maintain docs for - it can vary across an API and be spotty across browsers. It also isn't necessarily obvious to a user how they go about using some APIs.
I think it might make sense to "standardise" this in BCD and roll it out more or less for every single Web API.
There are a few good examples where this has been done in an adhoc way:
FileReaderSync
([mdn]((https://developer.mozilla.org/en-US/docs/Web/API/FileReaderSync) | bcd) has separate keys indicating support for service workers and for other workers.CacheStorage
(mdn) has a note indicating how it is used in both web workers and main thread.FYI @chrisdavidmills @Elchi3 @ddbeck Would appreciate your thinking on this. To me this is a similar problem to documenting secure contexts.
The text was updated successfully, but these errors were encountered: