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

Function collectAllMembers

javascript/selenium-webdriver/generate_bidi.mjs:512–528  ·  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

510 * `EventData` inside the core BiDi CDDL, so a second pass is required.
511 */
512function collectAllMembers(defMap, rootSuffix) {
513 const members = new Set()
514
515 // Primary traversal from the core BiDi root.
516 const rootName = rootSuffix === 'Command' ? 'CommandData' : 'EventData'
517 for (const m of collectUnionMembers(rootName, defMap)) members.add(m)
518
519 // Secondary traversal: pick up any XxxCommand / XxxEvent unions in
520 // extension specs whose members were not already found above.
521 for (const [name, def] of defMap) {
522 if (!name.endsWith(rootSuffix) || name === rootName) continue
523 if (def.Type !== 'variable' && def.Type !== 'group') continue
524 for (const m of collectUnionMembers(name, defMap)) members.add(m)
525 }
526
527 return members
528}
529
530/** Extract all BiDi commands by traversing CommandData and extension XxxCommand unions. */
531function extractCommands(ast) {

Callers 2

extractCommandsFunction · 0.85
extractEventsFunction · 0.85

Calls 2

collectUnionMembersFunction · 0.85
addMethod · 0.65

Tested by

no test coverage detected