Commit Graph
5470 Commits
Author SHA1 Message Date
Karl Seguin 795b0affe2 Merge pull request #2102 from lightpanda-io/non-utf8-encoding
Use encoding_rs on non-UTF-8 html to convert to utf-8
2026-04-09 07:25:48 +08:00
Karl Seguin 077b8b1481 Merge pull request #2106 from lightpanda-io/simplify_nodelist_foreach
Simplifies NodeList.foreach
2026-04-08 19:51:15 +08:00
Pierre Tachoire 9915f0f19d Merge pull request #2100 from lightpanda-io/osc/2029-user-agent-override
Allow user agent override with restrictions
2026-04-08 13:20:32 +02:00
Karl Seguin 077263bae4 Simplifies NodeList.foreach
Removes 2 layers of indirection (including 1 allocation) that is unnecessary for
an internal call.
2026-04-08 18:32:47 +08:00
Karl Seguin 763927c352 Use encoding_rs on non-UTF-8 html to convert to utf-8
Using our existing MIME type detection, this uses encoding_rs to convert non-
UTF-8 content to UTF-8, which can then be passed to html5ever.

Issue: https://github.com/lightpanda-io/browser/issues/2089
2026-04-08 18:32:08 +08:00
Pierre Tachoire f884b562ba user-agent ovveride must not contain mozilla 2026-04-08 12:11:09 +02:00
Pierre Tachoire efb2fa9c22 Send Sec-Ch-Ua http header 2026-04-08 12:11:09 +02:00
Pierre Tachoire ae9b4d3fc6 stricter user-agent rule 2026-04-08 12:11:09 +02:00
Trevin Chow f0aacad52e feat: add --user-agent flag for full User-Agent override
When --user-agent is set, the provided string replaces the entire
User-Agent header instead of appending to "Lightpanda/1.0".
The existing --user-agent-suffix behavior is unchanged.

