You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Modularity: Feature-gate more functionality #47183
As part of allowing embedders to customize servo and strip out parts that they don't need, there are still some obvious candidates left in servo (that a browser wants), that not every embedder needs.
This is sort of tracking issue for what can still be feature-gated.
Implementation wise in WebIDL we can use skip-unless CARGO_FEATURE_<Name>, see e.g. bluetooth or webgpu for examples.
I am a big fan of splitting things up more to make it modular. One concern I have: how are we going to ensure everything keeps on building. For example, if we start scattering around feature-flags, it is relatively easy to miss a case where it should have been added and then it no longer builds.
Should we maybe have some common configurations of feature flags? One with none of it turned on, one with all and then some ones that make sense based on existing embedder usages?
Common combinations (e.g. the harmonyOS CI build validates a --no-default-features + tracing + tracing-hitrace build).
Other combinations would be on a best-effort basis. In practice most features are expected to be quite orthogonal, and with a bit of hygiene (instead of cfg-gating imports, use fully qualified paths in cfg-gated modules) I think we can expect things to work quite well in practice, as long as the feature itself is mostly standalone / self-sufficient.
Activity
TimvdLippe commentedon Aug 12, 2026
I am a big fan of splitting things up more to make it modular. One concern I have: how are we going to ensure everything keeps on building. For example, if we start scattering around feature-flags, it is relatively easy to miss a case where it should have been added and then it no longer builds.
Should we maybe have some common configurations of feature flags? One with none of it turned on, one with all and then some ones that make sense based on existing embedder usages?
jschwe commentedon Aug 12, 2026
Since rather recently we do have feature-groups as a concept in servo and servoshell features:
servo/components/servo/Cargo.toml
Line 26 in 96148a7
The rough idea is indeed that we ensure:
--no-default-features+ tracing + tracing-hitrace build).Other combinations would be on a best-effort basis. In practice most features are expected to be quite orthogonal, and with a bit of hygiene (instead of cfg-gating imports, use fully qualified paths in cfg-gated modules) I think we can expect things to work quite well in practice, as long as the feature itself is mostly standalone / self-sufficient.
script: Feature Flag WebCrypto crate (servo#47198)
script: Feature Flag WebCrypto crate (servo#47198)