Commit Graph

6623 Commits

Author SHA1 Message Date
Karl Seguin
f0060dd677 add Element.style setter 2026-06-05 18:46:05 +08:00
Karl Seguin
23120885be Merge pull request #2641 from rohitsux/feat/cdp-dispatch-mouse-wheel
feat(cdp): fire wheel events on Input.dispatchMouseEvent mouseWheel
2026-06-05 07:34:21 +08:00
Karl Seguin
9068a7583b Merge pull request #2638 from lightpanda-io/xhr-upload
Implement XMLHttpRequest.upload
2026-06-05 07:34:06 +08:00
Karl Seguin
0971f74a4c fix XMLHttpRequestUpload release 2026-06-05 07:01:01 +08:00
Karl Seguin
62acf1c640 Merge pull request #2643 from lightpanda-io/mime_fix
Fix Mime.
2026-06-05 06:55:16 +08:00
Karl Seguin
a9374a0254 Merge pull request #2642 from lightpanda-io/dommatrix
Add DOMMatrix and DOMMatrixReadOnly
2026-06-05 06:54:54 +08:00
Karl Seguin
5d95b55d87 Merge pull request #2637 from lightpanda-io/xhr-override-mimetype
Implement XMLHttpRequest.overrideMimeType()
2026-06-05 06:31:26 +08:00
Pierre Tachoire
cb73e43926 couple XMLHttpRequestUpload lifecycle w/ parent's XMLHttpRequest 2026-06-04 18:20:38 +02:00
Rohit
e05074dbf5 feat(cdp): fire wheel events on Input.dispatchMouseEvent mouseWheel
Wire the CDP Input.dispatchMouseEvent "mouseWheel" type to a new
Frame.triggerMouseWheel, which hit-tests the point via elementFromPoint
and dispatches a wheel event (with deltaX/deltaY) on the target. When
the wheel event is not cancelled, it applies the scroll offset and
fires a scroll event, mirroring the wheel handling in WebDriver.zig.

Previously mouseWheel was silently ignored. Follow-up to #2636.
2026-06-04 19:27:56 +05:30
Pierre Tachoire
426c167470 Merge pull request #2640 from rohitsux/feat/cdp-dispatch-mouse-released
feat(cdp): fire mouseup on Input.dispatchMouseEvent mouseReleased
2026-06-04 15:48:05 +02:00
Karl Seguin
0ec92bedbb Merge pull request #2639 from lightpanda-io/form-no-validate
Validate form constraints on interactive submit; add HTMLFormElement.…
2026-06-04 21:19:04 +08:00
Karl Seguin
121167e44e Fix Mime.
It has somehow acquired (or always had?) multiple dangling pointers. Luckily
(or worse?) they aren't used anywhere. Remove mime.params (dangles off the
input) and the content_type `.other` values (dangles off the local mime var).

Also, remove double lowerCase.
2026-06-04 20:55:11 +08:00
Karl Seguin
fb720766a1 Fix XHR document identity
Cache the xml document so that subsequent calls to getResponseXML return the
same document.

Fix testing.js harness - reject multiple testing.async() calls per block. This
isn't reliable since the runner can temporarily see the count reach 0 before
the next async block starts.
2026-06-04 20:41:54 +08:00
Karl Seguin
d7eb6d697a Add DOMMatrix and DOMMatrixReadOnly
These are needed for apple.com, completely broken without.

Obviously Claude wrote most of this code. The test that it wrote _does_ pass
in FireFox and a reasonable number of WPT *DOMMatrix* test pass.

A relatively small subset of this was needed for Apple, but there was plenty
of low-hanging fruit in the WPT tests.

Also, some of these WPT tests uncovered a name collision in our WPT reporter:
https://github.com/lightpanda-io/wpt/pull/70
2026-06-04 19:49:20 +08:00
Rohit
f697013540 feat(cdp): fire mouseup on Input.dispatchMouseEvent mouseReleased
Wire the CDP Input.dispatchMouseEvent "mouseReleased" type to a new
Frame.triggerMouseRelease, which hit-tests the point via
elementFromPoint and dispatches a mouseup event on the target,
mirroring triggerMouseClick / triggerMouseMove and the mouseup
semantics already used by WebDriver.zig.

Previously mouseReleased was silently ignored. Follow-up to #2636.
2026-06-04 16:39:25 +05:30
Pierre Tachoire
b405bed660 Validate form constraints on interactive submit; add HTMLFormElement.noValidate
Until now Frame.submitForm performed no constraint validation: requestSubmit()
and interactive submits (Enter, clicking a submit button) fired the `submit`
event and proceeded regardless of control validity — a `<form><input required>`
would submit with the field empty.

Implement the HTML "submit a form element" interactive-validation step: in the
fire_event branch, run form.checkValidity() as a gate before dispatching
`submit`, abort submission when it fails (checkValidity fires `invalid` on the
offending controls), and skip the gate when the form is in the no-validate
state. form.submit() keeps bypassing validation, per spec.

