Commit Graph

7074 Commits

Author SHA1 Message Date
Adrià Arrufat
4ff4da2ede Merge branch 'main' into agent 2026-06-03 08:35:33 +02:00
Karl Seguin
3c06e98008 Merge pull request #2611 from rohitsux/feat/html-param-reflection
feat(webapi): reflect name and value on HTMLParamElement
2026-06-03 07:30:28 +08:00
Karl Seguin
f61b110b1c Merge pull request #2608 from lightpanda-io/curl_debug_allocator
Extract ZigToCurlAllocator into it's own file, only use in debug
2026-06-03 06:27:57 +08:00
Karl Seguin
9d4259f2b9 Merge pull request #2607 from lightpanda-io/max_contexts
Switch env.contexts to ArrayList to support having more
2026-06-03 06:27:40 +08:00
Karl Seguin
f4403c93e5 Merge pull request #2606 from lightpanda-io/better_html_attributes_v2
More HTML attributes
2026-06-03 06:27:21 +08:00
Karl Seguin
744ac6729b Merge pull request #2605 from lightpanda-io/uaf_identity
Fix UAF on FinalizerCallback.Identity memory
2026-06-03 06:26:38 +08:00
Karl Seguin
55b2b11999 Merge pull request #2604 from lightpanda-io/better_html_attributes
Various HTML attribute tweaks
2026-06-03 06:26:15 +08:00
Rohit
8116214a42 feat(webapi): reflect name and value on HTMLParamElement
Add the reflected DOMString attributes name and value to the
existing HTMLParamElement, per HTML 15.3
(https://html.spec.whatwg.org/multipage/obsolete.html#htmlparamelement).
Mirrors the reflection idiom used by HTMLTimeElement / HTMLDataElement.

Advances the html/dom/reflection-obsolete.html WPT row.
2026-06-03 00:49:03 +05:30
Adrià Arrufat
993315c770 agent: handle model safety refusals
Updates the `zenai` dependency to support safety finish reasons. Tracks
when a model refuses a request due to safety, prints a specific warning
message, and avoids re-prompting.
2026-06-02 19:39:37 +02:00
Adrià Arrufat
a7c305fae9 terminal: remove multiline prompt prefix 2026-06-02 19:21:19 +02:00
Adrià Arrufat
83d07e2c17 build: bump zenai and update help example 2026-06-02 17:31:47 +02:00
Adrià Arrufat
dbe4176409 terminal: scope kitty keyboard protocol to readline 2026-06-02 15:50:29 +02:00
Adrià Arrufat
31479c422c Merge pull request #2609 from lightpanda-io/agent-save-llm
agent: synthesize scripts on /save using LLM
2026-06-02 15:49:45 +02:00
Adrià Arrufat
db21f658f0 agent: prevent use-after-free in synthesizeSave 2026-06-02 15:26:27 +02:00
Adrià Arrufat
8739fbcb4b agent: synthesize scripts on /save using LLM 2026-06-02 15:23:33 +02:00
Karl Seguin
9ba7dbd9b7 Extract ZigToCurlAllocator into it's own file, only use in debug
Extract ZigToCurlAllocator to its own file and rename it to CurlDebugAllocator
to indicate that it is only used in debug. Also, only use it in debug.

In release mode, this just adds 16 bytes of overhead per allocation that curl
makes. In debug mode, it's the same overhead, but it at least hooks into the
std's DebugAllocator which can detect misuse.
2026-06-02 20:17:30 +08:00
Karl Seguin
2451b41af5 Switch env.contexts to ArrayList to support having more
A lot of WPT tests do something like:

```js
    const frame = document.createElement("iframe");
    t.add_cleanup(() => {
      frame.remove();
    });
    ... run a test
```

But our frame.remove (Element.remove) doesn't destroy the frame/context. It
can't. We don't know what is referencing it. So these WPT tests that create
_thousands_ of these quickly run into TooManyContexts errors.

As a quick solution, we now allow up to 8K contexts to be created when running
WPT tests (`-Dwpt_extensions`). Env.contexts becomes an arraylist rather than
an arary (so avoid having to pay that 8192 * 64 byte penalty for tests that
don't need 8K contexts).

An example of such a test is: /encoding/unsupported-labels.window.html
2026-06-02 19:55:20 +08:00
Adrià Arrufat
3bbe20735f agent: record raw REPL input
- Add `recordRaw` to record raw JS lines in the REPL.
- Only record commands if they succeed without error.
- Fix kitty terminal cursor keys by forcing legacy arrow encoding.
2026-06-02 12:54:37 +02:00
Karl Seguin
8c8bcac053 More HTML attributes
Stacked on https://github.com/lightpanda-io/browser/pull/2604 and driven by
a different WPT test: /html/dom/reflection-metadata.html

Goes from 1527 to 3074 passing cases. Largely just adding more attributes and
adding validation to attributes where necessary.
2026-06-02 18:43:31 +08:00
Karl Seguin
3d00061287 Fix UAF on FinalizerCallback.Identity memory
From a real case involving a modified version of our bing integration. Our
`releaseRef` (release from v8) destroys the FinalizerCallback.Identity but kept
it in the identities list. `releaseRef` now removes it from the list, so that
when FC.deinit is called, it doesn't try to access the freed identity.
2026-06-02 18:05:37 +08:00
Adrià Arrufat
0d86c5a22d terminal: disable highlighting in JS mode 2026-06-02 11:52:52 +02:00
Adrià Arrufat
62a3e73f25 Merge pull request #2603 from lightpanda-io/agent_repl_pimp
agent: improve banner
2026-06-02 11:50:01 +02:00
Karl Seguin
e3e3fc25fe Various HTML attribute tweaks
Aimed at improving WPT /html/dom/reflection-obsolete.html Goes from 923 to 2305
passing cases (the remaining failing cases are all for <frame> which we don't
currently support)

Add accessors to Directory, Font and FrameSet. Add HTMLMarqueeElement.

Font setColor null -> ""

Add new properties to Html (accessKey and autofocus) and improve tabIndex
parsing.
2026-06-02 17:33:37 +08:00
Adrià Arrufat
04ee47c268 Merge branch 'agent' into agent_repl_pimp 2026-06-02 11:23:39 +02:00
Adrià Arrufat
401f73b0f2 agent: echo console logs in REPL
Drains and prints console messages during the REPL loop. This ensures
console output is surfaced in JS mode, where slash commands like
`/consoleLogs` are unreachable.
2026-06-02 11:09:53 +02:00
Francis Bouvier
f54359aef6 agent: improve banner 2026-06-02 10:45:19 +02:00
Adrià Arrufat
8e063f8e83 repl: add JS evaluation mode 2026-06-02 10:19:37 +02:00
Karl Seguin
ccba74bae3 Merge pull request #2600 from lightpanda-io/document_close_during_write
Don't allow document.close during document.write
2026-06-02 15:27:37 +08:00
Karl Seguin
a5d6acf81c Merge pull request #2601 from lightpanda-io/arena_release_in_debug
Less arena-reuse (retain) in Debug
2026-06-02 15:27:07 +08:00
Adrià Arrufat
12b2375969 terminal: support kitty keyboard protocol
Updates the isocline dependency and enables the kitty keyboard
protocol "disambiguate" mode to support Ctrl+Enter detection.
2026-06-02 09:11:56 +02:00
Adrià Arrufat
818b225d99 Merge branch 'main' into agent 2026-06-02 08:12:26 +02:00
Karl Seguin
a7355a5762 Less arena-reuse (retain) in Debug
Arena reuse/retain can hide UAF issues, often resulting in a crash that is more
symptom than cause (far from where the error actually is). Removing this, lets
us better utilize the DebugAllocator's UAF-detection.

Also, when running WPT tests (-Dwpt_extensions) limit console logging to 100
values (a few tests writer millions of values, which is annoying and just
destroys the terminal).
2026-06-02 13:00:17 +08:00
Karl Seguin
1895d8f58d Merge pull request #2329 from lightpanda-io/deferred-layer
Deferred Layer
2026-06-02 12:43:06 +08:00
Karl Seguin
4dd7535e6d Don't allow document.close during document.write
56181bbe6c protected against a document.write
generating a document.write.

This protects against a document.write generating a document.close. We cannot
immediately close, so we 'queue' the close (via a boolean) and defer it until
the write is complete.

Fixes crash in WPT: /html/webappapis/dynamic-markup-insertion/document-write/iframe_010.html
From what I can tell, this is the last one of these.
2026-06-02 12:39:19 +08:00
Karl Seguin
94ba07913c Merge pull request #2584 from lightpanda-io/request_callback_terminate
Improve forced terminate on CDP client disconnect.
2026-06-02 11:10:57 +08:00
Karl Seguin
79cdbd285d Improve forced terminate on CDP client disconnect.
Depends on https://github.com/lightpanda-io/zig-v8-fork/pull/179

An improvement to https://github.com/lightpanda-io/browser/pull/2515 to prevent
a v8 assertion if we terminate as an inspector dispatch is happening.

The problem is that if we just immediately terminate, we aren't sure what the
worker thread is doing, and, apparently, if we terminate then dispatch a message
to the inspector, we fail an assertion.

With the way the code was, the only safe solution would be to hold a mutex
over the session dispatch, but that could block the network thread.

So instead of terminating from the network thread, we now ask v8 to execute
a callback. This gets executed on the worker thread, which can then terminate
the execution.

The initial version of 2515 delayed the termination from the network thread.
It's possible that solution would "solve" the issue, simply because it's very
unlikely that a worker would be "stuck" for 5 seconds and then get unstuck.
More likely that it exits immediately, or is stuck in an endless loop. But
that would still leave a window where we could terminate in network and then
dispatch in the worker. Less likely, but still possible. Hopefully this new
mechanism eliminates this from being a problem in all circumstances.
2026-06-02 08:27:49 +08:00
Karl Seguin
56181bbe6c Merge pull request #2595 from lightpanda-io/reentrant_stream_parsing
Protect against re-entrant stream parsing
2026-06-02 06:27:37 +08:00
Karl Seguin
4291c549e0 Merge pull request #2592 from lightpanda-io/uaf_queued_navigation_log_failure
Avoid UAF in log message when processFrameNavigation fails
2026-06-02 06:26:22 +08:00
Karl Seguin
58533e1a53 Merge pull request #2591 from lightpanda-io/global_flattening
Global property flattening
2026-06-02 06:25:59 +08:00
Karl Seguin
9251c3d45e Merge pull request #2593 from lightpanda-io/transfer_data_ownership
Clone data into the transfer's arena
2026-06-02 06:25:42 +08:00
Karl Seguin
e333e458b1 Merge pull request #2597 from lightpanda-io/remove_unused_imports
remove unused imports
2026-06-02 06:24:30 +08:00
Adrià Arrufat
29408bda2b deps: update isocline dependency 2026-06-01 23:14:51 +02:00
Adrià Arrufat
2c39b77591 build: update isocline for bracketed paste 2026-06-01 23:03:10 +02:00
Francis Bouvier
0544d732dd Merge pull request #2599 from lightpanda-io/agent_script_js
agent: run recorded scripts as JavaScript
2026-06-01 20:25:21 +02:00
Adrià Arrufat
f507ed902f agent: simplify schema extraction
Consolidates the switch block in `extractArgs` to extract the schema
string first before wrapping it. Simplifies `extractSchemaString` by
reusing `normalizeExtractSchemaString` for array schemas.
2026-06-01 18:41:53 +02:00
Adrià Arrufat
fb22f0e875 agent: use local arenas to avoid re-entrant corruption
Re-entrant JS callbacks (like `toJSON` or `toString`) could reset the
shared `call_arena` mid-flight. Using local arenas prevents this.
2026-06-01 18:33:32 +02:00
Adrià Arrufat
8fbf63fdc9 runtime: fix strict-mode calls and drain microtasks
Use the current isolate context instead of the receiver's context
when invoking primitives, fixing failures in strict-mode scripts.
Also, explicitly perform a microtask checkpoint after running a
script to ensure promise continuations run.
2026-06-01 18:22:40 +02:00
Francis Bouvier
e59c4b2cae Merge pull request #2598 from lightpanda-io/agent-remove-autoheal
refactor: remove legacy PandaScript self-healing and execution
2026-06-01 17:46:31 +02:00
Adrià Arrufat
044b34d228 refactor: remove legacy PandaScript self-healing and execution
Removes the `--self-heal` CLI option, the `scriptStep` and `scriptHeal`
MCP tools, and associated verification/iterator machinery. Replaces
"PandaScript" terminology with "slash commands" and moves shared
helpers to `tools.zig`.

BREAKING CHANGE: The `--self-heal` CLI flag and the `scriptStep` and
`scriptHeal` MCP tools have been removed.
2026-06-01 17:29:24 +02:00
Karl Seguin
37a846d91d remove unused imports 2026-06-01 22:42:39 +08:00