Commit Graph

5880 Commits

Author SHA1 Message Date
Adrià Arrufat
9fa5fa93fc agent: reorder heal arguments and use leaky json parsing 2026-04-23 19:43:22 +02:00
Adrià Arrufat
ec3ff945cd Merge branch 'main' into agent 2026-04-23 12:31:24 +02:00
Karl Seguin
b6fbf01203 Merge pull request #2218 from lightpanda-io/user_agent_data
Adds navigator.userAgentData
2026-04-23 17:05:31 +08:00
Karl Seguin
859a41ab4e Adds navigator.userAgentData
This API isn't supported by FireFox (yet), so it isn't a huge priority, but I
did notice that its used across many Google properties. It uses the same value
as Sec-Ch-Ua (https://github.com/lightpanda-io/browser/pull/2100) to provide
consistent data.

Smaller changes:
1 - Allow `OffscreenCanvas` to be used with Worker (noticed this error too)
2 - Don't like JS execution errors at "error" level for "load" and
    "DOMContentLoaded". "error" should be reserved for things we can fix and
    should never be triggered from invalid a bug in JavaScript.
2026-04-23 16:24:42 +08:00
Halil Durak
7aca1732fe Merge pull request #2098 from lightpanda-io/nikneym/cli-parser 2026-04-23 11:17:44 +03:00
Karl Seguin
1c62d90e23 Merge pull request #2211 from lightpanda-io/page_container
Introduce Page (container)
2026-04-23 16:06:18 +08:00
Karl Seguin
4fdf04972e zig fmt 2026-04-23 15:48:15 +08:00
Karl Seguin
550fb58f3f Introduce Page (container)
Follow up to https://github.com/lightpanda-io/browser/pull/2200

This change is actually pretty mundane, but a bunch of files that used to
take a *Session (e.g. every WebAPI releaseRef and deinit) now take a *Page.

This aims to separate the 2 lifetimes currently managed by Session by moving
the "Page" lifetime to a dedicated container: Page. Ultimately, the goal is to
remove the 1-page-per-session limit of the current design. Not to explicitly
support multiple pages per session (though, that's more possible now), but
in order to better emulate Chrome where, during a navigation event, the old and
new page both exist.
2026-04-23 15:48:13 +08:00
Karl Seguin
553b32b3b8 Merge pull request #2217 from lightpanda-io/css_insert_rule_index_clamp
Clamp insert index
2026-04-23 15:39:16 +08:00
Karl Seguin
3d052794d5 Merge pull request #2216 from lightpanda-io/cdp_audit_placeholder
Add placeholder handlers for Audit enable/disable CDP methods
2026-04-23 15:39:01 +08:00
Karl Seguin
15ab2379e3 Merge pull request #2215 from lightpanda-io/set_body
Add setter for document.body
2026-04-23 15:38:48 +08:00
Karl Seguin
2c1abb4500 Merge pull request #2208 from lightpanda-io/worker_apis
More Worker APIs
2026-04-23 15:37:51 +08:00
Adrià Arrufat
c3e6d97fdf Merge branch 'main' into agent 2026-04-23 07:39:02 +02:00
Karl Seguin
e68dd2b284 Clamp insert index
Because we don't fully process CSS, indexes that code expect might be out of
bounds. The specific case comes from https://github.com/lightpanda-io/browser/issues/2214
which uses fullcalender library. This library uses a @font-face which we do not
process and thus end up with incorrect indexes. As a quick workaround aligned
with previous fixes for these types of cases (and what the original issue
recommended), we simply clamp the index.
2026-04-23 11:23:37 +08:00
Karl Seguin
73320e163d Add placeholder handlers for Audit enable/disable CDP methods
Might help with: https://github.com/lightpanda-io/browser/issues/2177

I say "might" because there are a 2 more methods in Audit which I haven't
implemented. This is just the most basic placeholder for now.
2026-04-23 09:19:49 +08:00
Karl Seguin
338e53460a Add setter for document.body
Fixes: https://github.com/lightpanda-io/browser/issues/2213
2026-04-23 09:15:00 +08:00
Karl Seguin
cd40491267 Merge pull request #2210 from lightpanda-io/build-extras-off-default
build: move snapshot_creator and legacy_test to an `extras` step
2026-04-23 07:42:33 +08:00
Karl Seguin
b774fc4cfb Merge pull request #2212 from lightpanda-io/cdp/ax-promote-hidden-input-labels
cdp: promote <label> to checkbox/radio for CSS-hidden inputs
2026-04-23 07:42:19 +08:00
Adrià Arrufat
935a7ba3d5 build: update zenai dependency 2026-04-22 16:49:56 +02:00
Adrià Arrufat
e9c93a49f0 cdp: promote <label> to checkbox/radio for CSS-hidden inputs
Chromium's accessibility tree prunes elements hidden via `display:none`,
`visibility:hidden`, the `hidden` attribute, `inert`, or `aria-hidden="true"`
and we match this behavior. It's correct for most elements, but it breaks
a common form pattern: CSS-only toggle switches and custom radio groups
hide the real `<input>` and style the `<label>` as the interactive surface.

Before, an agent walking the AX tree for a toggle switch saw:

    {role: "none", name: "Enable feature", ignored: false}

a generic element with no indication it's interactive and no exposure of
the underlying `checked` state. The input was pruned and the label had no
intrinsic role.

Now, when a `<label>` is associated (via `for=` or by wrapping) with a
hidden checkbox or radio input, the label is promoted to the input's role
and state:

    {role: "checkbox", name: "Enable feature",
     properties: [..., {checked: "true"}, {focusable: true}, ...]}

Native browsers already forward label clicks to the associated input, so
the label's `backendDOMNodeId` remains a valid click target — no action-
side changes needed.

Scope is intentionally narrow:

  - Only checkbox and radio inputs. Other labelable controls (textarea,
    select, etc.) don't have the "visible label as interactive surface"
    idiom.
  - Skipped when the label has an explicit `role=` attribute, to respect
    the page's declared semantics.
  - Skipped when the input is visible: normal AX tree flow already
    surfaces it, and promoting would double-count.

The fixture `src/browser/tests/cdp/ax_tree.html` covers:

  - `display:none` checkbox, checked, referenced by `<label for=id>`
  - `display:none` radio, checked, referenced by `<label for=id>`
  - `visibility:hidden` radio, unchecked, referenced by `<label for=id>`
  - Wrapping `<label>` containing a `display:none` checkbox
2026-04-22 16:04:29 +02:00
Halil Durak
fa302a1db1 cli: report failure on lightpanda serve serve case 2026-04-22 16:37:37 +03:00
Halil Durak
7035317e3e Config: rebase to main 2026-04-22 16:14:28 +03:00
Halil Durak
1022875234 cli: improve failure messages 2026-04-22 16:08:15 +03:00
Halil Durak
59afb9e773 cli: --strip -> --strip-mode in sniff and doc-comment 2026-04-22 16:08:15 +03:00
Halil Durak
77a494f1fb cli: update doc-comment 2026-04-22 16:08:15 +03:00
Halil Durak
79319485ea cli: catch unknown arguments on options that take packed struct 2026-04-22 16:08:14 +03:00
Halil Durak
3619af2d4c cli: reintroduce old --help 2026-04-22 16:08:14 +03:00
Halil Durak
f389e1945f rebase to main 2026-04-22 16:08:14 +03:00
Halil Durak
44849fdaf3 cli: splitScalar -> tokenizeScalar 2026-04-22 16:08:14 +03:00
Halil Durak
baf97bb607 cli: remove shortcut bits in sniffCommand 2026-04-22 16:08:13 +03:00
Halil Durak
7acbd54172 cli: accept defaults for boolean
Setting a boolean option, instead of setting it to `true`, prefers the opposite of `default`. The `default` is `false` if not provided.
2026-04-22 16:08:13 +03:00
Halil Durak
1da11d8da8 Config: revert to --strip-mode 2026-04-22 16:08:13 +03:00
Halil Durak
4a4e3643f5 cli: prefer full over all to enable everything 2026-04-22 16:08:12 +03:00
Halil Durak
012fe40bb5 cli: remove aliases and shortcuts 2026-04-22 16:08:12 +03:00
Halil Durak
a3af914cda Config: adaptation to new cookie arguments 2026-04-22 16:08:12 +03:00
Halil Durak
29d8e0c9b7 Config: bring back validateUserAgent 2026-04-22 16:08:12 +03:00
Halil Durak
5e0c046e96 rebase and remove commented out code 2026-04-22 16:08:11 +03:00
Halil Durak
721b959dbf Config: always return a valid mode for --dump 2026-04-22 16:07:05 +03:00
Halil Durak
74a518c56f cli: reintroduce command sniffing 2026-04-22 16:07:04 +03:00
Halil Durak
156cf9b5a4 testing.zig: init directly on .serve 2026-04-22 16:07:04 +03:00
Halil Durak
f5b9bdb51b rebase and backport new feature from main 2026-04-22 16:07:04 +03:00
Halil Durak
07351f0e40 cli: add an explanatory doc-comment that goes in depth of the API 2026-04-22 16:07:04 +03:00
Halil Durak
85e624356b Commands: more aliases 2026-04-22 16:07:03 +03:00
Halil Durak
baa0d83fa7 cli: positional argument must not be null after parsing 2026-04-22 16:07:03 +03:00
Halil Durak
059d21f7fd cli: return errors if next argument not found 2026-04-22 16:07:03 +03:00
Halil Durak
dc57096995 main_legacy_test: fix regression 2026-04-22 16:07:02 +03:00
Halil Durak
886448aaa3 Commands: add shortcuts for host and port of serve 2026-04-22 16:07:02 +03:00
Halil Durak
1a68ea7370 cli: better handle unknown arguments 2026-04-22 16:07:02 +03:00
Halil Durak
10914d6288 cli: fix --log-filter-scopes regression 2026-04-22 16:07:02 +03:00
Halil Durak
b01e93502e cli: revert enum specific peek ahead logic
This was needed before the introduction of `validator`; doesn't make sense now.
2026-04-22 16:07:01 +03:00