Fixes #2029
2026-04-08 12:11:08 +02:00
Pierre Tachoire 16685019d4 Merge pull request #2107 from lightpanda-io/bump-v8
update zig-v8 deps
2026-04-08 12:10:15 +02:00
Pierre Tachoire cffb6976a4 update zig-v8 deps 2026-04-08 11:41:08 +02:00
Pierre Tachoire 1a285cc9ea Merge pull request #2099 from lightpanda-io/finalizer_order
Clear identity before forcing finalizers
2026-04-07 18:09:31 +02:00
Karl Seguin def713db15 Clear identity before forcing finalizers
We need to remove v8 finalizer callbacks upfront so that, as we tear things down
there's no chance for v8 to try to finalize something which has already been
finalized or is gone.
2026-04-07 21:51:38 +08:00
Adrià Arrufat 67918f004b Merge pull request #2097 from lightpanda-io/simplify-cli-args
Config: remove mcp version flag and simplify usage
2026-04-07 14:41:56 +02:00
Adrià Arrufat afd6c11b34 Config: remove mcp version flag and simplify usage 2026-04-07 12:24:19 +02:00
Karl Seguin 38e3b59ddb Merge pull request #2095 from lightpanda-io/fix_mo_record_release
Don't release pending MutationObserver records
2026-04-07 15:46:00 +08:00
Pierre Tachoire 8b8c659507 Merge pull request #2094 from lightpanda-io/readme-docker
README: expose browser on localhost w/ docker
2026-04-07 09:27:33 +02:00
Karl Seguin 6491ab84ea Don't release pending MutationObserver records
These have not been handed to v8 yet (hence the pending) and can be freed
directly. This is correctly handled in IntersectionObserver.
2026-04-07 15:23:30 +08:00
Pierre Tachoire 3b3917321b Merge pull request #2062 from lightpanda-io/xhr-timeout
Add XMLHttpRequest.timeout with curl enforcement
2026-04-07 09:21:31 +02:00
Pierre Tachoire 65151e9a4c README: expose browser on localhost w/ docker 2026-04-07 09:19:57 +02:00
Karl Seguin cfcd633ff6 Merge pull request #2093 from lightpanda-io/event_manager_base
Extract non-DOM event dispatchig
2026-04-07 14:52:49 +08:00
Pierre Tachoire 8781d7e73b Add XMLHttpRequest.timeout with curl enforcement
Implement the XHR timeout property end-to-end: the JS-visible
getter/setter stores the value, send() passes it to the HTTP client,
and curl enforces it via CURLOPT_TIMEOUT_MS. On timeout, a `timeout`
event is dispatched instead of `error`, per the XHR spec.
2026-04-07 08:47:10 +02:00
Karl Seguin de52c13379 Extract non-DOM event dispatchig
This is standalone work that can be done to enable workers. Workers need a
subset of EventManager, specifically, dispatching events for non DOM objects.
This commit extracts the non-DOM dispatching into an EventManagerBase which
EventManager uses (via composition) and which, in the future, WorkerGlobalScope
will be able to use directly.
2026-04-07 13:03:22 +08:00
Karl Seguin f28a753e1d Merge pull request #2091 from NYCU-Chung/fix/cookie-public-suffix
fix(cookie): reject Set-Cookie domains that are public suffixes
2026-04-07 11:34:30 +08:00
Karl Seguin 8f1e3941ce Merge pull request #2063 from lightpanda-io/websocket
WebSocket WebAPI
2026-04-07 08:55:02 +08:00
Karl Seguin b98eb1292d Merge pull request #2085 from tmchow/feat/2082-handle-javascript-dialog
feat: emit Page.javascriptDialogOpening CDP events for JS dialogs
2026-04-07 08:54:36 +08:00
Karl Seguin 60c2ba22d4 Merge pull request #2086 from lightpanda-io/child_node_node_list_arena
Move the NodeList created from a ChildNode to the ChildNode's arena
2026-04-07 08:44:21 +08:00
Karl Seguin 583525e5ee Merge pull request #2090 from lightpanda-io/rc_assertion
add assertion on RC (to catch release overflow)
2026-04-07 08:38:02 +08:00
Karl Seguin de8a5eeec1 zig fmt 2026-04-07 07:28:31 +08:00
Karl Seguin 36d3be5534 add assertion on RC (to catch release overflow) 2026-04-07 07:28:31 +08:00
Karl Seguin 12cb3eac07 Merge pull request #2092 from lightpanda-io/cdp_keyboard_event_lifetime
Don't release un-acquired reference on CDP input event.
2026-04-07 07:12:07 +08:00
Trevin Chow 7208934bda fix: return CDP error from handleJavaScriptDialog instead of silent no-op
Dialogs auto-dismiss in headless mode, so there is no pending dialog
by the time the CDP client sends Page.handleJavaScriptDialog. Return
an explicit error so the client knows the action had no effect.
2026-04-06 11:08:27 -07:00
Karl Seguin f813d34897 Don't release un-acquired reference on CDP input event. 2026-04-06 23:06:03 +08:00
Karl Seguin 8489ec380b Merge pull request #2087 from lightpanda-io/invalid_datetime
protect against index out of bound on invalid datetime
2026-04-06 21:50:41 +08:00
Karl Seguin 8568dc1285 Merge pull request #2088 from lightpanda-io/domainless_cookies
Better handling of cookies with empty domains
2026-04-06 21:50:21 +08:00
NYCU-Chung d917728053 fix(cookie): reject Set-Cookie domains that are public suffixes
parseDomain() rejects bare TLDs (e.g. Domain=.io) but accepts
multi-level public suffixes like .co.uk, .com.au, .co.jp.

Per RFC 6265bis §5.7.3.10, user agents should reject cookies whose
domain attribute is a public suffix. Chrome, Firefox, and Safari all
enforce this using the Public Suffix List.

The PSL data is already imported (Cookie.zig:26) and used in
findSecondLevelDomain(), but parseDomain() does not consult it.

