Commit Graph
9542 Commits
Author SHA1 Message Date
Karl Seguin 40fb080509 Merge pull request #3370 from lightpanda-io/svg-ctm
webapi: SVGGraphicsElement.getCTM and getScreenCTM
2026-09-01 18:13:54 +08:00
Karl Seguin 6f92ef4a4f Merge pull request #3362 from lightpanda-io/ci-orderfile
CI: Weekly orderfile generation + PR
2026-09-01 18:10:06 +08:00
Adrià Arrufat 20ac0baa99 webapi: match browsers for step, time strings, empty patterns and tooLong
Checked the three test files in Firefox and Chrome:
- stepUp/stepDown use the HTML step base (min, else the value attribute)
  and snap off-ladder values to the next rung, counting the snap as the
  first step as browsers do; clamping lands on the last rung inside
  min/max.
- time strings keep a three-digit fraction.
- an empty pattern attribute is a pattern (matches only "").
- tooLong/tooShort only for values last changed by a user edit, so the
  text-entry path marks the value and script/attribute values never trip
  them; same for textarea.
- showPicker dropped: browsers throw NotAllowedError without a gesture,
  a no-op would be a lie.
- month/week assertions skipped where the browser has no such input.
2026-09-01 12:09:49 +02:00
Karl Seguin ddb0dc09b9 Merge pull request #3377 from lightpanda-io/image-decode
webapi: img.decode()
2026-09-01 17:21:23 +08:00
Karl Seguin 9d2b3cf456 Merge pull request #3376 from lightpanda-io/disabled-fieldset-state
webapi: a disabled fieldset disables its controls' activation and validation
2026-09-01 17:21:12 +08:00
Karl Seguin 17dde356f4 add option and optgroup to controls we need to check disabled on 2026-09-01 17:05:55 +08:00
Karl Seguin 8e9ecb4a64 Merge pull request #3375 from lightpanda-io/option-selected-single
webapi: option.selected = true deselects its siblings in a single select
2026-09-01 16:56:46 +08:00
Karl Seguin 512d2269b8 Merge pull request #3369 from lightpanda-io/navigator-sendbeacon-returns
webapi: navigator.sendBeacon returns true
2026-09-01 16:45:25 +08:00
Adrià Arrufat cb8ad6faa6 webapi: canvas measureText and the drawing methods chart libraries probe
measureText was missing and roundRect, ellipse, setLineDash, gradients,
patterns, isPointInPath and the shadow/filter properties threw, so
Chart.js, D3 and ApexCharts died at init. Widths come from the
deterministic text model in text_measure.zig; nothing is painted.
2026-09-01 10:41:41 +02:00
Karl Seguin c564e4e2db chore: Extract common Markdown/Screenshot logic
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.
2026-09-01 16:37:32 +08:00
Adrià Arrufat 396ec5fe18 webapi: input valueAsNumber, valueAsDate, stepUp/stepDown, showPicker
react-hook-form and date pickers read valueAsNumber/valueAsDate and got
undefined. The date types convert through the existing validators; the
same conversion now also drives min/max range validation for
date/time/month/week/datetime-local, which only number/range had.
2026-09-01 10:36:54 +02:00
Adrià Arrufat 6c59aa6df1 webapi: matchMedia change events and real (add|remove)Listener
addListener/removeListener were no-ops and nothing fired when
Emulation.setDeviceMetricsOverride crossed a breakpoint. Each
MediaQueryList now registers on its Page; Browser.setViewportOverride
tells pages to re-evaluate and dispatch MediaQueryListEvent('change') on
the ones whose matches flipped. onchange is registered as a listener so
JS-side dispatchEvent reaches it too.
2026-09-01 10:30:35 +02:00
Adrià Arrufat db64ced3fb webapi: img.decode()
Missing, so Next.js <Image> and React lazy images threw TypeError. No
decoding happens, so it resolves once the element exists.
2026-09-01 10:21:57 +02:00
Adrià Arrufat 33befd7caf webapi: a disabled fieldset disables its controls' activation and validation
click(), willValidate and the WebDriver click read only the control's own
attribute. They now use Element.isDisabled, which already walks fieldset
ancestors with the first-legend exception for :disabled. The disabled IDL
attribute keeps reflecting the attribute alone, per spec.
2026-09-01 10:21:20 +02:00
Adrià Arrufat 68e11c57f2 webapi: option.selected = true deselects its siblings in a single select
Two options ended up selected and select.value reported the stale one;
form-filling agents got silently wrong data.
2026-09-01 10:20:06 +02:00
Adrià Arrufat 223a7ef728 webapi: Headers.getSetCookie, customElements.getName, Element.part
Three one-accessor gaps: getSetCookie returns Set-Cookie values
unjoined, getName maps a constructor back to its tag, part is a
DOMTokenList over the part attribute like relList.
2026-09-01 10:17:14 +02:00
Adrià Arrufat 7ef384c636 webapi: reflect HTMLElement.contentEditable
Only isContentEditable existed, so el.contentEditable = 'true' created
an expando and never set the attribute. isContentEditable is unchanged.
2026-09-01 10:13:35 +02:00
Adrià Arrufat 73b4dd09ac webapi: SVGGraphicsElement.getCTM and getScreenCTM
Composes transform attributes up to the nearest <svg> (getCTM) or through
every enclosing <svg>, offset by the outermost one's client rect
(getScreenCTM). Null when detached. d3-zoom, d3-brush and svg-pan-zoom
call these at init and threw.
2026-09-01 10:11:26 +02:00
Adrià Arrufat 18b0a0f479 webapi: navigator.sendBeacon returns true
The body returned true (#2821) but .noop made the bridge skip it, so JS
saw undefined and took the synchronous XHR fallback it guards against.
2026-09-01 10:07:41 +02:00
Karl Seguin 39ac97f267 CDP failRequest also cancels (not aborts) 2026-09-01 15:50:48 +08:00
Karl Seguin a43db3cbd2 Merge pull request #3365 from lightpanda-io/log-notes
log: allow 'note' to be silenced, log CLI tips
2026-09-01 15:36:19 +08:00
Karl Seguin 76c8f4bb6e webapi: window.stop()
window.stop() is less destructive than other mechanisms we have. For one, it
seems largely isolated to pending or inflight HTTP requests. For anther, it
keeps the page intact.

To achieve this, HttpClient gains an `cancelRequests` which is a gentler version
of `abortOwner`. It cancels inflight/pending HTTP requests, which results in
error callbacks (not shutdown callbacks) firing.

Just like https://github.com/lightpanda-io/browser/pull/3189 I ran into the
problem that I couldn't distinguish between an HTTP request that was canceled
because of user-action (e.g. calling window.stop(), or xhr.abort()) and an HTTP
request that was internally aborted. These now have distinct errors/flows so
that we can present the correct state. Most places that aborted now all
transfer.cancel() which results in a distinct `error.TransferCanceled` (some
places still abort -> `error.Abort`). It should be possible to revisit 3189 now.

The CDP "Page.stopLoading" now hooks into this new behavior. Fixes
https://github.com/lightpanda-io/browser/issues/3351
2026-09-01 14:55:19 +08:00
Karl Seguin 9c83bf3ef9 log: allow 'note' to be silence, log CLI tips
We currently have 1 note: it prints the server's listening address:port. Note
is a special un-ignorable level. This keeps the "note" level, but logs it under
a new scope: "note", so that it _can_ be silenced with a `--log-filter note`.

Add a new note, on startup, that displays tips. Currently, only displays when
--obey-robots is not enabled:

NOTE  note : config tips . . . . . . . . . . . . . . . . . . . [+0ms]
      robots = use '--obey-robots' to use a sites robots.txt
      meta = use '--log-filter note' to silence this message
2026-09-01 12:35:56 +08:00
Karl Seguin 1c12eb73a8 Merge pull request #3366 from lightpanda-io/ci-fix
cdp: remove race between terminate/disconnect
2026-09-01 12:35:05 +08:00
Karl Seguin a68697921e cdp: remove race between terminate/disconnect
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.
2026-09-01 12:11:07 +08:00
Karl Seguin 053ea6aac0 Merge pull request #3331 from lightpanda-io/repl-markdown-render
agent: route REPL output per tool and align page tables of any size
2026-09-01 10:09:43 +08:00
Karl Seguin 84b8500f2e CI: Weekly orderfile generation + PR 2026-09-01 10:08:53 +08:00
Karl Seguin a48cc7d643 indexeddb: Improve error handling
Three  small compliance (WPT) changes with respect to error handling.

1. When a unique index creation fails due to a constraint violation, the
   delivery of that failure is asynchronous.

2. When txn.abort() is called, any undelivered request should be aborted
   asynchronously (see the common theme here?)

3. An failure in an onupgradeneeded handler correctly fires an AbortError AND
   rollsback the version
2026-09-01 10:08:08 +08:00
Karl Seguin b7d790561f cdp: support request interception patterns
The Fetch.enable call takes `patterns` which can limit the path and type of
request that should be intercepted. This adds the wildcard support.

As before, RI is currently only enabled for Requests, not response. A warning
is printed if RI for responses is requested.

Fixes: https://github.com/lightpanda-io/browser/issues/3349
2026-09-01 10:06:55 +08:00
Karl Seguin 4a8fb6c2f9 Merge pull request #3363 from lightpanda-io/bidi-e2e
ci: enable bidi protocol for all e2e tests
2026-09-01 10:05:58 +08:00
Karl Seguin 857a8ea643 ci: enable bidi protocol for all e2e tests 2026-09-01 09:51:27 +08:00
Karl Seguin 3bab59c6a4 Merge pull request #3209 from lightpanda-io/bidi
WebDriver BiDi
0.4.0
2026-08-31 23:06:33 +08:00
Adrià Arrufat d8e804cdb4 Merge branch 'main' into repl-markdown-render
# Conflicts:
#	src/agent/Agent.zig
2026-08-31 16:48:43 +02:00
Karl Seguin 731774ab67 ops: Allow serving both cdp and bidi on the same port
--protocol can now be specified multiple times. This just makes ops/dev easier
by only requiring 1 instance.
2026-08-31 22:45:15 +08:00
Karl Seguin 766c0d05d6 bidi: protocol selection CLI, start of [classic] WebDriver
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.
2026-08-31 22:45:15 +08:00
Karl Seguin 5c0ed733d2 update v8 dep
Address various feedback, largely around potential uaf / double free  on error
cases
2026-08-31 22:45:15 +08:00
Karl Seguin 877316a3e8 bidi: user input 2026-08-31 22:45:14 +08:00
Karl Seguin a1f6382977 bidi: locateNodes 2026-08-31 22:45:14 +08:00
Karl Seguin 8aef077438 resolve pending bidi results 2026-08-31 22:45:14 +08:00
Karl Seguin deb1b936a1 metrics: cdp_* -> serve_* capture cdp vs bidi as serve_* labels 2026-08-31 22:45:14 +08:00
Karl Seguin a97e8ec43c bidi: basic script support 2026-08-31 22:45:14 +08:00
Karl Seguin 7c51dfff05 bidi: add skeleton for bidi
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
2026-08-31 22:44:59 +08:00
Karl Seguin 23891004dc Merge pull request #3327 from lightpanda-io/anchor-target-blank-popup
browser: open target=_blank links as popups and let tools follow them
2026-08-31 19:31:25 +08:00
Karl Seguin efb20f65b4 Merge pull request #3353 from lightpanda-io/body-client-dimensions
render: clientHeight/clientWidth returns the viewport for the body
2026-08-31 19:28:56 +08:00
Karl Seguin f4c8cd5fb2 Merge pull request #3354 from lightpanda-io/remove-duplicate-dupe
minor: remove potentially wasteful id dupe on removeId
2026-08-31 19:28:41 +08:00
Karl Seguin 3591aa575c Merge pull request #3356 from lightpanda-io/configure-http-version
cli: add --http-version 1.1 / auto flag
2026-08-31 18:51:45 +08:00
Karl Seguin 0250f77be6 Merge pull request #3357 from lightpanda-io/indexeddb-eager-serialization
indexeddb: serialize value at entry
2026-08-31 18:51:22 +08:00
Karl Seguin 8bf8532fb1 Merge pull request #3358 from lightpanda-io/cdp-network-enable-limits
CDP: enforce Network.enable limits
2026-08-31 18:51:09 +08:00
Karl Seguin 469677054c Merge pull request #3355 from rohitsux/fix/media-error-init
refactor(webapi): remove unused MediaError.init
2026-08-31 17:23:58 +08:00
Karl Seguin dad2ed42c9 CDP: enforce Network.enable limits
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.
2026-08-31 17:20:55 +08:00