Commit Graph

8486 Commits

Author SHA1 Message Date
Pierre Tachoire
9c224c59b6 Merge pull request #2815 from lightpanda-io/version-fmt
ci: Generate a versions.json file
2026-06-26 05:44:43 +00:00
Pierre Tachoire
9cae6b07e6 Merge pull request #2797 from lightpanda-io/brotli-false-err
fix: work around libcurl Brotli trailing-byte rejection (CURLE_WRITE_ERROR)
2026-06-26 05:43:38 +00:00
Karl Seguin
b473b019cb Merge pull request #2814 from lightpanda-io/telemetry_thread
telemetry: Move telemetry worker to its own thread
2026-06-26 08:55:26 +08:00
Karl Seguin
05986de731 Merge pull request #2818 from lightpanda-io/no_note_logs_on_test
minor: don't log .note level logs during unit tests
2026-06-26 08:43:46 +08:00
Karl Seguin
13eb35720a telemetry: Move telemetry worker to its own thread
This reverts recent(ish) changes to telemetry which moved it from its own thread
onto the main thread.

The downside is: we have an extra thread.

The upside is largely that Network.zig becomes drastically simpler and more
efficient. There's a bunch of machinery in Network.zig to support arbitrary
workers, of which Telemetry is the only one. There's also a lot of code to
support an optional multi and requests made to is. This is all removed.

Also, fetch, agent and mcp without a cdp server no longer even need to start
the network loop. And, it IS started (e.g. serve/cdp), there's no longer an
arbitrary 250ms wakeup on poll to progress workers. Nor can telemtry block CDP.

Telemetry's implementation itself was changed. The ring buffer was removed in
favor of a double-buffer arraylist. When telemetry is disabled, this saves
64Kb of memory. When it's enabled, it creates more allocator churn, but should
still use less memory in most cases (and never more). Finally, Telemetry is
given its own easy connection rather than using one out of the pool (which
workers would maybe like to use).
2026-06-26 08:38:49 +08:00
Karl Seguin
5fcdc1c5ad Merge pull request #2808 from lightpanda-io/fetch-multiple-urls
cli: fetch multiple urls
2026-06-26 08:36:26 +08:00
Karl Seguin
cd6c027dd9 Merge pull request #2807 from lightpanda-io/runner
design: Runner supports multi-pages
2026-06-26 08:36:07 +08:00
Karl Seguin
ec1d6fcb27 minor: don't log .note level logs during unit tests 2026-06-26 08:34:24 +08:00
Karl Seguin
5d604d109f slight optimization to hasRunnablePage 2026-06-26 08:22:33 +08:00
Karl Seguin
e1a8e036c6 webapi: Make Worker a proper DedicatedWorkerGlobalScope
When you create a worker (new Worker(...)), it creates 2 objects: the Worker
that lives in the caller, and the WorkerGlobalScope (WGS) which is more or less
like a Window, with its own v8::Context.

But WGS is really a base class meant to be used with various types of workers.
new Worker() shouldn't create a WGS directly, it should create a
DedicatedWorkerGloblaScope, which inherits from WGS. For now, our WGS can only
have 1 type (DedicatedWGS).

