Commit Graph

8472 Commits

Author SHA1 Message Date
Karl Seguin
fb39792f2d idb: add IDBRecord 2026-07-08 10:21:25 +08:00
Karl Seguin
1dcd0dc6fb idb: rework transaction model
Previously, every operation would run synchronously, and resolve the value
on the next drain (schedule task run on the next tick).

With 1 connection per DB, this doesn't work with SQLite: you cannot have nested
transactions. Imagine:

add
  begin
    insert into
    JS callback (success)
      add
        begin <-- nested
          insert

This approach captures the requested operation and does all necessary validation
(since most validation errors are returned synchronously), but only executes
operations on drain. Hence, rather than IDBTransaction._requests being a
queue of result values to emit on drain, it is now a queue of operations to
execute and then emit.

This will also potentially make it easier to address serious memory
issues by better scoping the lifetime of things (particularly requests).
2026-07-08 10:21:04 +08:00
Karl Seguin
b0bccbb4bc make indexedb in-memory only (for now) 2026-07-08 10:21:02 +08:00
Karl Seguin
91901ca007 Add object store name support + DOMStringList 2026-07-08 10:20:23 +08:00
Karl Seguin
437dac68ef add IDBIndex 2026-07-08 10:19:38 +08:00
Karl Seguin
edbd24bbac webapi, idb: Add IDBCursor and IDBCursorWithValue 2026-07-08 10:18:42 +08:00
Karl Seguin
6b7d0c6391 webapi, idb: add IDBKeyRange
Including support for IDBKeyRange based operations
2026-07-08 10:17:22 +08:00
Karl Seguin
47d540a69a webapi: IndexedDB base
Initial WIP on IndexedDB WebAPI. Uses sqlite and a new `--indexdb_dir` config.
Defaults to :memory:.

The main things missing are the IDBCursor, IDBIndex and IDBKeyRange, along with
a bunch of smaller apis.

Also, every object is currently tied to the Page arena / factory. It's possible
that's how it will have to be, but, once more of the API lands, I will check
if we can scope these better.
2026-07-08 10:16:17 +08:00
Karl Seguin
cc7d319ea5 Merge pull request #2874 from lightpanda-io/agent-regression
Add agent regression suite to CI (consumed from lightpanda-io/demo)
2026-07-08 09:19:00 +08:00
Karl Seguin
789929ba1e Merge pull request #2895 from lightpanda-io/lazy_loading_iframes
perf: Iframes with loading=lazy don't delay parent's "load" event
2026-07-08 08:51:21 +08:00
Karl Seguin
62edeb506a Merge pull request #2897 from lightpanda-io/v8_max_memory
v8, mem: Add v8 configuration option + heap limit protection
2026-07-08 08:33:07 +08:00
Adrià Arrufat
f3f731ffb1 fix: setChecked double-toggled checkables via click activation
actions.setChecked set the input state and then dispatched a trusted
click, but the click's activation behavior (EventManager's
ActivationState) toggles a checkbox on every click dispatch — undoing
the state just set — and its commit path fires input/change, which
setChecked then fired a second time. Checkboxes always landed in the
opposite of the requested state with doubled events; radios only
appeared to work because radio activation always checks. It survived
because existing tests asserted the tool's report string, never the
resulting DOM state.

setChecked is now a no-op when the state already matches, otherwise it
performs the click (reusing actions.click) and verifies the state
landed — erroring before the click for radio+false (a click can never
uncheck a radio, and the click has observable page side effects) and
after it when a listener preventDefault()ed the toggle.

Caught by the checked.js golden in the demo agent regression suite.
The Runtime test now asserts DOM state and idempotency instead of
trusting the report string.
2026-07-07 15:43:28 +02:00
Karl Seguin
4253bd852d update v8 dep 2026-07-07 20:41:12 +08:00
Adrià Arrufat
52a8779f2a Merge branch 'main' into agent-regression 2026-07-07 11:43:12 +02:00
Karl Seguin
7184c45ee6 improve variables/comments 2026-07-07 17:14:48 +08:00
Karl Seguin
03f542006d v8, mem: Add v8 configuration option + heap limit protection
The main addition in this commit is that we hook into the Isolate's
AddNearHeapLimitCallback callback and try to force the isolate to shutdown
rather than letting v8 hit an OOM which would take down the entire process.

In support of this, we now support a `--v8-max-heap-mb` command line option to
set an explicit heap limit. As a simple way to test this feature, load a
relatively heavy JS page with `--v8-max-heap-mb 1`.

There's also a `--v8-flags-unsafe` which is a mechanism to pass arbitrary
flags to v8 via its `SetFlagsFromString`. The parameter is called `unsafe`
because some [of the many] configurable flags could conflict with how the
snapshot is built and result in crashes. The snapshot creator also gains a
`--v8-flags-unsafe` flag, so advance users COULD create their snapshot and
run lightpanda with the same set of flags.
2026-07-07 12:40:23 +08:00
Karl Seguin
032cbc3846 perf: Iframes with loading=lazy don't delay parent's "load" event
When an iframe has "loading=lazy" it no longer delays the parent's "load" event.
It's still loaded (subject to `--disable-subframes` parameter).

Many sites use loading=lazy for non-critical content (e.g. ads). On Chrome/
Firefox, these are only loaded when they're in the viewport, so sites usually
can't depend/rely on them being loaded.
2026-07-07 11:17:36 +08:00
Karl Seguin
c1dfb09f04 Merge pull request #2883 from lightpanda-io/response-static
webapi: Add static Response.json, Response.error and Response.redirect
2026-07-07 07:19:19 +08:00
Karl Seguin
2b1f7f78ad Merge pull request #2881 from lightpanda-io/DOMPoint
webapi: Add DOMPoint and DOMPointReadOnly
2026-07-07 07:17:23 +08:00
Karl Seguin
9621f5edf7 Merge pull request #2890 from lightpanda-io/domexception
minor: remove DOMException WebAPI flag (make it always on).
2026-07-07 07:17:09 +08:00
Karl Seguin
4a31784901 Merge pull request #2893 from lightpanda-io/replaceable
webapi: more (and better) replaceable proeprties.
2026-07-07 07:16:52 +08:00
Pierre Tachoire
6982ff95f0 Merge pull request #2894 from lightpanda-io/nested_timer_protection
perf, mem, uaf: Enforce minimum timer delay on nested timers
2026-07-06 16:52:28 +02:00
Pierre Tachoire
b1458da04c Merge pull request #2892 from lightpanda-io/getComputedStyle-width-height
fix, render: CSS getPropertyValue special width/height handling
2026-07-06 16:49:26 +02:00
Karl Seguin
0067fe8996 Merge pull request #2884 from lightpanda-io/goto_error_path_isolate
script: reject failed goto starts outside the browser isolate
2026-07-06 22:31:57 +08:00
Karl Seguin
fd8ee52e1f perf, mem, uaf: Enforce minimum timer delay on nested timers
Per spec, nested timers eventually (5-level deeps) enforce a minimum timeout
(4ms).

This commit also fixes 2 UAFs in module loading where a map entry would become
invalid through nested mutations.

All issues were encountered on https://111skin.com/.
2026-07-06 22:05:12 +08:00
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