https://github.com/lightpanda-io/browser/pull/3333 improved markdown rendering
for flexbox items. But screenshot generation didn't benefit from that change.
This commit introduces a RenderTree that extracts and shares functionality
between markdown and screenshots.
A client that disconnects might get treated as a harsher terminate failure (e.g.
watchdog). This doesn't have a huge impact, but it makes the CI flaky and it
produces more logs than is necessary.
In a terminate state, the driver will now check its inbox to see if this is a
client disconnection.
In order to support Selenium the way people are used to, it looks like we need
to support both WebDriver classic (WebDriver) and WebDriver BiDi (BiDi). Typical
scripts look like a mix of the two, e.g. using WebDriver to control the browser
and using BiDi to receive notifications. This commit:
1 - adds a --protocol (cdp|webdriver) CLI argument to the `serve` command to
enable one or the other protocol (defaulting to CDP)
2 - adds basic WebDriver endpoint to let a Selenium client connect. This
implementation is hackish and sits on top of our simple Handshake handler.
The handshake handler is well past its original design. Serving /json/version
and /metrics from it was one thing. But Driving the entire browser session? This
will get a follow up PR.
1. Abstract "Driver". Non-CDP things that referenced *CDP now reference a Driver
2. Move the NodeRegistry out of CDP. This created an artificial link between
agent / mcp and CDP
3. Add BiDi driver with enough to navigate to a page
This enforces a limit on the captures responses based on the Network.enable's
maxTotalBufferSize and maxResourceBufferSize fields. It also limits the size of
the post body we echo (e.g. in requestWillBeSent) based on the `maxPostDataSize`
field.
When writing a value, we used to store js.Value.Global in the transaction's
queue and then serialize it at write-time. We're supposed to capture the value
at call-time. The result is that, if JS code alters the value, we can end up
storing the wrong value. We now serialize the value at call time, so that any
subsequent changes to the value are not captured by the operation.
Also improve how we map large integers. Because JavaScript can't represent the
full u64/i64, we need to treat large numbers as floats and truncate. This is
done both from JS -> Zig and from Zig -> JS.
https://github.com/lightpanda-io/browser/issues/3348
When set to 1.1, libcurl is configured to only offer HTTP 1.1. By default, or
when set to "auto", it's up to libcurl to decide how to connect. This maps to
libcurl's CURL_HTTP_VERSION_1_1 and CURL_HTTP_VERSION_NONE.
LP.configureCDP now takes an `httpVersion` field which can be "1.1" or "auto"
to control that specific browser session. Ideally this is called prior to any
navigation.
MediaError.init had no caller and MediaError has no JS constructor
exposed (new MediaError() is not valid JS), so the helper was
unreachable dead code. It also had a latent bug: it passed a struct
VALUE to std.mem.Allocator.create, which expects a TYPE. That bug
never surfaced because Zig lazily skips analyzing unreferenced
function bodies.
Remove init per maintainer review, along with its now-unused Frame
import. HTMLMediaElement.error still returns null today, so this
does not change runtime behavior.
Verified: zig fmt --check clean, scoped build+test green (1 of 1,
the remaining constants test).
resolveTargetFrame returned null for _blank, so every caller carried the
meaning of that null. It now returns a tagged union and callsites switch
on it. <form target=_blank> takes the same path as links: the popup is
opened only once the submission is going ahead, so validation or
preventDefault can't leave a stray window. The opener rule (withheld
unless rel=opener) lives in one Frame.openBlankTarget helper.
awaitQueuedNavigation took a frame id, but Runner waits are keyed by
Page root, so a followed popup's id resolved to FrameNotFound and every
navigation from inside a popup failed. It now takes the Frame and waits
on its Page root, read before processing since a synthetic root
navigation frees the Page in place.
Meant to improve https://github.com/lightpanda-io/browser/issues/3251
There's a script on taobao and tmall which tries to tile the visible porition
or the root element. Well, the root element's fake height is 100,000,000 so the
page stalls.
This changes is so that the body's clientHeight/Width returns the viewport
dimensions.
ReadableStream's assumed collectBodyBytes was being called on the same context
that it was created, so that in a cross-context call, the expected LocalScope
was null. This creates an explicit local scope.
Fixes crash on WPT /service-workers/service-worker/fetch-event.https.h2.html
Commented it out for now, but plan on remove the code at some point in the
future. This was useful when sites would break because of an unimplemented
API, but (a) those are rare now and (b) AI is good at finding issues without
this. As-is, it just makes --log-level debug useless in Debug builds. The
logging could never tell between an site-specific global and a real API, and
sites have _a lot_ of globals, so it's a lot of noise.