This fixes various errors on www.kitandace.com which would launch workers, and
then do a check (if (this === DedicatedWorkerGloblaScope)). It _should_ have
returned true, but it didn't (because our workers were WGS).
2026-06-26 07:50:39 +08:00
Pierre Tachoire
4d07f47da1 Generate a versions.json file 2026-06-25 17:45:19 +02:00
Halil Durak
004dbf259e Anchor: update tests 2026-06-25 18:06:09 +03:00
Halil Durak
30f10b4966 prefer error-less URL resolver for various getters 2026-06-25 18:06:09 +03:00
Halil Durak
f6fb653a35 prefer resolveNavigation at page, target and fetch 2026-06-25 18:06:08 +03:00
Halil Durak
67cc2be817 URL.zig: update tests 2026-06-25 18:05:49 +03:00
Halil Durak
6bd4fddf62 URL: add resolveNavigation
This is needed for schemeless "address bar" style URLs. Would love to have a path that doesn't allocate for this...
2026-06-25 18:05:49 +03:00
Halil Durak
82d78ecd00 Node: add resolveURLReflect 2026-06-25 18:05:49 +03:00
Halil Durak
a499c0cb92 URL: update tests 2026-06-25 18:05:48 +03:00
Halil Durak
7d5553238e URL: changes on host(name) setter, introduce clean_hostname_input 2026-06-25 18:05:48 +03:00
Halil Durak
0c4f6f0d87 getProtocol(Anchor, Area): return : if resolved href is null 2026-06-25 18:05:48 +03:00
Halil Durak
84fe33c679 URL(EncodeSet): bring back component value
Lost and found.
2026-06-25 18:05:48 +03:00
Halil Durak
a12d781d4a KeyValueList.zig: update tests 2026-06-25 18:05:48 +03:00
Halil Durak
2cdcecaba4 KeyValueList(urlEncodeUnreserved): drop ~ case 2026-06-25 18:05:48 +03:00
Halil Durak
84870d5524 URL: include leading '?' in search/query 2026-06-25 18:05:48 +03:00
Halil Durak
8d41c6e221 KeyValueList: write = between key and value at all modes 2026-06-25 18:05:48 +03:00
Halil Durak
20c9a873fd URL: update tests 2026-06-25 18:05:47 +03:00
Halil Durak
e223827789 URL: reintroduce parse static method 2026-06-25 18:05:47 +03:00
Halil Durak
3c91f3b3e2 URL: fix missing port problem in setter 2026-06-25 18:05:47 +03:00
Halil Durak
7bf68a484d URL: replace ensureEncoded with resolve
Both essentially do the same; we can stick to `resolve` for further IDNA compat.
2026-06-25 18:05:47 +03:00
Halil Durak
9732c33c3c URL: remove always_dupe option from all call sites 2026-06-25 18:05:08 +03:00
Halil Durak
3512f1fb1a update URL-involving tests 2026-06-25 18:05:08 +03:00
Halil Durak
be6f1c9155 Caller: remove error.Idna case 2026-06-25 18:05:08 +03:00
Halil Durak
fc00421870 URL: retake on resolve function 2026-06-25 18:05:08 +03:00
Halil Durak
0ddca754a4 URL: move resolver functions to Rust
Implements `url_resolve_with_encoding` and `url_resolve_without_encoding` in Rust; that way, we don't pay the cost of extra `Box`es we allocate during resolving.
2026-06-25 18:05:08 +03:00
Karl Seguin
93ff42b161 debug: limit macrotask runner to when we have a page
This is the only main change in this branch compared to main that could explain
the Debug check failed: isolate()->CurrentLocalHeap()->IsRunning() failure
being reported.
2026-06-25 18:53:44 +08:00
Karl Seguin
bb15e5ff08 pr feedback: Run background tasks, push wait errors to caller
This fixes two bugs introduced in the previous PR. First, in non-CDP mode, when
there's nothing to do except v8 background tasks, we wait for those background
tasks.

Second, the various wait helpers (e.g. waitForFrame) now return the first error
of any WaitCondition.
2026-06-25 18:16:27 +08:00
Karl Seguin
dcab57cd05 Merge pull request #2813 from lightpanda-io/fix-handlescope-corruption
crash: Fix handlescope corruption on iframe load
2026-06-25 17:42:42 +08:00
Karl Seguin
108d5c68fd crash: Fix handlescope corruption on iframe load
In trying to fuzz test a different issue, I ran into a reproducible case where
we end up with a broken handlescope stack. The issue requires a large number
of handlescopes created with aggressive GC, so hopefully it isn't something
that too many users have run into.

The issue is that a single HandleScope address is used to initialize two
HandleScopes. The fix could just be to create a 2nd HS variable (to get a 2nd
address), but the first initialization is unnecessary and can just be removed.

(Note that EventManager dispatch creates its own HandleScope, so the one
removed in frameCompletedLoading really did nothing)
2026-06-25 17:41:42 +08:00
Pierre Tachoire
4faed74af0 Merge pull request #2809 from lightpanda-io/intercepted_abort_double_free
uaf: Prevent double-free on BrowserContext deinit with pending interc…
2026-06-25 09:26:37 +00:00
Karl Seguin
0fd73650fc Merge pull request #2801 from lightpanda-io/document-setDomain
webapi: Expose document.domain setter
2026-06-25 14:13:59 +08:00
Karl Seguin
5c902b6cfe crash: Fix handlescope corruption on iframe load
In trying to fuzz test a different issue, I ran into a reproducible case where
we end up with a broken handlescope stack. The issue requires a large number
of handlescopes created with aggressive GC, so hopefully it isn't something
that too many users have run into.

