Bug 310157

Summary: [Inspector] Protocol C++ generator should support nullable event parameters
Product: WebKit Reporter: juliopiubellow
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: bburg, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

juliopiubellow
Reported 2026-03-17 21:55:26 PDT
The shared inspector protocol C++ generator currently does not preserve "nullable": true on event parameters, even though nullable object members are already modeled correctly. That forces callers to hand-craft JSON envelopes for events whose parameters may be explicitly null, which defeats the purpose of the generated protocol types and weakens type guarantees. Add shared support for nullable event parameters so generated frontend dispatchers can accept typed nullable values and serialize them as either the expected protocol type or JSON null. While implementing WebDriver BiDi browsing-context events, we ran into a gap in the shared inspector codegen: event parameters currently preserve optional, but they do not preserve nullable. As a result, generated event notifier signatures can express only a required typed value or an omitted value for optional parameters, but not an explicit null value required by the protocol. This is why nullable object members work today, but nullable event parameters do not. The intended direction is to add shared nullable-event-parameter support to the inspector protocol model and C++ generator, likely by introducing a concrete JSON null type and a typed nullable wrapper for generated protocol C++ so that non-null values are still forced to be the expected type. This should land as separate shared infrastructure work before the WebDriver BiDi PR that wants to rely on it.
Attachments
Radar WebKit Bug Importer
Comment 1 2026-03-24 21:56:12 PDT
Blaze Burg
Comment 2 2026-03-31 14:59:32 PDT
Note You need to log in before you can comment on or make changes to this bug.