Commit Graph
29 Commits
Author SHA1 Message Date
Adrià Arrufat cbce632401 Replace @cImport with build-system translateC
Zig 0.17 removes @cImport in favor of translate-c steps in the build
system. Each library's link function now creates an addTranslateC step
exposed as a module import: curl and isocline translate their headers
straight from the dependency tree, while sqlite3 uses the artifact's
emitted include tree since the amalgamation lives in a sub-dependency.

Terminal.zig and prompt_assist.zig previously instantiated two
independent @cImport namespaces for isocline; they now share one
translated module, so its types are identical across both files.
2026-07-27 12:07:28 +02:00
Karl Seguin 8e42d63c1c zig: Zig 0.16
Built against https://github.com/lightpanda-io/zig-v8-fork/tree/zig-0.16 but
it doesn't require a new v8 build.

Built against https://github.com/lightpanda-io/boringssl-zig/tree/zig-0.16
since the current fork we point to isn't updated.

A global std.Io instance, lp.io. Way easier this way and requires 0 changes to
our libcurl integration / event loop.

Network code uses a new layer that does what Zig 0.15's posix package used to
do. Again, quicker migration that way. But, as long as we have the global IO,
and given the half-baked nature of networking in std.Io 0.16, this just makes
sense. Things can be migrated as needed.

The std.time.* -> std.Io.Timestamp/Clock/Duration resulted in _a lot_ of
changes. ArrayList = .{} -> ArrayList -> .empty also resulted in a lot of
changes, but that's obviously superficial. As is the trimLeft/trimRight ->
trimStart/trimEnd rename.

Locking adopt the `Uncancelable` variants, e.g. mutex.lockUncancelable() to
preserve the error-free signature (and, because cancellation would be something
we'd have to put more thought into).

std.json.ObjectMap is now unmanaged, so the allocator had to be passed along.
However, there's still a deprecated managed variant of MemoryPool, so I switched
to it (we can do a small follow up PR to move to the unmanaged after).

I tried use_llvm = false, but it locks my computer, consuming RAM until MacOS
gives me a popup I've never seen before, begging me to start killing processes.

Agent and the networking stuff saw the most significant changes.
2026-07-22 13:26:03 +08:00
Karl Seguin 437dac68ef add IDBIndex 2026-07-08 10:19:38 +08:00
Karl Seguin 37a846d91d remove unused imports 2026-06-01 22:42:39 +08:00
Matt Van Horn e361540c2d chore: fix three typos in comments and error message
- src/cdp/CDP.zig L1029 (was L780 in previous scan): "we dont' want" -> "we don't want"
- src/storage/sqlite/Pool.zig L101: test comment "single connetion" -> "single connection"
- src/storage/sqlite/Sqlite.zig L201: @compileError message "unsupport column type" -> "unsupported column type"

Comment / compile-time string only; no runtime behavior change.
2026-05-26 00:48:52 -07:00
Karl Seguin 7819ee50fa Add and default to Blackhole storage
Tweak sqlite build to omit more features, hoping to shrink the size when sqlite
is used.
2026-04-26 09:04:33 +08:00
Karl Seguin e7be3c8b14 still trying to get this test to pass 2026-04-20 18:57:45 +08:00
Karl Seguin 55d7bae943 more busy timeout tricks 2026-04-20 18:42:55 +08:00
Karl Seguin fcd3d1cd14 Use unsafe journal_mode during Pool test
Can't use WAL, as it thread sanitizer reports false positives. The default,
delete, causes busy timeouts. Let's try the unsafe memory!
2026-04-20 18:14:29 +08:00
Karl Seguin b226a9ed52 Disable WAL mode for Sqlite pool test
It seems like there are known false positives with thread sanitizer and sqlite.

(There are various references to this in sqlite's wal.c and also possibly
related https://bugzilla.mozilla.org/show_bug.cgi?id=1153409
2026-04-20 17:16:42 +08:00
Karl Seguin 6d0003ad2b Sqlite
This adds an app.storage which is a union around configurable storage engine
(currently, only sqlite).

It is _not_ being used anywhere right now. The goal is to get feedback on
the implementation and then move cache to it.

This doesn't expose a generic query API. The goal is that the storage will
expose high level methods, e.g. `cacheGet(req: CacheGetRequest)` and every
storage engine will translate the `storage.CacheGetRequest` as needed.

A thin wrapper around the Sqlite C api is included, e.g. exec(SQL, .{args}) a
`rows` and `row` fetcher. A connection pool is included. By default, an
in-memory DB is currently created. And a `migrations` table with an id of `1`
is created/inserted. I don't imagine needing fancy migratations.
2026-04-20 17:13:06 +08:00
Karl Seguin b8d7744563 replace zig-js-runtime 2025-04-15 15:18:04 +08:00
Pierre Tachoire c88bc65379 cookie: use a ; w/o space for cookie separator in requests 2025-04-11 12:40:16 +02:00
Karl Seguin be75b5b237 Add URL struct
Combine uri + rawuri into single struct.

Try to improve ownership around URIs and URI-like things.
 - cookie & request can take *const std.Uri
   (TODO: make them aware of the new URL struct?)
 - Location (web api) should own its URL (web api URL)
 - Window should own its Location

Most of these changes result in (a) a cleaner Page and (b) not having to carry
around 2 nullable objects (URI and rawuri).
2025-04-09 18:19:07 +08:00
Karl Seguin 84dfde2e51 add cookies to XHR requests 2025-03-31 18:44:09 +08:00
Karl Seguin 22d33fa286 Add cookie support to browser (not XHR yet) requests 2025-03-31 18:44:09 +08:00
Karl Seguin 21c9dde858 Zig 0.14 compatibility 2025-03-19 16:28:15 +01:00
Karl Seguin 9fec6ebc66 fix typo, improve comment, add 1 test case 2025-03-04 19:46:36 +08:00
Karl Seguin a00d1d068a Cookie with SameSite=None is only valid when Secure 2025-02-27 16:47:39 +08:00
Karl Seguin 6f5028612a add cookie jar 2025-02-27 16:09:10 +08:00
Karl Seguin c31c12d31a add test for Storage shed, use map.getOrPut 2025-02-27 11:57:46 +08:00
Karl Seguin 68fc87bc01 Add Set-Cookie parsing 2025-02-26 21:00:43 +08:00
Karl Seguin 4229b1d2a4 Report memory leaks when using std.testing.allocator
Fix leaks in storage bottle
2025-02-09 11:04:21 +08:00
Karl Seguin fc0ec860b0 Tweak generate.Tuple and generate.Union
Leverage comptime fields to give generated Tuple a default value, allowing
TupleT and Tuple to be merged.

Only call generate.Tuple on the final output. This eliminates redundant
deduplication, and results in a simpler API (nested types just need to expose
a natural Zig tuple).

generate.Union leverages the new Tuple and removes unused features.
2025-02-01 14:53:00 +08:00
Pierre Tachoire 8f1557254a typo fix 2025-01-15 11:45:30 +01:00
Pierre Tachoire f2a406d224 move netsurf and mimalloc into modules 2024-06-18 16:13:27 +02:00
Pierre Tachoire 2a3a243d1c add AGPL license header in zig files 2024-05-13 20:51:36 +02:00
Pierre Tachoire 61357ee7e0 storage: update comment about dispatch event 2024-05-02 15:21:21 +02:00
Pierre Tachoire 3c5d601622 storage: first implementation of webstorage API 2024-04-24 11:54:41 +02:00