Commit Graph

8347 Commits

Author SHA1 Message Date
Karl Seguin
3d92b2d01a webapi: more (and better) replaceable proeprties.
Window.event, screen, visualViewport and crypto are all [Replaceble]. This
should be all the one's we're missing.

Also, apply the repleceable on the correct v8 global's context in the case where
a caller reaches into an iframe to replace a property on the iframe's window.

Fixes endless loop on https://100500dobavok.ua/ which replaces window.event.
2026-07-06 19:06:36 +08:00
Karl Seguin
38b008976d fix, render: CSS getPropertyValue special width/height handling
When CSSStyleDeclaration.getPropertyValue is called for width or height, and the
inline style isn't found, return the elements actual width/height. Without this
we return "" which is wrong and can cause script error/hangs.
2026-07-06 18:18:46 +08:00
Karl Seguin
ea4f2ed5c8 Merge pull request #2882 from lightpanda-io/cleanup-help
minor: standardize help options
2026-07-06 17:48:54 +08:00
Karl Seguin
c31a5fd243 minor: remove DOMException WebAPI flag (make it always on).
This change touches a lot of files, but it's pretty minor. Most files simply
have .dom_exception = true  removed from their WebAPI binding.

The only reason NOT to have this on is in the case where a Zig function returns
an error that incorrectly gets mapped to a DOMException. But this hasn't
happened yet, none of the base errors (e.g. OutOfMemory) map to a DOMException,
but the opposite DOES happen: we don't flag an API as dom_exception = true that
we should.
2026-07-06 14:37:20 +08:00
Karl Seguin
9f791498ae Merge pull request #2866 from lightpanda-io/nikneym/linux-bsd-cert-loading
networking: faster certificate loading for Linux and BSDs
2026-07-06 09:57:45 +08:00
Halil Durak
90387b401d Network: check if cert store is empty 2026-07-05 11:40:39 +03:00
Karl Seguin
e71cd94582 Merge pull request #2886 from lightpanda-io/loader_feature_detect
webapi: implement HTMLScriptElement.supports and DOMTokenList.supports
2026-07-05 08:02:59 +08:00
Karl Seguin
83c412765c call_arena -> local_arena 2026-07-05 07:49:07 +08:00
Adrià Arrufat
3dcbb46834 webapi: implement HTMLScriptElement.supports and DOMTokenList.supports
Module loaders (Vite legacy plugin, Shopify themes) feature-detect
HTMLScriptElement.supports("module") and
link.relList.supports("modulepreload"). Both were missing, so themes
fell back to fetch()-based legacy chunk loading: on allbirds.com that
meant 676 requests instead of 305 for two page loads, the same module
fetched 9x per page by page JS, and a ~4% CDP driver flake from the
legacy path replacing the document mid-query (0/50 repro with this
change, vs failing within 3 iterations without).

HTMLScriptElement.supports returns true for the types this engine
loads (classic, module, importmap). DOMTokenList.supports implements
the rel supported-tokens set and throws TypeError for attributes that
define none, per spec.
2026-07-04 20:27:26 +02:00
Adrià Arrufat
985e7ded06 script: reject failed goto starts outside the browser isolate
startGoto runs under the browser's isolate; its error path rejected the
script-isolate resolver via a `return` inside that block, i.e. before
the deferred isolate exit — v8::Exception::Error on the wrong isolate,
SIGSEGV. Reached by any goto that fails to start: page.goto(null) (an
extract miss flowing into goto), malformed arguments.

Yield null from the isolate block and settle the resolver after it.
2026-07-04 15:25:21 +02:00
Adrià Arrufat
1c9acfa6bc Merge pull request #2878 from lightpanda-io/agent-vertex
agent: add Google Vertex AI support
2026-07-04 12:10:32 +02:00
Halil Durak
a2fae6b0eb Network: remove check for 0-sized bundle buffer 2026-07-04 12:19:10 +03:00
Halil Durak
c192303bf7 Network: faster cert store creation on Linux and BSDs
There was a `TODO` comment about this; nicer to actually have it. There's still stdlib's certificate bundle scanner for platforms we can't do this (like macOS).
2026-07-04 12:19:10 +03:00
Halil Durak
c967469c49 libcrypto: bind X509_STORE_load_locations 2026-07-04 12:19:09 +03:00
Karl Seguin
c204623755 webapi: Add static Response.json, Response.error and Response.redirect 2026-07-04 16:28:50 +08:00
Karl Seguin
37033003dd Merge pull request #2867 from lightpanda-io/nikneym/curl-easy-setopt-refactor
`libcurl`: refactor `curl_easy_setopt`
2026-07-04 15:43:26 +08:00
Karl Seguin
a25bdc4d9b minor: standardize help options
Places the options in alphabetic order and applies the same indentation for
all commands (agent was formatted quite differently than the others).

