Commit Graph

6125 Commits

Author SHA1 Message Date
Adrià Arrufat
2dffd6099f Frame: use byte buffer for console messages
Replaces ArrayList(ConsoleMessage) with an allocating byte buffer.
Limits storage to 64KB and returns pre-formatted text when draining.
2026-05-04 07:45:43 +02:00
Adrià Arrufat
8ce0624f0d agent: clarify that WAIT waits for DOM presence 2026-05-04 07:23:06 +02:00
Adrià Arrufat
bdfe0c8674 browser: replace ArrayListUnmanaged with ArrayList 2026-05-04 06:54:32 +02:00
Adrià Arrufat
4bfc1501ed Merge branch 'main' into agent 2026-04-30 20:42:23 +02:00
Adrià Arrufat
eb14783af7 agent: rename Pandascript to PandaScript and .panda to .lp 2026-04-30 17:29:36 +02:00
Adrià Arrufat
300fdfb34c agent: add MCP server mode with task tool 2026-04-30 17:11:48 +02:00
Adrià Arrufat
85f2a08128 agent: update docs 2026-04-30 16:29:52 +02:00
Adrià Arrufat
751feaafae agent: prevent line corruption on tab completion 2026-04-30 16:28:37 +02:00
Adrià Arrufat
7aef08f28b agent: replace QUIT command with /quit slash command 2026-04-30 16:22:19 +02:00
Adrià Arrufat
5b66a4f227 agent: add agent mode and pandascript documentation 2026-04-30 16:06:47 +02:00
Adrià Arrufat
ec8d53d684 agent: rename exit to quit and remove command aliases 2026-04-30 16:06:05 +02:00
Adrià Arrufat
44311c20aa agent: add REPL completion hint 2026-04-30 15:57:22 +02:00
Pierre Tachoire
9a9e79ebc1 Merge pull request #2328 from lightpanda-io/ci-cdp-log
ci: save cdp logs by using cdpproxy
2026-04-30 14:55:35 +02:00
Adrià Arrufat
8be792133c agent: add auto-completion hints for commands and tools 2026-04-30 14:06:31 +02:00
Karl Seguin
216cec5e42 Merge pull request #2335 from lightpanda-io/window_close
Defer window.close()
2026-04-30 19:58:21 +08:00
Pierre Tachoire
ba28324a9e ci: save cdp logs by using cdpproxy 2026-04-30 12:35:30 +02:00
Karl Seguin
f921869fb6 Defer window.close()
Cannot Frame.deinit in window.close() as that's happening inside JS runtime.
Instead, defer on Page.deinit. This is MUCH later than necessary, but I'd like
to address the timing separately. This commit, as-is, prevents real crashes.
2026-04-30 18:04:56 +08:00
Karl Seguin
fe77694437 Merge pull request #2310 from navidemad/fix-a22-iscontenteditable
dom: implement HTMLElement.isContentEditable IDL attribute
2026-04-30 16:09:56 +08:00
Adrià Arrufat
59dcb13cb4 Merge branch 'main' into agent 2026-04-30 07:36:48 +02:00
Navid EMAD
2af95af678 dom: return false from isContentEditable, log when spec says true
Per maintainer review (PR #2310), Lightpanda has no caret/keyboard editing
pipeline, so honoring the spec-correct value risks routing downstream CDP
clients (notably Puppeteer's dispatchKeyEvent path) into an input pipeline
that silently no-ops. Switch to always returning false and emit
log.info(.not_implemented, "IsContentEditable", .{}) when the spec walk
would have produced true, so the unsupported case surfaces in telemetry
rather than masquerading as a working state.

The HTML §7.7.5.2 walk is preserved (nearest ancestor with `contenteditable`
wins, "false" disables) but only used to gate the log emission. The fixture
is reduced to assert the always-false return across the same shape of
inputs, with a comment pointing back at the rationale.
2026-04-30 07:28:43 +02:00
Karl Seguin
e42acc5335 Merge pull request #2322 from navidemad/fix-a27-prompt-default-text
cdp: fall back to dialog defaultText when LP.handleJavaScriptDialog promptText is null
2026-04-30 12:12:33 +08:00
Karl Seguin
2c52e9b34c Merge pull request #2324 from navidemad/fix-a28-label-click-activation
dom: run label activation behavior on click
2026-04-30 11:56:59 +08:00
Karl Seguin
dd4a46dc16 Merge pull request #2331 from sunguru98/bugfix/element-getelements-by-tagname
browser: change node filter from lower to tag_name
2026-04-30 11:56:29 +08:00
Karl Seguin
64fbd55746 Merge pull request #2327 from lightpanda-io/nikneym/httponly-cookie
`Cookie`: don't allow JS context to mutate HttpOnly cookies
2026-04-30 11:52:44 +08:00
Sundeep Charan Ramkumar
91c0edddad browser: change node filter from lower to tag_name 2026-04-30 08:28:18 +05:30
Karl Seguin
1f40c30901 Merge pull request #2290 from lightpanda-io/worker-script-manager-split
Split ScriptManager to support worker module imports
2026-04-30 10:27:54 +08:00
Karl Seguin
896adc14d0 Merge pull request #2299 from lightpanda-io/idn
Initial idn support
2026-04-30 09:30:38 +08:00
Karl Seguin
c2a1b6fd64 Split ScriptManager to support worker module imports
Extract module-loading plumbing into ScriptManagerBase so workers can
use it. Previously Context.script_manager was null for worker contexts,
which crashed on dynamic import() via the unwrap in dynamicModuleCallback.

ScriptManagerBase owns the HTTP fetch + V8 module resolution path
(preloadImport, waitForImport, getAsyncImport, resolveSpecifier, the
Script struct) and reaches per-owner fields through an Owner union.
ScriptManager wraps it for Frame and keeps the parser/DOM-bound surface
(addFromElement, parseImportmap, Frame-specific evaluate tail via
tail_hook). WorkerGlobalScope gets its own ScriptManagerBase directly.

This is similar to the work done in https://github.com/lightpanda-io/browser/pull/2093
which split EventManager into EventManager + EventManagerBase (for the same
reason).

add tests
2026-04-30 09:05:51 +08:00
Karl Seguin
39d9ac9b4c Merge pull request #2285 from lightpanda-io/form_submitter
Form Submitter should only override when it's a submit input
2026-04-30 08:47:20 +08:00
Karl Seguin
ce2f6d9bdb Form Submitter should only override when it's a submit input 2026-04-30 08:19:21 +08:00
Karl Seguin
20e1aeaacb Merge pull request #2282 from lightpanda-io/input_file
Input file foundation
2026-04-30 08:09:23 +08:00
Karl Seguin
3f11e6148e Merge pull request #2296 from lightpanda-io/crypto_generateKey_errors
Improve correctness of generateKey error
2026-04-30 08:08:52 +08:00
Adrià Arrufat
ae2347f945 browser: add search tool with duckduckgo fallback 2026-04-29 16:54:48 +02:00
Halil Durak
0c3d5573f0 Cookie: don't allow JS context to mutate HttpOnly cookies
Changes function signature for `Jar.add` in order to do this, not sure if we should have separate functions for that or comptime-if sufficient.
2026-04-29 17:40:48 +03:00
Navid EMAD
31e0e7c81a dom: run label activation behavior on click
`Frame.handleClick` had no `.label` arm, so clicking an `HTMLLabelElement`
fired the click event but never dispatched the synthetic click activation
on the labeled control. Per HTML §4.10.4 "The label element", a label's
activation behavior is to run the synthetic click activation steps on the
labeled control; without it `cb.checked` stays unchanged when the click
target is a `<label>`.

Resolve the labeled control via the existing `Label.getControl(frame)`
(handles both `for=` and the wrapping-descendant case) and call `.click()`
on it, mirroring Chrome's `HTMLLabelElement::DefaultEventHandler`.

Closes #2323
2026-04-29 15:24:42 +02:00
Navid EMAD
71af170658 cdp: fall back to dialog defaultText when LP.handleJavaScriptDialog promptText is null
When a CDP client pre-arms `LP.handleJavaScriptDialog {accept: true}` with
no `promptText` and the page subsequently calls `window.prompt(message,
defaultText)`, Lightpanda discarded the dialog's `defaultText` argument
and returned `""`. Chrome's behavior is to surface `defaultText` as the
prompt's return value — that's the natural "user accepted without typing
anything" outcome per the HTML simple-dialog algorithm.

The fix is one line in `Window.zig`'s `prompt` JS binding: keep the
second argument named (`default_text` instead of `_`) and use it as the
fallback. Pre-armed `promptText` still wins when the client supplies it;
`accept = false` still returns null regardless. When neither
`promptText` nor `defaultText` is provided, the binding still returns
`""` per the CDP spec.

Adds four new assertions to the existing `cdp.lp` integration test
covering the matrix: defaultText fallback (no promptText), promptText
overrides defaultText, accept=false ignores defaultText, and the
existing no-defaultText case continues to return `""`.
2026-04-29 15:01:18 +02:00
Pierre Tachoire
6e881e0a9e Merge pull request #2320 from lightpanda-io/wp/mrdimidium/fix-crash-on-frame-deinit
Fix segfault on Frame deinit
2026-04-29 14:45:10 +02:00
Navid EMAD
d66c7aad50 Merge remote-tracking branch 'origin/main' into fix-a22-iscontenteditable 2026-04-29 14:40:12 +02:00
Nikolay Govorov
91f5988fe5 Fix segfault on Frame deinit 2026-04-29 13:33:10 +01:00
Karl Seguin
f7c3ccaf85 initial (file-free) multi-part form encoding 2026-04-29 19:19:34 +08:00
Karl Seguin
7c40d2fb98 FormData File support
Move FormData from using KeyValueList to using its own List(Entry), where
entry's value is a union over a String or File. Preparatory stuff for input
type=file support.
2026-04-29 19:19:33 +08:00
Karl Seguin
e981ec7587 Merge pull request #2319 from lightpanda-io/fix-popup-close-queued-nav
On Window.close, remove any queued navigation
2026-04-29 19:19:20 +08:00
Karl Seguin
b375603258 On Window.close, remove any queued navigation 2026-04-29 18:59:35 +08:00
Karl Seguin
5de4ee166f Merge pull request #2237 from lightpanda-io/window_open
window.open
2026-04-29 18:32:58 +08:00
Pierre Tachoire
bb1070f80a Merge pull request #2238 from lightpanda-io/deb-pkg
Release .deb package
2026-04-29 11:24:23 +02:00
Karl Seguin
1262964efe Merge pull request #2308 from navidemad/fix-a26-textarea-crlf
forms: normalize CR/LF to CRLF in form-data set encoding
2026-04-29 17:07:45 +08:00
Adrià Arrufat
28f5602bce Merge branch 'main' into agent 2026-04-29 08:52:48 +02:00
Adrià Arrufat
92db1b4a5e Merge pull request #2294 from navidemad/fix-a24-ua-stylesheet-display-none
css: apply UA stylesheet display:none defaults for unrendered elements
2026-04-29 08:51:53 +02:00
Adrià Arrufat
d92ebdeb89 css: apply zig fmt to Element.zig 2026-04-29 08:22:55 +02:00
Karl Seguin
a311cd166b Merge pull request #2315 from navidemad/fix-a21-disabled-inheritance
selector: walk fieldset/optgroup ancestors when matching :disabled
2026-04-29 12:27:35 +08:00