MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / collectAllMembers

Function collectAllMembers

javascript/selenium-webdriver/generate_bidi.mjs:489–505  ·  view source on GitHub ↗

* Collect all leaf command/event names from every XxxCommand / XxxEvent * union that can be reached from either the core BiDi root (`CommandData` / * `EventData`) or from extension-spec roots (e.g. `PermissionsCommand`, * `SpeculationEvent`). Extension specs are not wired into `CommandData` / *

(defMap, rootSuffix)

Source from the content-addressed store, hash-verified

487 * `EventData` inside the core BiDi CDDL, so a second pass is required.
488 */
489function collectAllMembers(defMap, rootSuffix) {
490 const members = new Set()
491
492 // Primary traversal from the core BiDi root.
493 const rootName = rootSuffix === 'Command' ? 'CommandData' : 'EventData'
494 for (const m of collectUnionMembers(rootName, defMap)) members.add(m)
495
496 // Secondary traversal: pick up any XxxCommand / XxxEvent unions in
497 // extension specs whose members were not already found above.
498 for (const [name, def] of defMap) {
499 if (!name.endsWith(rootSuffix) || name === rootName) continue
500 if (def.Type !== 'variable' && def.Type !== 'group') continue
501 for (const m of collectUnionMembers(name, defMap)) members.add(m)
502 }
503
504 return members
505}
506
507/** Extract all BiDi commands by traversing CommandData and extension XxxCommand unions. */
508function extractCommands(ast) {

Callers 2

extractCommandsFunction · 0.85
extractEventsFunction · 0.85

Calls 2

collectUnionMembersFunction · 0.85
addMethod · 0.65

Tested by

no test coverage detected