Commit Graph
16 Commits
Author SHA1 Message Date
Karl Seguin 4b3c5ed947 chore: Silence the sporadic WriteFailed HTTP Error from the test server
No clue why this happens, but if the error mattered, a test would fail. A lot
of tests can be "harsh" on the server (e.g. a frame that navigates its parent
away while some resource load), so a WriteFailed error isn't exactly surprising
2026-08-23 13:37:08 +08:00
Karl Seguin 73de272755 chore: speed up unit tests on linux 2026-08-10 15:51:58 +08: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 87b93faf91 minor: ignore test server error when writing internal server error 2026-06-30 20:40:36 +08:00
Karl Seguin db260fe029 test,perf: Fix leaky thread in test runner
The TestHTTPServer leaks a thread for every connection that shuts down. This
commit correctly releases it. It also closes a leaking CDP socket.

Full test went from 20s -> 10s for me
2026-06-09 11:42:31 +08:00
Karl Seguin f614d898aa Capture 401 and 407 bodies
We currently skip capturing 401 and 407 bodies. This appears to be an
optimization with the intent that it won't be needed. While that might be true
in some cases (though, not sure when), it isn't always true. A page.navigate
to a 401 should display the content.

(Also, tried to silence meaningless BrokenPipe noise in tests).
2026-05-27 19:34:39 +08:00
Karl Seguin bdc9013241 silence an unecessary test log 2026-05-05 07:52:37 +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
Karl Seguin 4f4dbc0c22 Allow iframe.src to renavigate the page
Unlike a script, an iframe can be re-navigated simply by setting the src.
2026-03-02 18:14:34 +08:00
Karl Seguin da49d918d6 use close, not shutdown on BSD/Mac 2026-02-05 10:58:10 +08:00
Nikolay Govorov 6ccd3f277b Fix race condition 2026-02-04 13:48:07 +00:00
Karl Seguin c3f8f9de54 merge https://github.com/lightpanda-io/browser/pull/1275 2025-12-18 21:17:13 +08:00
Karl Seguin 1164da5e7a copyright notices 2025-11-14 10:52:43 +08:00
Karl Seguin b047cb6dc1 remove libdom 2025-10-27 22:14:59 +08:00
Karl Seguin 67935b11c9 Try to address WPT running OOM
- Continue to reuse the Browser/Env/Isolate, but no start a new session per test.
- Test http server now properly closes the sendFile fd
- Run WPT in ReleaseMode
- Add --quiet option to WPT and some commented out debug code for dumping v8
  memory stats
2025-09-09 19:15:35 +08:00
Karl Seguin 7d46e8fe80 Start unifying test and code
Depends on https://github.com/lightpanda-io/browser/pull/993

There's currently 3 ways to execute a page:
1 - page.navigate (as used in both the 'fetch' and 'serve' commands)
2 - jsRunner as used in unit tests
3 - main_wpt as used in the WPT runner

Both jsRunner and main_wpt replicate the page.navigate code, but in their own
hack-ish way. main_wpt re-implements the DOM walking in order to extract and
execute <script> tags, as well as the needed page lifecycle events.

This PR replaces the existing main_wpt loader with a call to page.navigate. To
support this, a test HTTP server was added. (The test HTTP server is extracted
from the existing unit test test server, and re-used between the two).

There are benefits to this approach:
1 - The code is simpler
2 - More of the actual code and flow is tested
3 - There's 1 way to do things (page.navigate)
4 - Having an HTTP server might unlock some WPT tests

Technically, we're replacing file IO with network IO i.e. http requests). This
has potential downsides:
1 - The tests might be more brittle
2 - The tests might be slower

I think we need to run it for a while to see if we get flaky behavior.

The goal for following PRs is to bring this unification to the jsRunner.
2025-09-01 13:01:08 +08:00