Switching from void to undefined in WebIDL

29 views
Skip to first unread message

Peter Van der Beken

unread,
Sep 21, 2022, 5:08:31 AM9/21/22
to dev-platform
WebIDL used to have a "void" type. It was only allowed as a return type
for methods, and essentially mapped to the "undefined" JS value.
Anything that needed to use "undefined" (along with other values) as a
return value or in the type of an attribute had to use the WebIDL "any"
type, which meant that a lot of detail was lost in the type. So a while
ago WebIDL was changed to have a real "undefined" type, replacing the
"void" type but for example also usable in unions for return values or
attribute types.

It took us a while to implement, but I've just landed the patches in
https://bugzilla.mozilla.org/show_bug.cgi?id=1659158 that switch Gecko's
WebIDL implementation over to the "undefined" type. This makes our
WebIDL files more similar to the WebIDL fragments in specs, and allows
using the type in all the ways that the WebIDL specification allows.
From now on the WebIDL parser will only accept "undefined", and so any
in-flight patches that add new WebIDL fragments might need to be adapted
to use "undefined" instead of "void".

Peter
Reply all
Reply to author
Forward
0 new messages