Commit Graph
9275 Commits
Author SHA1 Message Date
Adrià Arrufat 88d133a676 cli: suggest the closest flag or command on a typo
An unknown --flag now logs the nearest accepted spelling within two
edits as did_you_mean, painted green next to the red typo in the pretty
log format; logfmt stays plain. A bare first argument within two edits
of a command name is rejected with the same hint instead of being
fetched as a url.

The Levenshtein helper moves from SlashCommand into string.zig so the
agent REPL and the CLI share it, with the table widened to fit the
longest flag name.
2026-09-08 16:50:46 +02:00
Karl Seguin 5d732eb8f1 Merge pull request #3445 from lightpanda-io/timer-caps
stability: raise timer caps
2026-09-08 16:27:37 +08:00
Karl Seguin 57d6436a46 Merge pull request #3436 from lightpanda-io/nikneym/ws-msg-int-overflow
`WS`: guard against integer overflow when parsing message length
2026-09-08 16:09:18 +08:00
Adrià Arrufat 328af59215 stability: raise timer caps
A paginated storefront listing holds ~2.7k pending timers, which crosses
the 2048 table cap. Past it setTimeout throws TooManyTimeout into the
framework's scheduler, which turns a busy page into a retry storm. No
browser throws there: raise the combined cap to 8192 and repeating timers
to 2048 so it stays a runaway backstop, not a budget.
2026-09-08 09:56:34 +02:00
Halil Durak 56c1694175 WS: guard against integer overflow when parsing message lengths
Tried to not to change function signature by relying on saturating addition; could've implemented differently, though I'm not sure if returning an error here would make a huge difference.
2026-09-08 10:46:25 +03:00
Pierre Tachoire 8cb0d4ca34 Merge pull request #3443 from agilgur5/fix-docs-typo-benchmark
docs: fix typo in benchmark summary
2026-09-08 07:51:23 +02:00
Anton Gilgur c18d46c5cc docs: fix typo in benchmark summary
- missing "x" for multiple: it said "16 less" when it should be "16x less"
  - this also matches the style for the line below which says "9x faster"
