pub fn quickjs_arg_to_serialized<'js>(
_ctx: &Ctx<'js>,
value: Option<Value<'js>>,
) -> Result<SerializedArgument>Expand description
Lower a QuickJS JS argument into a
ferridriver::protocol::SerializedArgument ready for
page.evaluate(fn, arg) / page.evaluateHandle(fn, arg) etc.
Covers JSON-expressible values (primitives, plain arrays, plain
objects) plus top-level JSHandle / ElementHandle class
instances. undefined / absent maps to the utility script’s
{v: "undefined"} sentinel; null maps to {v: "null"}.
Class-instance detection: a top-level JSHandleJs or
ElementHandleJs value is emitted as SerializedValue::Handle(0)
with its backend ferridriver::protocol::HandleId pushed into
handles[0]. Nested handles inside object / array user args are a
follow-up; today a nested handle serialises as its JSON
representation (usually an empty object), which is a behavior gap
rather than a correctness bug — we detect it at the top level
where every Playwright test actually passes handles.