Commit Graph
9878 Commits
Author SHA1 Message Date
Karl Seguin d8586751d0 ops: Introduce Page Context logs
Ultimate goal is to improve the logging to be more useful by:
1 - identifying the page being navigating
2 - downgrading most page-loading errors to debug
3 - provide page statistics (in logs, via cdp).

So, the logs would look something like:

```
info page-navigate page=3392 url=https://.....
debug urlblocked page=3392
debug timeout page=3392 url=script.js
info page-done page=3392 url=https://....
```

The log level for page-done will be  the @max() of any log level for that page
so that if you run --log-level warn, and you get:

```
info page-navigate page=3392 url=https://... <-- filtered out
debug timeout page=3392 url=script.js <--filtered out
warn unknown module lookup page=3392 identifier=blah.js
warn page-done page=3392 url=https://....
```

So that any page event can be linked to the top leveL URL, while still
respecting the --log-level.

This first parts adds the log-level page context, and the thread local
variable.
2026-09-29 12:17:39 +08:00
Karl Seguin 58357fea3e Merge pull request #3529 from lightpanda-io/nikneym/improve-cdp-error
`cdp`: report back invalid same-site
2026-09-28 16:20:45 +08:00
Karl Seguin 8a3bd6d4b2 Merge pull request #3663 from lightpanda-io/markdown-anchor-no-href
Treat <a> without href as text in markdown and clutter strip
2026-09-28 16:18:12 +08:00
Karl Seguin cfad479548 Merge pull request #3649 from lightpanda-io/cli-suggest-threshold
cli: scale the "did you mean" distance with the input's length
2026-09-28 16:05:53 +08:00
Karl Seguin 3aaed28d20 Merge pull request #3666 from lightpanda-io/domtokenlist-setters
webapi: add a number of DOMTokenList setters
2026-09-28 15:40:48 +08:00
Karl Seguin 915bf31622 Merge pull request #3667 from lightpanda-io/silence-test-logs
chore: silence expected error log in test
2026-09-28 15:39:42 +08:00
Karl Seguin 1bb4aba7fa Merge pull request #3668 from lightpanda-io/flaky-test-fix
ci: fix flaky test
2026-09-28 15:39:29 +08:00
Karl Seguin fd4eaeb01c Merge pull request #3669 from lightpanda-io/M_MMAP_THRESHOLD
mem: Set M_MMAP_THRESHOLD to 128K on linux builds
2026-09-28 15:39:13 +08:00
Karl Seguin cbc9c79afd Merge pull request #3664 from lightpanda-io/always-detach-global
v8: always detach global
2026-09-28 15:38:12 +08:00
nikneym 96d0f07b15 cdp: setCookie sameSite parity with Chrome 2026-09-28 10:27:32 +03:00
Adrià Arrufat b8a6994baf markdown: keep standalone href-less anchors on their own line
Adjacent placeholder anchors, like a JS-driven nav, ran together as
HomeAbout. Keep the standalone line placement linked anchors get and
drop only the link syntax.
2026-09-28 09:27:16 +02:00
Adrià Arrufat 1188554515 cli: read a url-like bare word as the url, not a misspelt command
`lightpanda version.io` was rejected as a misspelt `version`, 3 edits
within the length-scaled limit. Like curl, it fetches now: the command check
shares --dump's isUrlLike.
2026-09-28 09:22:29 +02:00
Karl Seguin 4caaa27411 mem: Set M_MMAP_THRESHOLD to 128K on linux builds
Following some experimentation, this sets M_MMAP_THRESHOLD to 128K on linux
builds IF it isn't explicit set, e.g. via the `MALLOC_MMAP_THRESHOLD_` env. This
allows users explicitly set it if they want.

I've been looking at this for a while, but my understanding is still basic. The
simplistic explanation is that glibc's allocator internally uses arenas.
Allocations above THRESHOLD skip these arenas and are allocated directly from
and freed directly to the OS. Allocations under this threshold are released
to the arena where they can be re-used. Everything works OK, EXCEPT for when it
comes time to release the memory from these arenas back to the OS. If free arena
memory is pinned under live memory, it cannot be released.