To drive the no-validate state, add the HTMLFormElement.noValidate IDL
attribute reflecting the `novalidate` content attribute, and honor a submitter's
`formnovalidate`. noValidate gates submission only — checkValidity()/
reportValidity() still validate unconditionally.
2026-06-04 12:49:14 +02:00
Pierre Tachoire
40fa716b3e Merge pull request #2636 from rohitsux/feat/cdp-dispatch-mouse-moved
feat(cdp): fire hover events on Input.dispatchMouseEvent mouseMoved
2026-06-04 12:03:12 +02:00
Karl Seguin
7e19d57624 Merge pull request #2633 from lightpanda-io/popover
Initial popover support
2026-06-04 17:54:05 +08:00
Pierre Tachoire
691a32ff6e Implement XMLHttpRequest.upload
Return an XMLHttpRequestUpload (inheriting XMLHttpRequestEventTarget) from
the lazily-cached `upload` attribute. Fixes htmx login flows that called
`xhr.upload.addEventListener(...)`.
2026-06-04 11:47:57 +02:00
Pierre Tachoire
bf5d43c541 Implement XMLHttpRequest.overrideMimeType()
Adds the overrideMimeType(mime) method.

Wires the final MIME type (override ?? response) into responseXML for
the default response type (""): when the final MIME is text/xml, the
body is lazily parsed into a Document and cached in a new
_response_xml field. Other XML MIME types (application/xml, image/svg+xml)
land in Mime.ContentType.other whose backing slices are unsafe to read
after Mime.parse returns; supporting them is left for a follow-up.

The override does not affect response / responseText today —
responseText charset decoding and the document responseType's
HTML-vs-XML parser choice are noted as follow-ups in the code.
2026-06-04 10:55:32 +02:00
Rohit
b347f8b2e2 feat(cdp): fire hover events on Input.dispatchMouseEvent mouseMoved
Wire the CDP Input.dispatchMouseEvent "mouseMoved" type to a new
Frame.triggerMouseMove, which hit-tests the point via elementFromPoint
and dispatches mousemove, mouseover and mouseenter on the target,
mirroring the existing triggerMouseClick and the actions.zig hover()
event semantics.

Previously mouseMoved was silently ignored, so element.hover() over
Playwright/Puppeteer (CDP) fired no events. Addresses the hover gap
reported in #2043.
2026-06-04 14:07:34 +05:30
Karl Seguin
7335dcf736 Merge pull request #2634 from lightpanda-io/wpt_action_sequence
Support WPT action_sequence
2026-06-04 15:35:07 +08:00
Karl Seguin
5b6064309e Merge pull request #2632 from lightpanda-io/remove_children
Remove the fancy Children
2026-06-04 14:56:45 +08:00
Karl Seguin
7b25a61b33 Merge pull request #2626 from lightpanda-io/rc_canary
Add canary to RC
2026-06-04 14:55:36 +08:00
Karl Seguin
6efd88ced9 Support WPT action_sequence
Depends on: https://github.com/lightpanda-io/wpt/pull/69

WPT can send a list of JSON message to the browser in order to simulate user
interaction, e.g.:

  { type: "pointer", actions: [{type: "pointerMove", x, y, origin}, ...] }

While some of these aren't meaningful for us, many are. A lot of these are just:
1 - scroll to an element
2 - mouse down
3 - mouse up

With the main goal of generating trusted events.
2026-06-04 13:31:34 +08:00
Karl Seguin
ccd201a085 Merge pull request #2602 from lightpanda-io/wait_script_cache
Add Script cache to Runner.waitForScript
2026-06-04 13:21:05 +08:00
Karl Seguin
80bf294e1c update v8 dep 2026-06-04 12:49:51 +08:00
Karl Seguin
6a0855bb41 Add Script cache to Runner.waitForScript
This adds script compilation to the Runner.waitForScript loop. The goal here
isn't really to improve waitForScript - we generally expect these scripts to
be very simple. The goal is to introduce script caching so that it could be
used in more important places (e.g. ScriptManager).

Depends on https://github.com/lightpanda-io/zig-v8-fork/pull/181
2026-06-04 12:49:51 +08:00
Karl Seguin
a5adfef32a Initial popover support
Start adding support for "popover". This represents the single biggest non-
canvas grouping of failures in WPT `/html/**`. I suspect it has little real-
world impact, but it isn't impossible something blocks on a missing popup
event.

This essentially comes down to supporting various methods (e.g. showPopup) on
the HtmlElement as well as making the Input and Button popup-target aware.

The document keeps a list of opened popups which is used when we have to
determine if a popup is open (the new :popover-open pseudo selector) or when
toggling them.
2026-06-04 12:43:41 +08:00
Karl Seguin
4426b91588 Merge pull request #2630 from rohitsux/feat/node-lookup-prefix
feat(webapi): implement Node.lookupPrefix
2026-06-04 08:26:37 +08:00
Karl Seguin
cfc3fe1443 Merge pull request #2629 from lightpanda-io/cdp-cookie-path
Cookie.PreparedUri: Use only URL.getPathname for target url
2026-06-04 07:01:18 +08:00
Karl Seguin
a13ed53511 Remove the fancy Children
The point of children.Children was to save 8 bytes. But it doesn't. I don't
know if it ever did. It's @sizeOf(Children) is 16 bytes, exactly what
@sizeOf(DoublyLinkedList) is.

