Commit Graph

3863 Commits

Author SHA1 Message Date
Adrià Arrufat
6897d72c3e mcp: simplify request processing to single-threaded 2026-02-28 21:26:51 +09:00
Adrià Arrufat
aae9a505e0 mcp: promot Server.zig to file struct 2026-02-28 21:02:49 +09:00
Karl Seguin
45196e022b Add a "wpt" dump mode
Adds a not-documented "wpt" mode to --dump which outputs a formatted
report.cases.

This is meant to make working on a single WPT test case easier, particularly
with some coding tool. Claude recommended this output for its own use.

Instead of telling claude to start the browser in serve mode, then run the
wptrunner, and merge the two outputs (and then stop the server), you can do:

zig build run -- fetch --dump wpt "http://localhost:8000/dom/nodes/CharacterData-appendChild.html"

(you still need the wpt server up)
2026-02-28 19:08:58 +08:00
Karl Seguin
b9e4c44d63 Noop when document.open is called during iframe parsing
I'm not sure what the correct behavior is, but this fixes a WPT crash:
/html/browsers/sandboxing/sandbox-inherited-from-required-csp.html

The issue is iframe-specific as, with an iframe, you document.write can be
called during parsing when there's no document._current_script (because it's
being executed from the parent).
2026-02-28 18:05:03 +08:00
Karl Seguin
0a9e5b66ee Merge pull request #1679 from lightpanda-io/escape_data_uri
Some checks failed
e2e-test / zig build release (push) Has been cancelled
zig-test / zig test using v8 in debug mode (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
e2e-test / browser fetch (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
wpt / zig build release (push) Has been cancelled
wpt / build wpt runner (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
e2e-integration-test / zig build release (push) Has been cancelled
e2e-integration-test / demo-integration-scripts (push) Has been cancelled
Escape DataURIs
2026-02-28 14:45:12 +08:00
Karl Seguin
8b99e82743 Merge pull request #1678 from lightpanda-io/improve_atob
Re-implement forgiving base64 decode without intermediate allocation
2026-02-28 14:45:01 +08:00
Karl Seguin
059fb85e22 Escape XHR URL, Lax MIME parameter parsing
Follow up to https://github.com/lightpanda-io/browser/pull/1646 applies the
same change to XHR URLs.

Following specs, ignores unknown/invalid parameters of the Content-Type when
parsing the MIME (rather than rejecting the entire header).
2026-02-28 14:42:43 +08:00
Karl Seguin
8997df861a Merge pull request #1677 from lightpanda-io/mime_charset_default
Initialize charset to safe default
2026-02-28 14:30:14 +08:00
Karl Seguin
e65667963f Correctly JSON encode URL
I think this code comes from some serialization tweak from when everything was
an std.Uri and by switch to [:0]const u8 everywhere not only was the tweak
unecessary, it was also wrong - possibly resulting in the generation of
invalid JSON.
2026-02-28 12:48:45 +08:00
Karl Seguin
3d51667fc8 Escape DataURIs
Support forgiving base64 decoder

Support non-encoded DataURIs
2026-02-28 12:24:26 +08:00
Karl Seguin
7fc6e97cd8 Re-implement forgiving base64 decode without intermediate allocation
Was looking at, what I thought was a related issue, and started to extract this
code to re-use it (in DataURIs). Realized it could be written without the
intermediate allocation. Then I realized the dataURI issue is something else,
but wanted to keep this improvement.
2026-02-28 11:22:31 +08:00
Karl Seguin
1473e58a41 Initialize charset to safe default
Fixes a WPT crash (not sure which, but in `/fetch/content-type/`)
2026-02-28 10:42:53 +08:00
Karl Seguin
2394b2f44f Merge pull request #1676 from lightpanda-io/add-scroll-by
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
e2e-test / browser fetch (push) Has been cancelled
zig-test / zig test using v8 in debug mode (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
wpt / zig build release (push) Has been cancelled
wpt / build wpt runner (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
e2e-integration-test / zig build release (push) Has been cancelled
e2e-integration-test / demo-integration-scripts (push) Has been cancelled
add window.scrollBy
2026-02-28 07:03:39 +08:00
Karl Seguin
516bd98198 Merge pull request #1675 from lightpanda-io/reset-attribute-listener
Set a null attribute listener must remove existing value
2026-02-28 07:01:11 +08:00
Karl Seguin
7d8688a130 Merge pull request #1674 from lightpanda-io/atob-unpadded-base64
accept must accept unpadded data in atob
2026-02-28 07:00:00 +08:00
Pierre Tachoire
631ec70058 add window.scrollBy 2026-02-27 16:19:27 +01:00
Pierre Tachoire
6fd51cfdc0 Set a null attribute listener must remove existing value 2026-02-27 14:47:43 +01:00
Pierre Tachoire
6857b74623 accept must accept unpadded data in atob
according with https://infra.spec.whatwg.org/#forgiving-base64-decode
2026-02-27 14:31:03 +01:00
Adrià Arrufat
5ec4305a9f mcp: add optional url parameter to tools 2026-02-27 22:17:15 +09:00
Pierre Tachoire
88baff96d0 Merge pull request #1671 from lightpanda-io/custom_element_name
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
e2e-test / browser fetch (push) Has been cancelled
zig-test / zig test using v8 in debug mode (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
Fix our custom element name validation
2026-02-27 14:08:13 +01:00
Pierre Tachoire
e871f0002b Merge pull request #1633 from lightpanda-io/wptrunner
remove WPT specific code
2026-02-27 13:02:47 +01:00
Karl Seguin
7358d48e35 Fix our custom element name validation
Passes all WPT tests:
/custom-elements/registries/valid-custom-element-names.html

Also, apply validation to whenDefined, which we were not doing.
2026-02-27 18:46:07 +08:00
Karl Seguin
a50597ff27 Merge pull request #1669 from lightpanda-io/more_interned_strings
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
e2e-test / browser fetch (push) Has been cancelled
zig-test / zig test using v8 in debug mode (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
Expand the strings we intern
2026-02-27 17:30:21 +08:00
Karl Seguin
e4cb78abee Merge pull request #1670 from lightpanda-io/cdata_sso
Change CData._data from []const to String (SSO)
2026-02-27 17:30:03 +08:00
Karl Seguin
732884a3b2 Merge pull request #1668 from lightpanda-io/selector_list_arena
Add RC support to NodeList
2026-02-27 17:29:06 +08:00
Karl Seguin
80f2c42c69 Merge pull request #1660 from lightpanda-io/fix_css_parse_overflow
Fix possible overflow when parsing floats without an integer
2026-02-27 17:27:56 +08:00
Pierre Tachoire
24b6934d3b remove WPT specific code
Using both lightpanda-io/wpt and lightpanda-io/demo/wptrunner remove the
need for code specific to run WPT from browser.
2026-02-27 10:09:07 +01:00
Pierre Tachoire
ef6a7a6904 storage: maintain Lookup size correctly 2026-02-27 08:57:29 +01:00
Pierre Tachoire
c61eda0d24 crypto: use dom exception to return QuotaExceededError 2026-02-27 08:57:28 +01:00
Pierre Tachoire
ad226b6fb1 implement storage size limit per origin 2026-02-27 08:57:28 +01:00
Karl Seguin
24491f0dfe fix String copy/reference 2026-02-27 14:34:20 +08:00
Karl Seguin
870fd1654d Change CData._data from []const to String (SSO)
After looking at a handful of websites, the # of Text and Commend nodes
that are small (<= 12 bytes) is _really_ high. Ranging from 85% to 98%. I
thought that was high, but a lot of it is indentation or a sentence that's
broken down into multiple nodes, eg:

<div><b>sale!</b> <span class=price>$1.99</span> buy now<div>

So what looks like 1 sentence to us, is actually 3 text nodes.

On a typical website, we should see thousands of fewer allocations in the
page arena for the text in text nodes.
2026-02-27 12:53:54 +08:00
Karl Seguin
38bc912e4e Expand the strings we intern
Based on analysis of a handful of websites (amazon product, github, DDG, reddit)
2026-02-27 11:17:06 +08:00
Karl Seguin
315c9a2d92 Add RC support to NodeList
Most importantly, this allows the Selector.List to be self-contained with
an arena from the ArenaPool. Selector.List can be both relatively large
and relatively common, so moving it off the page.arena is a nice win.

Also applied this to ChildNodes, which is much smaller but could also be
called often.

I was initially going to hook into the v8::Object's internal fields to store
the referencing v8::Object. So the v8::Object representing the Iterator
would store the v8::Object representing the NodeList inside of its internal
field - which the GC would trace/detect/respect. And that is probably the
fastest and most v8-ish solution, but I couldn't come up with an elegant
solution. The best I had was having a "afterCreate" callback which passed
the v8 object (this is similar to the old postAttach callback we had, but
used for a different purpose). However, since "acquireRef" was recently
added to events, re-using that was much simpler and worked well.
2026-02-27 10:29:46 +08:00
Karl Seguin
a14ad6f700 Merge pull request #1659 from lightpanda-io/nodelist_enumerable
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
e2e-test / browser fetch (push) Has been cancelled
zig-test / zig test using v8 in debug mode (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
e2e-integration-test / zig build release (push) Has been cancelled
e2e-integration-test / demo-integration-scripts (push) Has been cancelled
Make NodeList enumerable
2026-02-27 08:26:59 +08:00
Karl Seguin
d56e63a91b On Client.stop, terminate the isolate
Shutdown on MacOS doesn't work properly. The process appears to shutdown, but
will continue to run in the background. It can run infinitely if it's stuck in
a JS loop. To help it along, Client.stop now force-terminates the isolate.

I also don't think shutdown is working as intended on Linux, but the problem
seems less serious there. On Linux, it appears to properly kill the process
(which is the important thing), but I don't think it necessarily does a clean
shutdown.
2026-02-27 08:20:31 +08:00
Karl Seguin
99c09ba8a1 Merge pull request #1657 from lightpanda-io/FileReader
Add FileReader
2026-02-27 06:58:49 +08:00
Pierre Tachoire
8504e4cd22 add limit for cookie and jar size 2026-02-26 18:33:18 +01:00
Karl Seguin
ebe793e0e7 Merge pull request #1663 from lightpanda-io/more_header_callback_debugging
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
e2e-test / browser fetch (push) Has been cancelled
zig-test / zig test using v8 in debug mode (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
Add more properties to ScriptManager.Header recall
2026-02-26 19:15:59 +08:00
Pierre Tachoire
965c6cf4d9 Merge pull request #1662 from lightpanda-io/non_keyboard_keydown_event
Don't assume that a 'keydown' event is a KeyboardEvent
2026-02-26 11:55:54 +01:00
Karl Seguin
e7d21c2dbe Add more properties to ScriptManager.Header recall
This bug continues elusive. The latest crash logs show us that, somehow, 1
script is being resolved from 2 transfer objects. This doesn't seem possible,
so I'm adding more properties to log the state of both transfers to try and
figure out how this is happening.
2026-02-26 17:52:33 +08:00
Halil Durak
c86c851c60 move *addedCallbacks to respective types 2026-02-26 10:27:35 +03:00
Halil Durak
721cf98486 update Image and Style tests 2026-02-26 10:27:35 +03:00
Halil Durak
84bbb6efd4 replacement w/ imageAddedCallback 2026-02-26 10:27:35 +03:00
Halil Durak
f897cda6cd dispatch Style element's load event from nodeIsReady 2026-02-26 10:27:34 +03:00
Halil Durak
2da8b25b09 add LinkLoadError to CloneError 2026-02-26 10:27:34 +03:00
Halil Durak
3f94fd90dd dispatch a load event when href set for Link element
Also add `lazy-href-set` test.
2026-02-26 10:27:34 +03:00
Halil Durak
bc6be22cb4 update test 2026-02-26 10:27:34 +03:00
Halil Durak
e23604e08d introduce dispatchLoad and move load dispatching to Session._wait 2026-02-26 10:27:33 +03:00
Halil Durak
be858ac9ce add load event related tests to link.html 2026-02-26 10:27:33 +03:00