The issue is that a single HandleScope address is used to initialize two
HandleScopes. The fix could just be to create a 2nd HS variable (to get a 2nd
address), but the first initialization is unnecessary and can just be removed.

(Note that EventManager dispatch creates its own HandleScope, so the one
removed in frameCompletedLoading really did nothing)
2026-06-25 10:52:39 +08:00
Karl Seguin
f2eaeb1c9a uaf: Prevent double-free on BrowserContext deinit with pending interception
Adds a abortParked (to be used instead of abort for a parked transfer) which
guards against a double-free by setting the state to .completing BEFORE running
the requestFailed callback. Without this, requestFail could itself cause the
transfer to be cleared.

Also added a guard to try to catch double transfer deinit's in Debug. Because
the memory could get re-used between the first and second free, the lack of
failure doesn't prove there is no UAF. But it's cheap to do and debug only.
2026-06-24 20:09:00 +08:00
Karl Seguin
630826160e cli: fetch multiple urls
Modified the fetch command to support multiple URLs. Only allowed when --json
is specified (we can revisit this limitation if anyone asks for it, but for now
it's the only non-ambiguous way to get multiple results).

Probably not a big surprise, but the performance gain comes from being able to
concurrently fetch resources. On fast network, or with caching enabled, the
difference wouldn't be so significant:

```
time begin;
./lightpanda fetch "https://github.com/lightpanda-io/browser/" --json;
./lightpanda fetch "https://www.reddit.com/r/Zig/comments/1p0ur0d/i_started_learning_zig" --json;
end
10.28 secs
```

vs

```
time ./lightpanda fetch --json \
  "https://github.com/lightpanda-io/browser/" \
  "https://www.reddit.com/r/Zig/comments/1p0ur0d/i_started_learning_zig"
5.12 secs
```
2026-06-24 18:16:02 +08:00
Karl Seguin
39046492f1 design: Runner supports multi-pages
Follow up to https://github.com/lightpanda-io/browser/pull/2789 which adds
better multi-page support for runner. When waiting, callers have the choice
to wait for a specific frame, all current frames, or a given list of frames. The
last one, a given list of frames, is the most flexible, allowing callers to
provide an `until` per frame AND receive a per-frame result.

waitForSelector and waitForScript continue to be per frame (which is now
explicitly given).

Like 2789, while the changes aren't insignificant (Runner is doing important
work), a number of files were touched either purely because of changes in tests
or other superficial changes, e.g. `session.runner` is now infallible.
2026-06-24 17:44:58 +08:00
Pierre Tachoire
8ccbc4d730 Merge pull request #2790 from lightpanda-io/hash-change-event
webapi: add HashChangeEvent and Window hashchange event
2026-06-24 06:28:41 +00:00
Pierre Tachoire
72af3de5d0 Merge pull request #2805 from lightpanda-io/fix-homebrew-release
ci: fix homebrew release workflow name
2026-06-24 06:28:07 +00:00
Pierre Tachoire
4e97d1e2e9 ci: fix homebrew release workflow name 2026-06-24 08:13:36 +02:00
Karl Seguin
7b585df7ff Merge pull request #2789 from lightpanda-io/multi-page-sessions
design: multi-page session
2026-06-24 07:39:40 +08:00
Karl Seguin
6d1efd15e0 remove stale comment 2026-06-24 07:01:32 +08:00
Karl Seguin
9482a9af98 Cleanup sloppy tests, Fix potential UAF, smaller cleanup (PR feedback).
Cleanup sloppy tests, make sure pages are always closed after page tests - not
before and not never.

Fix a UAF in replaceRootImmediate..if a page is being retired, also retire its
replacement.

Give BrowserContext a Session.PageHandle rather than having a frame_id and re-
implementing PageHandle logic.
2026-06-24 07:01:31 +08:00