Maybe this came from when DoublyLinkedList held the length, in which case it
would have been different.

Either way, storing ?*DoublyLinkedList in Node:
1 - Takes the same amount of memory
2 - Simplifies the code
3 - Removes 1 indirection and 1 extra allocation in the case of having more than
    1 child (compared to how it was before).
2026-06-04 06:53:40 +08:00
Rohit
e830d1da4e feat(webapi): implement Node.lookupPrefix
Implement the Node.lookupPrefix(namespace) method per the WHATWG DOM
"locate a namespace prefix" algorithm: match the element's own
namespace and prefix, then scan its xmlns: attribute declarations for
one whose value is the namespace, then recurse to the parent element.

This is the inverse of the existing lookupNamespaceURI and completes
the namespace-introspection trio alongside isDefaultNamespace.
2026-06-03 21:03:27 +05:30
Pierre Tachoire
a0ecf9cb7c cookies: use an init for Cookie.PreparedUri 2026-06-03 16:48:55 +02:00
Pierre Tachoire
00a91c7dac cdp: fix network.getCookies url build
When getting cookies from CDP, we musn't apply specific cookies's
path/host extraction for the target URL, but use the simple URL rules.
2026-06-03 16:37:03 +02:00
Karl Seguin
720e610542 Merge pull request #2625 from lightpanda-io/deferring_layer_error_handling
DeferringLayer correctly handle header stop/errors
2026-06-03 20:57:36 +08:00
Karl Seguin
1e2e283c0c Add canary to RC
We still occasionally see release overflow errors. I think this is a UAF, since
I cannot find any mismatched acquire/releases. So this adds a canary value to
every RC and includes it in the crash dump.

If the canary value is different than what we set it at, then we have a UAF.
If the canary value is set to the poison we set on release, then we have a
double free.
If the canary value is unchanged, then it's inconclusive.
2026-06-03 18:42:24 +08:00
Karl Seguin
96548fd8e5 Merge pull request #2624 from lightpanda-io/deferring_layer_fixes
Fix two issues with DeferringLayer
2026-06-03 18:41:44 +08:00
Karl Seguin
205865f96c DeferringLayer correctly handle header stop/errors
When forwardHeader signals not to proceed, fire() should stop.

This is the direct fix to https://github.com/lightpanda-io/browser/issues/2622
2026-06-03 18:13:32 +08:00
Karl Seguin
20555150dd Fix two issues with DeferringLayer
The first is that it can outlive the Transfer and thus has to dupe anything
it'll use (e.g. the frame_id off the request).

The second is that flushFrame is reentrant (flushFrame -> fire -> flushFrame)
and that results in the active list and list pointers becoming invalid.
2026-06-03 17:31:40 +08:00
Karl Seguin
85d5e47ffc Merge pull request #2620 from lightpanda-io/better_css_name_parser
Better CSS name selector parser
2026-06-03 15:58:40 +08:00
Karl Seguin
5977242429 Merge pull request #2619 from lightpanda-io/redirect_url_lifetime
On redirect, ensure transfer owns the new url
2026-06-03 15:58:28 +08:00
Karl Seguin
bfad022452 Merge pull request #2618 from lightpanda-io/wait_until_networkalmostidle
Add "networkalmostidle" to --wait-until parameter
2026-06-03 15:58:15 +08:00
Karl Seguin
144e4b1191 Merge pull request #2616 from lightpanda-io/worker_module
Support for "module" type workers.
2026-06-03 15:58:01 +08:00
Karl Seguin
7a54da3c1c Merge pull request #2615 from lightpanda-io/ClientDisconnected_nolog
Don't overlog ClientDisconnected
2026-06-03 15:57:46 +08:00
Karl Seguin
0715bb067c Merge pull request #2614 from lightpanda-io/find_frame_popups
page.findFrame searches popups too
2026-06-03 15:57:29 +08:00
Karl Seguin
3b3ec6c1b0 Merge pull request #2612 from lightpanda-io/intercept_count
Improve / fix InterceptLayer.intercepted count tracking
2026-06-03 15:57:15 +08:00
Karl Seguin
841543bab0 Merge pull request #2613 from rohitsux/feat/html-embed-reflection
feat(webapi): reflect src, type, width and height on HTMLEmbedElement
2026-06-03 14:57:27 +08:00
Karl Seguin
50186cb328 Merge pull request #2617 from lightpanda-io/http_proxy_liftime
HttpClient dupes CDP-supplied proxy to ensure lifetime
2026-06-03 14:41:04 +08:00
Karl Seguin
7bb83ed823 Better CSS name selector parser
Applies the same/similar escaping logic as is already applied to identifiers
and values. Importantly, this allows matching for attribute names with a colon,
e.g. "ng:jq" which can be selected with "ng\:jq".

This fixes real issues with rendering Angular 1.x.
2026-06-03 13:10:34 +08:00