While I would also like "more common" commands to be listed first, since they
can only be sorted one way, I find alphabetic to be the most generally useful
and the easier for us to maintain.

Feel free to reject this if you disagree.
2026-07-04 15:39:30 +08:00
Halil Durak
ca1b625d51 libcurl: reintroduce Curl* prefix for function pointer types 2026-07-04 10:01:44 +03:00
Halil Durak
f17569f613 revert changes in HttpClient and WebSocket 2026-07-04 10:01:44 +03:00
Halil Durak
0011f87d82 libcurl: fix VERIFYHOST comment 2026-07-04 10:01:44 +03:00
Halil Durak
f2fce9310c update all call-sites that are using curl_easy_setopt 2026-07-04 10:01:43 +03:00
Halil Durak
a8a10b9ba4 libcurl: refactor curl_easy_setopt
Removes lying dead code here and simplifies `curl_easy_setopt` type checking. Also marks passed callbacks as with C calling convention in order to get away from additional function wrapping.
2026-07-04 10:01:43 +03:00
Karl Seguin
6095d3a0e1 webapi: Add DOMPoint and DOMPointReadOnly
Saw these show up in indexeddb WPT tests. Don't know how used they are, but
very simple to add.
2026-07-04 14:09:28 +08:00
Karl Seguin
5056140bff Merge pull request #2857 from lightpanda-io/detach_global
v8: When re-using window, detach from original context first
2026-07-04 13:39:17 +08:00
Karl Seguin
1c3c6e05c4 Merge pull request #2872 from lightpanda-io/add_worker_interfaces
webapi: Add 6 more interfaces to Worker
2026-07-04 13:38:33 +08:00
Karl Seguin
62ecfb48d8 Merge pull request #2880 from lightpanda-io/script_replay_nav_fixes
script: fix two replay crashes on tool-triggered navigation and $LP_* goto URLs
2026-07-04 10:27:24 +08:00
Karl Seguin
a082dc2b07 update v8 2026-07-04 07:29:40 +08:00
Adrià Arrufat
cfd61ca69e tools: resolve $LP_* placeholders in startGoto
The script runtime's async goto path calls startGoto directly,
bypassing the substituteStringArgs pass that call() applies to every
other tool, so $LP_* placeholders in goto URLs (a base URL, a username
in the path) stayed literal and the navigation failed on replay.
2026-07-03 23:52:40 +02:00
Adrià Arrufat
ae2359c1af script: fix segfault when a tool call triggers navigation
A press/click that submits a form or follows a link commits a
replacement Page inside the tool call itself (finalizeAction ->
awaitQueuedNavigation), freeing the Frame that
Session._tool_frame_override still pointed at; finalizeAction then
dereferenced it via requireFrame -> currentFrame. Any script whose
press/click navigated crashed on replay.

Store a frame id instead of a pointer and resolve it at every
currentFrame call. The replacement page keeps the frame id (see
commitPendingPage), so the same handle stays routable across the swap.
2026-07-03 23:52:29 +02:00
Adrià Arrufat
ff7545a8c3 agent: add Google Vertex AI support
Supports both express mode (via VERTEX_API_KEY) and project mode
(via GOOGLE_CLOUD_PROJECT and gcloud auth). Handles automatic
OAuth token retrieval and refresh.
2026-07-03 20:23:51 +02:00
Karl Seguin
f6fdec3300 Merge pull request #2876 from lightpanda-io/content-type-makrdown
handle text/makrdown as plain text
2026-07-03 22:46:48 +08:00
Karl Seguin
213126e08b Merge pull request #2875 from lightpanda-io/rm-100-continue
Disable Expect: 100-continue with curl
2026-07-03 22:24:30 +08:00
Karl Seguin
933dc61bf6 Merge pull request #2869 from lightpanda-io/closest_cached_selector
perf: used cachedParse for closest and waitForSelector
2026-07-03 21:18:23 +08:00
Pierre Tachoire
c74f18acc2 handle text/makrdown as plain text 2026-07-03 13:25:31 +02:00
Karl Seguin
3f16812797 perf: Remove Seletor cache from Runner's waitForSelector
From feedback, using cachedParse in waitForSelector outside the loop risks
having the cached selector freed. For this reason, I'm reverting this part of
the previous commit. waitForSelector already pre-parsed the selector and I think
this is the better choice.

