04:04 | <kaiido> | Hello, I saw WebIDL2.js, but as far as I can tell it only helps validate a definition, but it doesn't have a feature allowing to pass actual JS arguments to it and see which value they'd get converted to. I would like such a tool because I am considering writing tests against a quite complex WebIDL which can accept an optional Union of unrestricted double, dictionary or a sequence of either or both. For reference this is the definition in question, particularly the radii argument. For instance I'm not sure how a radii like So yeah, if there is a tool somewhere I could use to check all these that would be great, and if there isn't and it may be a good idea to request it somewhere I'd be glad to know where would be the best place: WebIDL repo, or maybe directly WebIDL2.js's one? |
19:55 | <Domenic> | Kaiido: We have a reasonably-complete implementation of this for jsdom, which you could probably make work. It is not optimized for this purpose, e.g. it takes as input files. But I think you could do it. https://www.npmjs.com/package/webidl2js |
19:56 | <Domenic> | The relevant part of the Web IDL spec is the mega-algorithm https://webidl.spec.whatwg.org/#es-overloads |
20:01 | <Domenic> | Despite the name, it also works in the non-overload case, and takes care of all the JS -> Web IDL/infra type conversions. |
20:01 | <Domenic> | Learning how to walk yourself through it might pay off, although I can certainly understand the desire to have a machine-generated walkthrough instead. |