Expand description
Conversion helpers between ferridriver core types and rquickjs values.
Traits§
- Ferri
Result Ext - Adapter:
Result<T, FerriError>intorquickjs::Result<T>.
Functions§
- extract_
page_ function - Extract
(fn_source, is_function_hint)from an evaluatepageFunctionarg that can be a JS string or a JS function — matches Playwright’sString(pageFunction)+typeof pageFunction === 'function'check. For functions, invokes the engine’sFunction.prototype.toString()via globalString(...). - init_
script_ from_ js - Lower an
addInitScript-style JS argument intoferridriver::options::InitScriptSourceplus an optional JSON arg. Mirrors Playwright’sFunction | string | { path?: string, content?: string }union from/tmp/playwright/packages/playwright-core/src/client/page.ts:520— all semantic lowering (function body via.toString(), path/content precedence,null-vs-undefinedpreservation forarg) happens here synchronously so the async binding method can immediately hand owned,Send-safe values to Rust core. - ms_
f64_ to_ u64 - Convert a JS millisecond value (
f64) into au64, clamping negatives to0. Single home for the otherwise-repeated f64->u64 timeout cast so call sites stay lint-clean. - name_
value_ array_ to_ js - Build a JS
Array<{ name, value }>straight from name/value pairs viarquickjs-serde— noserde_json::json!/serde_json::Valuemiddle allocation. Used byrequest/response/apiResponseheadersArray(). - parse_
check_ options - Parse Playwright’s
CheckOptions/UncheckOptions/SetCheckedOptionsJS bag into the core struct. - parse_
click_ options - Parse Playwright’s
ClickOptionsJS bag into the core struct. AcceptsOpt<Value>so callers passOpt(options)verbatim;None,undefined, ornull→Ok(None). Unknownbutton/modifierstrings raise a typedrquickjs::Errorwith the exact Playwright message so JS-side assertions see/Unknown (button|modifier)/for drift detection. - parse_
dblclick_ options - Parse Playwright’s
DblClickOptionsJS bag into the core struct. - parse_
dispatch_ event_ options - Parse Playwright’s
DispatchEventOptionsJS bag into the core struct. - parse_
drop_ options - Parse Playwright’s
DropOptionsJS bag into the core struct. - parse_
drop_ payload - Parse Playwright’s native
DropPayload({ files?: string | string[] | FilePayload | FilePayload[], data?: { [mimeType: string]: string } }) into the core struct. Both fields are optional. - parse_
fill_ options - Parse Playwright’s
FillOptionsJS bag into the core struct. - parse_
hover_ options - Parse Playwright’s
HoverOptionsJS bag into the core struct. - parse_
input_ files - Parse the polymorphic
filesarg forsetInputFiles:string | string[] | FilePayload | FilePayload[]. - parse_
press_ options - Parse Playwright’s
PressOptionsJS bag into the core struct. - parse_
select_ option_ options - Parse Playwright’s
SelectOptionOptionsJS bag into the core struct. - parse_
select_ option_ values - Parse a polymorphic
selectOptionvaluesJS argument:string | string[] | { value?, label?, index? } | Array<...>. - parse_
set_ input_ files_ options - Parse Playwright’s
SetInputFilesOptionsJS bag into the core struct. - parse_
tap_ options - Parse Playwright’s
TapOptionsJS bag into the core struct. - parse_
type_ options - Parse Playwright’s
TypeOptionsJS bag — same shape asPressOptions. - quickjs_
arg_ to_ serialized - Lower a QuickJS JS argument into a
ferridriver::protocol::SerializedArgumentready forpage.evaluate(fn, arg)/page.evaluateHandle(fn, arg)etc. - serde_
from_ js - Inverse of
serde_to_js— deserialize a JS value into a Rust type viarquickjs-serde(directValue->T). Integral-float -> integer coercion,undefined/function-property drop, Proxy and cycle handling all hold (covered by the rquickjs-serde test suite), so the option-bag call sites keep their prior semantics without our own hand-rolled walker. - serde_
to_ js - Convert any
serde::Serializevalue into a JS value viarquickjs-serde— directT->rquickjs::Value, no JSON string and noserde_json::Valuemiddle allocation. Used for binding returns (cookies, storage state, parsed JSON bodies). - serialized_
value_ to_ quickjs - Convert a
ferridriver::protocol::SerializedValueinto a native QuickJS JS value —Date/RegExp/BigInt/URL/Error/ typed arrays /NaN/±Infinity/undefined/-0all round-trip as their native JS form. Mirrors Playwright’sparseSerializedValueat/tmp/playwright/packages/playwright-core/src/protocol/serializers.ts:19. - to_
rq_ error - Convert a
FerriErrorinto anrquickjs::Errorsuitable for throwing out of a binding method.