Commit Graph

4606 Commits

Author SHA1 Message Date
Karl Seguin
3ec507773c change sameSite to string to deal with case-insensitive values 2026-05-02 12:10:57 +08:00
guyua9
55a1efc7ed fix: accept CDP SameSite cookie casing 2026-04-29 00:44:08 +08:00
Muki Kiboigo
1057b9de8d toRequestId2 -> toRequestId on CDP 2026-04-28 07:01:43 -07:00
Muki Kiboigo
85a5c0f927 decrement intercepted and properly deinit on BrowserContext deinit 2026-04-28 07:01:43 -07:00
Muki Kiboigo
1ab445843c better arena management in Robots Layer and Context 2026-04-28 07:01:43 -07:00
Muki Kiboigo
24ece021e1 remove interception stuff in Transfer 2026-04-28 07:01:42 -07:00
Muki Kiboigo
0ecf981f7e add assert to SyncRequest headerCallback 2026-04-28 07:01:42 -07:00
Muki Kiboigo
1370f6805b add a note about cdp callback cb 2026-04-28 07:01:42 -07:00
Muki Kiboigo
3fe774fbfb pass error all the way up to Layer chain to clean 2026-04-28 07:01:42 -07:00
Muki Kiboigo
4de1dc5424 properly call error callback in InterceptionLayer 2026-04-28 07:01:42 -07:00
Muki Kiboigo
83b047e66a assert that intercepted isn't 0 before decrementing 2026-04-28 07:01:42 -07:00
Muki Kiboigo
c719a522b8 use lightpanda module log in layers 2026-04-28 07:01:42 -07:00
Muki Kiboigo
152a792c18 use Request Arena in RobotsLayer 2026-04-28 07:01:41 -07:00
Muki Kiboigo
e56036fb50 use Request Arena in CacheLayer 2026-04-28 07:01:41 -07:00
Muki Kiboigo
fc702794c2 use Request Arena in WebBotAuthLayer 2026-04-28 07:01:41 -07:00
Muki Kiboigo
d14b75d93b use Request arnea in InterceptionLayer 2026-04-28 07:01:41 -07:00
Muki Kiboigo
bb9e238f6c Requests now use arenas from the arena pool 2026-04-28 07:01:41 -07:00
Muki Kiboigo
175c2cc288 ensure robots params have arena and request id 2026-04-28 07:01:41 -07:00
Muki Kiboigo
87eec578aa use arena pool in InterceptionLayer 2026-04-28 07:01:41 -07:00
Muki Kiboigo
13cc122e26 remove InterceptState 2026-04-28 07:01:40 -07:00
Muki Kiboigo
ca08f0c56d remove blocking from RequestParams 2026-04-28 07:01:40 -07:00
Muki Kiboigo
3db3281e8e working authentication with InterceptionLayer 2026-04-28 07:01:40 -07:00
Muki Kiboigo
d0b421b085 partial auth challenge support 2026-04-28 07:01:40 -07:00
Muki Kiboigo
dddd0dfb90 fix request id mismatch on cdp 2026-04-28 07:01:40 -07:00
Muki Kiboigo
0d50f706db more fixing of hanging in cdp interception 2026-04-28 07:01:40 -07:00
Muki Kiboigo
9c826159a0 crude InterceptionLayer 2026-04-28 07:01:40 -07:00
Muki Kiboigo
6d41ea6fd0 move arena up to Request instead of Transfer 2026-04-28 07:01:39 -07:00
Muki Kiboigo
14ad5c9cdc move RequestStart to InterceptionLayer 2026-04-28 07:01:39 -07:00
Muki Kiboigo
e37c14a714 Transfer now uses Request's request_id 2026-04-28 07:01:39 -07:00
Muki Kiboigo
e988e49136 remove Context and thread *Client 2026-04-28 07:01:39 -07:00
Muki Kiboigo
b4a9bdd7a3 use syncRequest in ScriptManager 2026-04-28 07:01:39 -07:00
Muki Kiboigo
46d0b34c54 add RequestParams and SyncRequest 2026-04-28 07:01:39 -07:00
Muki Kiboigo
5dd15aa2cf use layers for Cache, Robots and WebBotAuth 2026-04-28 07:01:39 -07:00
Halil Durak
c5b16cb18e Config: add a custom validator for --log-level 2026-04-28 12:37:16 +03:00
Karl Seguin
d46be2dc2b Merge pull request #2283 from navidemad/fix-a18-navigation-referer
browser: send Referer on cross-page navigation requests
2026-04-28 16:01:10 +08:00
Navid EMAD
73a007f88e events: gate KeyboardEvent.keyCode/charCode on isTrusted, add Enter charCode
Address review feedback on the legacy KeyboardEvent.keyCode and
KeyboardEvent.charCode getters:

* `getKeyCode` and `getCharCode` now early-return 0 when the event is
  not trusted, matching Chrome's behavior. Synthetic events created via
  `new KeyboardEvent(...)` from script have `isTrusted === false` and
  therefore expose 0 for both legacy attributes; only events dispatched
  by the user agent itself surface the legacy mapping.
* `getCharCode` now uses `_type_string.eql(comptime .wrap("keypress"))`
  to match the idiom used elsewhere in the project.
* The charCode mapping is moved into a pure `Key.charCode()` helper that
  mirrors `Key.keyCode()`, including a `.Enter => 13` arm so a trusted
  `keypress` for Enter exposes `\r` (U+000D) per spec.

The JS test fixture is consolidated into a single block asserting the
Chrome-correct behavior for synthetic events. The full per-key mapping
table is now exercised via two pure-function Zig unit tests on
`Key.keyCode()` and `Key.charCode()`.
2026-04-28 07:12:29 +02:00
Navid EMAD
88b38d240d Merge remote-tracking branch 'origin/main' into fix-b5-keyboard-keycode 2026-04-28 07:00:17 +02:00
Navid EMAD
7feae5a958 events: implement KeyboardEvent.keyCode and charCode legacy attributes
Both getters were stubs returning 0. Per W3C UI Events § Annex C, keyCode
should report the legacy fixed virtual key code for the key being pressed
(e.g. 84 for 't'/'T', 16 for Shift, 13 for Enter), and charCode should
report the Unicode code point of the character produced on keypress events.

Adds a keyCode() method to the Key union that maps each named variant to
its spec-defined value and computes the uppercase-ASCII fallback for
.standard printable characters. getKeyCode delegates to it. getCharCode
checks the event type and returns the first byte of _key.standard for
keypress, 0 elsewhere.

For shift-modified symbol keys (e.g. shift+1='!'), keyCode falls back to
the modified char's ASCII rather than the unmodified key's value, since
KeyboardEvent doesn't currently store the unmodified key. Spec-strict
behavior would need plumbing unmodifiedText through KeyboardEventOptions
— left as a follow-up.

Closes #2291
2026-04-28 05:25:47 +02:00
Karl Seguin
827626db67 Merge pull request #2287 from sunguru98/chore/tests-htmlcollection-empty-name
browser: fix HTMLCollection empty name WPT
2026-04-28 11:16:40 +08:00
Sundeep Charan Ramkumar
325aebb231 browser: fix HTMLCollection empty name WPT 2026-04-28 08:07:57 +05:30
Navid EMAD
577a405f61 forms: address review feedback on range step matching
- Drop redundant `step_attr.len == 3` guard in `snapToStep`. Zig's
  `std.ascii.eqlIgnoreCase` already short-circuits on length mismatch
  (`ascii.zig:329`), so the outer length check is wasted work.

- Implement the `value` content attribute fallback for step base.
  Per https://html.spec.whatwg.org/multipage/input.html#concept-input-min
  the chain is `min` content attr -> `value` content attr -> 0. The
  fallback was previously skipped (step base went straight from `min`
  to 0), which meant `<input type=range value="3.5" max=10>` then
  `el.value = '5.3'` snapped to `5` instead of the spec-required `5.5`.
  Threads `value_attr` through `sanitizeRange` so the fallback engages
  whenever `min` is absent or unparseable but a parseable `value`
  content attr exists.