Various online posts / comments reference glibc as suffering from significant
fragmentation and "holding" onto memory. That's the behavior that we've seen.
Further, calls to malloc_trim reclaim the lost memory, so what we're seeing
aren't leaks.
2026-09-28 14:02:39 +08:00
Karl Seguin 58622ef7c4 Merge pull request #3571 from lightpanda-io/nikneym/playwright-id-track
`cdp`: answer inspector commands on the session that sent them
2026-09-28 12:36:44 +08:00
Karl Seguin e79c85a587 Merge pull request #3653 from staylor/fix/stylesheet-important-cascade
Honor !important when cascading tracked stylesheet properties
2026-09-28 12:23:02 +08:00
Karl Seguin 9aa748616b Simplify Inspector.Session ownership
Since AttachedSession is already heap-based, it's inspector_session is at a
fixed address and thus can own the session.

Also, hook in some noop callbacks on deinit.
2026-09-28 12:18:33 +08:00
Karl Seguin 46d16e229e Store !important as priority
Encode the !important'ness of a rule into its priority (we have the bit to
spare). This keeps the !important calculation the build-side, not the read side
and is more consistent with how the StyleManager generally works.

CSSStyleDeclaration `getPropertyValue` is now !important aware. Whereas before
an inline value would always win, it now cedes to an !important stylesheet rule
2026-09-28 11:55:34 +08:00
Karl Seguin ce46f90f1c Merge pull request #3657 from onnimonni/fix/input-select-email
webapi: input select() must not throw for email/number
2026-09-28 10:35:38 +08:00
Karl Seguin 72d612472d ci: fix flaky test 2026-09-28 10:34:59 +08:00
Karl Seguin 4ac219c438 zig fmt 2026-09-28 10:25:29 +08:00
Karl Seguin f96c85c2a3 chore: silence expected error log in test 2026-09-28 10:20:13 +08:00
Karl Seguin 550c2b3c61 apply same href-less detection to shell measurement 2026-09-28 10:17:13 +08:00
Karl Seguin 8f568c1382 webapi: add a number of DOMTokenList setters
While the token list itself is readonly, the attribute itself is settable. For
example, HTMLOutputElement's htmlFor says:

"Although the htmlFor property itself is read-only in the sense that you can't
replace the DOMTokenList object, you can still assign to the htmlFor property
directly"
2026-09-28 09:59:04 +08:00
Karl Seguin a9738c7df5 Merge pull request #3660 from lightpanda-io/nikneym/iframe-set-sandbox
`iframe`: add sandbox setter
2026-09-28 09:55:04 +08:00
Karl Seguin a844e38826 preserve correctsendKeys() behavior for webdriver 2026-09-28 09:49:13 +08:00
Karl Seguin 38e8957639 Merge pull request #3665 from lightpanda-io/orderfile-regen
orderfile: regenerate the hot-code profile
2026-09-28 09:18:46 +08:00
github-actions[bot] d0c8a24334 orderfile: regenerate the hot-code profile
hot set 16948KB resident at 4KB fault-around: 21493 text, 22328 rodata symbols
2026-09-28 01:08:30 +00:00
Karl Seguin 389c0826e9 Merge pull request #3642 from lightpanda-io/click-wait-networkidle
tools: wait for networkidle after an action-triggered navigation
2026-09-28 08:00:36 +08:00
Karl Seguin 4d94f7c92e v8: always detach global
Simplifies code and causes v8 to null the microtask queue, removing the
possibility of a UAF
2026-09-28 07:57:37 +08:00
Karl Seguin 111fd35258 have httpclient own idle time 2026-09-28 07:33:06 +08:00
Karl Seguin 895b967259 Merge pull request #3629 from lightpanda-io/nikneym/text-encoder-encode-into
`TextEncoder`: add `encodeInto`
2026-09-28 07:07:17 +08:00
Karl Seguin 8a31f29b8a Merge pull request #3634 from lightpanda-io/v8-wakeup
perf: v8 task wakeup
2026-09-28 07:07:02 +08:00
Karl Seguin 831af0ca37 cleanup code, re-use new helper 2026-09-28 06:46:27 +08:00
Halil Durak d180a3cac2 cdp: report back invalid same-site 2026-09-28 01:40:49 +03:00
Karl Seguin 52cb8cf47b disable poll (0) if there's a foreground task 2026-09-28 06:36:30 +08:00
nikneym 8ede89217a cdp: update tests 2026-09-28 01:29:12 +03:00
nikneym 56cb4205ae cdp: sessions own their inspector session
`Inspector` now supports several sessions; `startSession` allocates one (the V8 channel keeps its address) and `stopSession` frees it. They all connect to the same context group so every session see every context.