Pre-parsed means that we avoid the cache lookup in the [potentially] tight wait
loop. The advantage of hitting the cache inside the loop is only if
waitForSelector is called multiple times, which doesn't typically happen.
2026-07-03 19:14:41 +08:00
Adrià Arrufat
2170b34ea9 ci: agent-regression is manual-only, drop the nightly cron
Claude-Session: https://claude.ai/code/session_01SG5kc3gGurhT7N6f63cjMq
2026-07-03 12:01:05 +02:00
Pierre Tachoire
e37e13b364 Disable Expect: 100-continue with curl
Curl sends by default an `Expect: 100-continue` header with some `POST`
requests. But it can slow down the whole request if the server doesn't
handle it correclty.
Forcing an `Expect:` header disable the curl's default behavior.

see https://everything.curl.dev/http/post/expect100.html or
https://gms.tf/when-curl-sends-100-continue.html
2026-07-03 11:42:35 +02:00
Karl Seguin
aa3b30754d Merge pull request #2873 from lightpanda-io/tweak_parser_node_insert
refactor: Cleanup parser/non-parser Frame._insertNodeRelative
2026-07-03 17:00:22 +08:00
Karl Seguin
917a6b5176 Merge pull request #2871 from lightpanda-io/reclaim_large_ws_buffer
mem: reclaim large WS buffer
2026-07-03 17:00:00 +08:00
Karl Seguin
8c4219c2b5 Merge pull request #2870 from lightpanda-io/default_max_connections
perf: Increase default max connections
2026-07-03 16:59:42 +08:00
Adrià Arrufat
f7bcdace77 ci: drop temporary push trigger, cross-repo wiring validated green
Claude-Session: https://claude.ai/code/session_01SG5kc3gGurhT7N6f63cjMq
2026-07-03 10:13:43 +02:00
Adrià Arrufat
bd95d9a610 test: consume agent regression suite from lightpanda-io/demo
The suite moved to the demo repo (machinery in agent/, targets the
existing public/ sites — lightpanda-io/demo#206). Delete the in-repo
copy and point the agent-deterministic job, agent-regression.yml, and
make test-agent at the demo checkout, passing the binary via LPD_PATH
(the same variable wptrunner uses) — same consumption model as
runner/integration/wpt.

Includes a temporary push trigger on agent-regression.yml to validate
the cross-repo wiring pre-merge; dropped before merging.
2026-07-03 09:59:29 +02:00
Karl Seguin
bf4d4f7ede refactor: Cleanup parser/non-parser Frame._insertNodeRelative
_insertNodeRelative weaved the from_parser comptime through a different
conditions. It made reading the code difficult, but also optimizing it. This
commit extracts the common code (notifyChildInserted) and handles from_parser
in one cohesive chunk.

One benefit of this is that isConnected() is no longer called when from_parser
is true.
2026-07-03 13:24:30 +08:00
Karl Seguin
8a20823e78 Merge pull request #2868 from SyntaxSawdust/fix/charset-unicode-mojibake
Fix charset=unicode HTML prescan fallback
2026-07-03 11:41:32 +08:00
Karl Seguin
5a182d96f4 webapi: Add 6 more interfaces to Worker
CustomEvent, FileList, MessagePort, MessageChannel, Notification, ProgressEvent
2026-07-03 11:12:02 +08:00
Karl Seguin
23ab2df58e mem: reclaim large WS buffer
We'll grow the WS read buffer up to cdp-max-message-size (1MB default), but
never reclaim that space. A lot of drivers send large message upfront and then
settle into sending smaller ones.

This commit shrinks the buffer to 256KB (or cdp-max-message-size, whichever is
smaller) after 8 consecutive small message (tracking consecutive messages to
prevent a spat of allocation -> shink -> allocation -> shrink ->...)
2026-07-03 10:46:39 +08:00
Karl Seguin
f1e49aae6e perf: Increase default max connections
max http connections 10 -> 40
max http connetions per host 4 -> 6

These are just the defaults and can still be adjusted by the command line
arguments. 6 appears to be both Chrome and FireFox's default per host (which
is probably the more important of the two settings).

The limits are really use-case specific. A use case that it multi-threading
different domains can benefit from a conservative max-host with a very large
max conn. A use case that is multi-threading the same host will need to decide
if it's safe to raise max-host.
2026-07-03 09:43:13 +08:00
Karl Seguin
adf474774e perf: used cachedParse for closest and waitForSelector
closest was already hitting the cache, but it was doing it inside the loop.
Moving it outside the loop avoids the cache lookup.

Inversely, Runner.waitForSelector was parsing outside the loop, but it wasn't
caching. Repeated calls to waitForSelector with the same selector would not
leverage the cache.
2026-07-03 09:36:21 +08:00
Karl Seguin
c5a5991b1c Merge pull request #2864 from lightpanda-io/cache-computed-style
cache the computed-style object per element
2026-07-03 08:28:22 +08:00
Karl Seguin
c4d6c84cdb Merge pull request #2865 from lightpanda-io/network-idle-per-frame
frame: emit networkIdle lifecycle events for child frames
2026-07-03 08:19:53 +08:00