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

Function fromWire

javascript/selenium-webdriver/bidi/serialization/union.js:82–95  ·  view source on GitHub ↗
(payload)

Source from the content-addressed store, hash-verified

80 // closed-vocabulary miss — always an error, never a warning, since there is no
81 // valid typed object to fall back to. Same nested-union case as build() above.
82 fromWire(payload) {
83 if (objectOnly && (typeof payload !== 'object' || payload === null || Array.isArray(payload))) {
84 throw new ValidationError(`${name}: expected an object on the wire, got ${typeof payload}`)
85 }
86 const ref = selectVariant(selector, payload, (d, key) => Object.hasOwn(d, key))
87 if (ref === undefined) {
88 throw new ValidationError(`${name}: received a variant not in this binding's BiDi schema`)
89 }
90 const variant = resolve(ref)
91 if (variant.kind === 'union') {
92 return variant.fromWire(payload)
93 }
94 return variant.RecordClass.fromWire(payload)
95 },
96 }
97
98 register(name, union)

Callers

nothing calls this directly

Calls 3

selectVariantFunction · 0.85
resolveFunction · 0.70
fromWireMethod · 0.65

Tested by

no test coverage detected