Three new test cases cover the fallback path (s10), the unparseable
`value` attr that falls through to 0 (s11), and `min` taking precedence
over `value` attr (s12).
2026-04-28 04:19:06 +02:00
Navid EMAD
b08f9b4abd Merge remote-tracking branch 'origin/main' into fix-2277-input-range-step-matching 2026-04-28 04:08:58 +02:00
Karl Seguin
716b6f338b Merge pull request #2279 from navidemad/fix-a20-form-attrs-on-submitter
forms: honor formaction / formmethod / formenctype on submit button
2026-04-28 09:49:48 +08:00
Navid EMAD
7237c377d3 browser: send Referer on cross-page navigation requests
Anchor click, form submit, and `location.href = ...` assignments queue a
navigation through `Frame.scheduleNavigation`, which then tears down the
originating page and rebuilds the frame in `Session.processRootQueuedNavigation`
before `Frame.navigate` issues the HTTP request. The originator's URL was
discarded with the old arena, so the request went out without a Referer
header — even though the HTML "navigate" algorithm and Fetch §4.5 require
one. `Frame.headersForRequest` (#1449) handled subresource fetches but was
never called from the navigation path.

Capture the originating frame's URL into a new `referer` field on
`NavigateOpts` at scheduling time, dup'd into the `QueuedNavigation` arena
so it survives the page tear-down. `Frame.navigate` adds it as a
`Referer:` header alongside the existing per-request headers. Iframe
initial navigation (`Frame.zig:1282`) also sets `referer = parent.url`
since the parent frame outlives that direct `navigate` call. CDP
`Page.navigate` (`.reason = .address_bar`) and `Page.reload` continue to
omit Referer — matches Chrome.

Closes #2281
2026-04-28 03:21:12 +02:00
Karl Seguin
f3ab1dcf78 Add constructor arity
Depends on https://github.com/lightpanda-io/zig-v8-fork/pull/174

Builds ontop of https://github.com/lightpanda-io/browser/pull/2272 largely
because it's driven by the same uievents WPT tests.

https://github.com/lightpanda-io/browser/pull/1498 added the length to
functions, and this does it for constructors.
2026-04-28 08:54:48 +08:00
Navid EMAD
1149a19411 forms: round <input type=range> value to nearest step on the step ladder
Per WHATWG HTML "Suffering from a step mismatch", value sanitization for
<input type=range> rounds the value to the nearest valid `step base + step * n`
after the existing min/max clamp. Ties round toward positive infinity; if the
rounded-up neighbor exceeds max, the rounded-down neighbor is used instead.
`step` defaults to 1; `step="any"` (case-insensitive) disables step matching.

When the post-snap value matches the parsed input value exactly, the original
string is returned unchanged so assignments like `el.value = "1.0"` round-trip
without canonicalization.

Closes #2277
2026-04-28 02:23:40 +02:00
Karl Seguin
ae8013f967 Merge pull request #2275 from lightpanda-io/nikneym/cli-variants
`cli`: introduce `variants` + fix `--wait-script-file` regression
2026-04-28 07:32:35 +08:00
Karl Seguin
b0d99a3a1b Merge pull request #2264 from navidemad/fix-a7-formdata-empty-select
forms: skip FormData entry for <select> with no selectedness candidate
2026-04-28 07:30:17 +08:00
Karl Seguin
0aa79e95fd Merge pull request #2267 from navidemad/fix-a17-input-range-clamp
forms: clamp <input type=range> value to min/max
2026-04-28 07:27:31 +08:00
Karl Seguin
407b4ae91f Merge pull request #2269 from navidemad/fix-b7-attribute-value-escape-decode
selector: decode CSS escape sequences inside quoted attribute values
2026-04-28 07:27:16 +08:00