`BrowserContext.session_id` stays the primary session's id for the many event call sites.
2026-09-28 01:27:40 +03:00
Adrià Arrufat 2be33e4af8 clutter: don't count <a> without href as link text
Tag chips like <a class="tag">x</a> pushed short quotes on
quotes.toscrape.com/js/ over the 0.2 link-density limit, so
--strip-mode clutter pruned them as navigation.
2026-09-27 23:56:42 +02:00
nikneym 736be5b35b cdp: answer inspector commands on the session that sent them
Playwright's `browserContext.newCDPSession` must get its response on that session, not the primary one. Playwright keys its pending callbacks by session, finds none for that id, and throws
"Assertion error", which takes the whole process down.

Addresses #1838 and #1839.
2026-09-27 23:43:10 +03:00
Adrià Arrufat b6cde68ef6 markdown: render <a> without href as plain text
An anchor with no href is a placeholder, not a hyperlink, so emitting
[text]() produced a broken link. Render its children inline instead.
2026-09-27 21:17:08 +02:00
nikneym 395550488a iframe: add sandbox setter 2026-09-27 14:45:47 +03:00
Adrià Arrufat 298f1b1f0c main: drop InvalidOption, which parseArgs no longer returns
--log-filter reports an unknown scope through invalidChoice now.
2026-09-27 13:35:04 +02:00
Adrià Arrufat cafe31649a cli: read a url-like --dump argument as the url, keep --log-filter's sign
`fetch --dump markdown.com` was rejected as a misspelt `markdown`: the
length-scaled limit allows 4 edits for 12 characters. No format has a `.`,
`/` or `:`, so an argument with one is always the url.

`--log-filter -cdpp` suggested `cdp`; invalidChoice now takes the stripped
prefix and puts it back on the value and the suggestion.
2026-09-27 13:26:28 +02:00
Adrià Arrufat 1e93f038f5 cli: drop a comment restating invalidChoice 2026-09-27 13:26:28 +02:00
Adrià Arrufat 4f4829ccf8 string: don't count the candidates' shared prefix in closest's limit
closest stripped a leading `--`, a CLI convention in a helper the agent's
slash commands share too. It now leaves out whatever prefix every
candidate starts with: `--` for flags, nothing for commands and values.
2026-09-27 13:26:28 +02:00
Adrià Arrufat 497f0363e5 cli: share the "invalid option choice" error
`cli.invalidChoice` logs a bad value with its closest match, and the
generic enum path, --dump, --log-level, --log-format and now --log-filter
all use it. editDistance lowercases its inputs once, and closest strips
exactly a leading `--`, as its doc says.
2026-09-27 13:26:28 +02:00
Adrià Arrufat f667c140ab cli: scale the "did you mean" distance with the input's length
A flat limit of two edits was too loose for short words and too strict
for long ones: `--dump md` suggested `pdf`, and a bare word within two
edits of `run` or `mcp` was rejected as a mistyped command instead of
being fetched, while `--insecure-disable-tls-verification` got no
suggestion at all. `closest` now allows about one edit per three
characters, as rustc does, not counting a leading `--`, and swapping two
adjacent characters counts as one edit so `--dmup` still finds `--dump`.

`--log-level` and `--log-format` now suggest the closest value too.
2026-09-27 13:26:28 +02:00
Onni Hakala 54b61fbc1e webapi: input select() must not throw for email/number
select() delegated to setSelectionRange(), which throws InvalidStateError
for input types where the selection API doesn't apply (email, number,
date, ...). Per spec select() never throws.

email and number still have selectable text, so they now keep the
internal selection/caret: select() + Input.insertText replaces the
value like Chrome. This is what Playwright's locator.fill() does, which
failed with 'locator.fill: undefined' on type=email.
2026-09-27 13:39:15 +03:00
nikneym 690adc28a8 TextEncoder: add encodeInto
Also reworks `TextEncoder#encode` to use `v8__String__WriteUtf8`.
2026-09-27 13:15:30 +03:00
Scott Taylor 5b1bb1bc78 Respect important declarations in tracked CSS cascade 2026-09-26 23:55:06 -04:00