2026-09-08 01:34:46 -04:00
Pierre Tachoire 909108e293 Merge pull request #3435 from lightpanda-io/remove-beta 2026-09-07 13:57:14 +02:00
Karl Seguin 0f0abf02ea Merge pull request #3409 from lightpanda-io/contextless-custom-elements
webapi: don't upgrade custom elements in a windowless document
2026-09-07 17:46:11 +08:00
Karl Seguin 92d5f8f7ad Merge pull request #3412 from lightpanda-io/worker-cancelled-not-error
webapi: don't fire error event when a worker script fetch is aborted
2026-09-07 17:43:30 +08:00
Karl Seguin 3387310f6e Merge pull request #3426 from lightpanda-io/micro-pseudoclass-parse
perf: Micro-optimize pseudoclass parsing
2026-09-07 17:42:42 +08:00
Karl Seguin 82344c609f Merge pull request #3432 from lightpanda-io/tweak-http-timeouts
http: tweak http timeouts
2026-09-07 17:41:46 +08:00
Karl Seguin 403c5f99c0 Merge pull request #3430 from lightpanda-io/parse-context
webapi: Add context when parsing HTML
2026-09-07 17:41:29 +08:00
Pierre Tachoire 9355cd898b Merge pull request #3434 from lightpanda-io/cors-ci
ci: enable cors
2026-09-07 11:35:47 +02:00
Pierre Tachoire 1717db30b3 update features and and Bidi 2026-09-07 10:35:33 +02:00
Halil Durak 7175148ceb Merge pull request #3245 from lightpanda-io/nikneym/adblock-request-engine
`AdBlocker`: request engine
2026-09-07 11:29:05 +03:00
Pierre Tachoire e3b2696150 remove beta and add a link to WPT results 2026-09-07 10:28:44 +02:00
Halil Durak 7ad73d0a6d changes after rebase 2026-09-07 11:14:15 +03:00
Halil Durak 860c4950e2 first 128 tokens cached at init (common), rest streamed by each engine
Eager tokenization is ~7% of a ~2.1 µs match. A lazy fill saved nothing because every request reaches the first engine. Streaming from scratch per engine cost +10% capped and +16% uncapped, and stayed +10% even with exception gating. The 128 cap changed 1 verdict in 242,908. So we went with hybrid approach: no token is lost, and 97% of URLs still pay one tokenization.
2026-09-07 11:01:03 +03:00
Halil Durak fb58901604 pass *const Request where possible
* remove unnecessary `pub` marking
* metrics tracking cosmetic filters separately
2026-09-07 11:01:03 +03:00
Halil Durak 0a6d43c2bb HttpClient.isAdBlocked should just delegate Adblocker.isBlocked 2026-09-07 11:00:47 +03:00
Halil Durak 486c888080 drop is_subframe and notification 2026-09-07 11:00:47 +03:00
Halil Durak e696a29da7 metrics: make adblocker verdicts measurable 2026-09-07 11:00:05 +03:00
Halil Durak 085b4836ac Adblocker: parser semantics: follow uBO's behavior
* `@@…$important` -> `error.InvalidOption`
* `||host`, `||host^`, `||host|` (and bare `host|`/`|host` lines) all read as "hostname or subdomain" and land in the trie when option-free.
* Wildcard trimming now follows uBO's pointless-wildcard rules.
2026-09-07 10:57:36 +03:00
Halil Durak b60f790a03 Adblocker: changes on request construction & tokenization
* Engine.Request.fromHttp(req, source_url, buffers) now builds the adblock request straight from HttpClient.Request.
* The URL is tokenized once per request (hashed into the Request, shared by all engines); capped at 128 tokens (same as adblock-rust).
* Document hostname longer than 253 bytes now skips adblocking.
2026-09-07 10:57:36 +03:00
Halil Durak 6a85b1f386 handle all switch cases (emerged after rebase to main) 2026-09-07 10:57:36 +03:00
Halil Durak 53f513f1f8 remove unnecessary pub marking 2026-09-07 10:57:35 +03:00
Halil Durak 814a2ab549 update Config + help.zon 2026-09-07 10:57:35 +03:00
Halil Durak 8aa0dda4b3 integrate request engine to Adblocker, apply changes required for filter list in HttpClient 2026-09-07 10:57:35 +03:00
Halil Durak 0b2f14194e AdBlocker: initial implementation for request engine
`Parser`: don't drop cosmetic lines

introduce url pattern matcher

