Skip to content

Modularity: Feature-gate more functionality #47183

Open
4 of 6 issues completed
Open

Description

@jschwe

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.

Sub-issues

Sub-issues

4 of 6 Issues completed
Loading 6 sub-issues

Activity

  1. added
    B-feature-tracking
    B-meta
    and removed
    B-feature-tracking
    on Aug 12, 2026
  2. TimvdLippe commented on Aug 12, 2026

    @TimvdLippe
    Contributor

    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?

  3. jschwe commented on Aug 12, 2026

    @jschwe
    MemberAuthor

    Since rather recently we do have feature-groups as a concept in servo and servoshell features:

    default_web_features = ["clipboard", "webgpu", "webxr"]

    The rough idea is indeed that we ensure:

    • The --no-default-features build works
    • Our default features build works
    • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-meta

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions