FYI: New Fwd headers for Web IDL is there

244 views
Skip to first unread message

Kagami Rosylight

unread,
Jul 31, 2025, 1:06:37 PMJul 31
to dev-pl...@mozilla.org
As of bug 1957934 (30 April 2025, yes it's late...) we got new autogenerated forward declarations headers. From now on if you have an interface or dictionary like:

// foo.webidl
interface Foo {};
dictionary FooDict {};

Then you get forward declaration for Foo and FooDict in mozilla/dom/FooFwd.h.

And with typedefs:

// bar.webidl
typedef (Baz or Waz) BarUnion;

You get an alias named BarUnion in BarFwd.h instead of having to call it BarOrWaz.

Questions welcome, and happy software engineering.

(Thank you for the ping to post an actual announcement, unfortunately I lost the original notification that pinged me and don't remember who did it...)

Gabriele Svelto

unread,
Aug 1, 2025, 8:44:15 AMAug 1
to Kagami Rosylight, dev-pl...@mozilla.org
On 31/07/2025 19:06, 'Kagami Rosylight' via dev-pl...@mozilla.org wrote:
> As of bug 1957934 <https://bugzilla.mozilla.org/show_bug.cgi?
> id=1957934> (30 April 2025, yes it's late...) we got new autogenerated
> forward declarations headers. From now on if you have an interface or
> dictionary like:
>
> // foo.webidl
> interface Foo {};
> dictionary FooDict {};
>
> Then you get forward declaration for Foo and FooDict in mozilla/dom/
> FooFwd.h.

this is great! I take this opportunity to remind everybody that we have
an `includehell` [1] bug where we gather all bugs about minimizing
unnecessary header inclusions. If you're touching code pulling in lots
of headers consider checking if you can prune some stuff or replace them
with forward declarations, the compilation time benefits are worth it.

Gabriele

[1] [Meta] Fix Gecko's #include dependencies
https://bugzilla.mozilla.org/show_bug.cgi?id=includehell
OpenPGP_0x763A5AD66BC5A398_and_old_rev.asc
OpenPGP_signature.asc

Tom Ritter

unread,
Aug 1, 2025, 9:25:15 AMAug 1
to Gabriele Svelto, Kagami Rosylight, dev-pl...@mozilla.org
On the topic of compile time speedups, a long time ago we got a nice boost in 1443252 [0] by marking some central classes `final`. (Meta is 1332680 [1]) 

gcc supports the -Wsuggest-final-types but I don't think LLVM does - so if anyone happens to have a kind-of-working gcc build of Firefox, you could try this warning and see what it spits out today.


--
You received this message because you are subscribed to the Google Groups "dev-pl...@mozilla.org" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dev-platform...@mozilla.org.
To view this discussion visit https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/60849b36-f873-4581-ad8e-5744b234682d%40mozilla.com.
Reply all
Reply to author
Forward
0 new messages