This causes behavior differences vs Chrome when automating .co.uk /
.com.au / .co.jp sites via CDP — cookies that Chrome silently drops
are accepted by Lightpanda, polluting the cookie jar across unrelated
sites in the same session.
2026-04-06 20:39:56 +08:00
Karl Seguin c4fd37127e Better handling of cookies with empty domains 2026-04-06 16:56:09 +08:00
Karl Seguin e54c99d0f0 protect against index out of bound on invalid datetime 2026-04-06 16:32:48 +08:00
Karl Seguin 918d3709fe Move the NodeList created from a ChildNode to the ChildNode's arena 2026-04-05 08:13:38 +08:00
Karl Seguin 5826caf6dc Merge pull request #2070 from lightpanda-io/mcp-new-action-tools
mcp: Add hover, press, selectOption, setChecked
2026-04-04 10:20:54 +08:00
Karl Seguin b0c6c2d591 Merge pull request #2083 from tmchow/fix/2080-keyboard-event-propagation
fix: propagate keyUp and char keyboard events to JS listeners
2026-04-04 08:19:53 +08:00
Trevin Chow b33bb54442 fix: propagate keyUp and char keyboard events to JS listeners
dispatchKeyEvent only handled keyDown, returning early for keyUp,
rawKeyDown, and char types. This meant JS keyup and keypress
listeners never fired via CDP.

Now keyUp dispatches as "keyup" and char dispatches as "keypress".
rawKeyDown remains a no-op (Chrome-internal, not used for JS dispatch).

Fixes #2080
Ref #2043
2026-04-03 17:08:09 -07:00
Trevin Chow 95f80c9645 feat: emit Page.javascriptDialogOpening CDP events for JS dialogs
window.alert(), confirm(), and prompt() now dispatch a
javascript_dialog_opening notification that the CDP layer
forwards as a Page.javascriptDialogOpening event. This enables
Puppeteer's page.on('dialog') to fire when JS dialogs open.

Also adds Page.handleJavaScriptDialog as a CDP method. Dialogs
still auto-dismiss in headless mode (alert is void, confirm
returns false, prompt returns null), so handleJavaScriptDialog
is an acknowledgement rather than a blocking gate.

Changes:
- Notification.zig: add JavascriptDialogOpening event type
- CDP.zig: register listener, forward to page domain
- page.zig: handleJavaScriptDialog handler + event emitter
- Window.zig: alert/confirm/prompt dispatch the notification

Fixes #2082
Ref #2043
2026-04-03 16:59:21 -07:00
Karl Seguin c4250418af Address feedback
-dispatch error on abnormal close
-reciprocal close message
-more url validation
-cleanup dead code
2026-04-04 07:39:55 +08:00
Karl Seguin 6bf35e1ed4 try to improve test ws shutdown, merge ws tests 2026-04-04 07:00:26 +08:00
Karl Seguin 0d75c00f85 update v8 dep 2026-04-04 07:00:26 +08:00
Karl Seguin 6d83da5161 support 'blob' binaryType 2026-04-04 07:00:26 +08:00
Karl Seguin 14dcb7895a Give websockets their own connection pool, improve websocket message logging 2026-04-04 07:00:24 +08:00
Karl Seguin 5733c35a2d WebSocket WebAPI
Uses libcurl's websocket capabilities to add support for WebSocket.

Depends on https://github.com/lightpanda-io/zig-v8-fork/pull/167
Issue: https://github.com/lightpanda-io/browser/issues/1952

This is a WIP because it currently uses the same connection pool used for all
HTTP requests. It would be pretty easy for a page to starve the pool and block
any progress.

We previously stored the *Transfer inside of the easy's private data. We now
store the *Connection, and a Connection now has a `transport` field which is
a union for `http: *Transfer` or `websocket: *Websocket`.
2026-04-04 06:59:28 +08:00
Pierre Tachoire 06fe6c5e7d Merge pull request #1934 from lightpanda-io/http-cache
HTTP Caching
2026-04-03 17:11:06 +02:00