yet-another-url-parser
2026-09-07 10:57:11 +03:00
Pierre Tachoire d00e6e6e4f ci: enable cors 2026-09-07 09:43:26 +02:00
Karl Seguin 6904e9ee49 Merge pull request #3397 from lightpanda-io/isolatedworld-frames
CDP: create an context per isolated world per frame
2026-09-07 14:53:49 +08:00
Karl Seguin e1500338d7 Merge pull request #3424 from navidemad/fix-b5-caret-movement-keys
webapi: move the text entry cursor on caret movement keys
2026-09-07 14:29:14 +08:00
Karl Seguin ec61861b20 http: tweak http timeouts
change --http-timeout default to 15000 (up from 5000)
change --http-connect-timeout default to 8000 (down from 300000, curl's default)

5 second _total_ transfer time can be a little tight. I generally don't see a
good reason to overly limit this value.

Worth noting that help.zon said the default for --http-timeout was 10000, but
it was, in fact, 5000.

Hopefully this improve situations like https://github.com/lightpanda-io/browser/issues/3395
which I believe are due to slow proxies.
2026-09-07 13:19:52 +08:00
Karl Seguin 75b4490ca1 webapi: Add context when parsing HTML
Parsing HTML has different modes. Parsing HTML when setting innerHTML can be
different than parsing HTML inside a template, can be different than ...

html5ever handles this for us, provided we give it the correct context (the
tag name that the content is being parsed into). This adds an optional *Element
to the Parser which is fed into html5ever (its tagname).

Fixes: https://github.com/lightpanda-io/browser/issues/3336
2026-09-07 09:10:26 +08:00
Karl Seguin eaf809d46e remove out of date comment 2026-09-07 08:18:50 +08:00
Navid EMAD ed2a5c6eeb webapi: move the text entry cursor on caret movement keys
A trusted keydown for ArrowLeft/ArrowRight/Home/End (and ArrowUp/ArrowDown
on a single-line <input>) fell through Frame.user_input.editKey, which only
handled Backspace/Delete and printable keys, so the caret never moved, Shift
never extended the selection, and a plain arrow never collapsed one.
innerInsert's no-selection arm also appended to the end of the value instead
of inserting at the caret. Add a moveCaret helper to the shared text entry
mixin (byte offsets stepping over whole UTF-8 sequences, line moves bounded
by '\n'), route the keys to it from editKey, and insert at the caret.

Closes #3423
2026-09-07 08:16:52 +08:00
Karl Seguin b21ec60853 Merge pull request #3411 from lightpanda-io/remove-unused-imports
chore: remove unused imports
2026-09-07 07:20:50 +08:00
Karl Seguin 80f057c741 Merge pull request #3422 from navidemad/fix-a55-textarea-selection-default-value
webapi: clamp text entry selections against the current value
2026-09-07 07:20:31 +08:00
Karl Seguin 0ff64124ff Merge pull request #3403 from lightpanda-io/error-bridge-rejection
chore: leverage bridge for error rejection
2026-09-07 06:58:13 +08:00
Navid EMAD 172614d138 webapi: clamp text entry selections against the current value
`select()`, `setSelectionRange()` and `howSelected()` in the TextEntry mixin
read the `_value` slot directly. That slot only holds an *assigned* value, so
a `<textarea>abcdef</textarea>` straight out of the parser has none and every
selection call collapsed the caret to 0 — while `textarea.value` returned
"abcdef" all along, since `getValue()` falls back to the child text node.

Route the three sites through `getValue()`, matching `innerDelete()`, which
already did. Per HTML, "set the selection range" clamps against the element's
API value, and a textarea's API value is its raw value.

`howSelected()` now also clamps: `selectionStart`/`selectionEnd` store their
argument verbatim, so an offset can outlive a shorter value and reach
`innerInsert()`'s `.partial` arm as an out-of-range slice index.

Closes #3421
2026-09-07 06:48:48 +08:00
Karl Seguin 277df36068 Merge pull request #3418 from navidemad/fix/link-test-getfl-macos
link test: check the O_NONBLOCK bit, not the whole F_GETFL word
2026-09-06 20:42:01 +08:00
Navid EMAD ae6a646797 link test: check the O_NONBLOCK bit, not the whole F_GETFL word
macOS adds an internal 'was written' bit to F_GETFL once the fd has been
written to, so the exact comparison fails there (expected 6, found 65542)
even though the send timed out as intended and O_NONBLOCK is still set.
2026-09-06 20:06:27 +08:00
Karl Seguin 588ec5fcb7 Merge pull request #3420 from navidemad/fix-a56-value-setter-caret
webapi: move the text entry cursor to the end on value set
2026-09-06 20:01:48 +08:00
Karl Seguin 6029d98134 Merge pull request #3416 from navidemad/fix/server-tests-macos-loopback
server tests: wait for loopback readiness on macOS
2026-09-06 20:01:33 +08:00
Karl Seguin 8ba5cb16c3 perf: Micro-optimize pseudoclass parsing
This was already micro-optimizes, but (a) it was needless generic and (b) was
faster than std.mem.eql in some cases, but slower than others. It now applies
both the len/ptr check skip AND the block compare.
2026-09-06 18:16:55 +08:00
Karl Seguin cdf4f936dc Merge pull request #3414 from navidemad/fix-a54-beforeinput-cancelable
webapi: make trusted beforeinput cancelable
2026-09-06 18:14:11 +08:00
Karl Seguin faad885913 improve macos test stability 2026-09-06 18:13:08 +08:00
Navid EMAD c9d79fc46b server tests: wait for loopback readiness on macOS
macOS delivers loopback traffic asynchronously, so LoopTest.accept could
call Server.accept before the handshake ACK landed (NotAccepted) and the
tests could read before the request bytes landed (WouldBlock, RST, and a
double disconnect that cast a -1 socket to usize in KQueue.socketEvent).
Poll for readiness first. Also accept any non-zero SO_KEEPALIVE: BSD
getsockopt returns the option bit, not 1.
2026-09-06 18:13:08 +08:00
Karl Seguin 27a7c3e516 avoid value dupe if unchanged 2026-09-06 18:08:07 +08:00