Commit Graph

4629 Commits

Author SHA1 Message Date
Karl Seguin
b375603258 On Window.close, remove any queued navigation 2026-04-29 18:59:35 +08:00
Karl Seguin
5de4ee166f Merge pull request #2237 from lightpanda-io/window_open
window.open
2026-04-29 18:32:58 +08:00
Karl Seguin
1262964efe Merge pull request #2308 from navidemad/fix-a26-textarea-crlf
forms: normalize CR/LF to CRLF in form-data set encoding
2026-04-29 17:07:45 +08:00
Adrià Arrufat
92db1b4a5e Merge pull request #2294 from navidemad/fix-a24-ua-stylesheet-display-none
css: apply UA stylesheet display:none defaults for unrendered elements
2026-04-29 08:51:53 +02:00
Adrià Arrufat
d92ebdeb89 css: apply zig fmt to Element.zig 2026-04-29 08:22:55 +02:00
Navid EMAD
aca6518850 selector: gate :disabled / :enabled on the HTML "disabled concept"
Per HTML "concept-fe-disabled", only listed elements (button, input,
select, textarea, optgroup, option, fieldset) participate in the
disabled concept. Anything else (e.g. <div disabled>) has no disabled
state and never matches :disabled / :enabled.

Add Element.hasDisabledConcept() and gate isDisabled() on it. Update
the :enabled selector arm so non-form-controls no longer match.
2026-04-29 05:50:54 +02:00
Navid EMAD
628c170b11 Merge remote-tracking branch 'origin/main' into fix-a21-disabled-inheritance 2026-04-29 05:42:27 +02:00
Karl Seguin
78babf4017 Merge pull request #2261 from navidemad/fix-a3-handle-javascript-dialog
lp: add LP.handleJavaScriptDialog to drive confirm/prompt return values
2026-04-29 11:12:05 +08:00
Navid EMAD
7dccf59ec2 zig fmt linting 2026-04-29 03:45:09 +02:00
Navid EMAD
82497a78a8 selector: walk fieldset/optgroup ancestors when matching :disabled
The `:disabled` and `:enabled` pseudo-class matchers in
`webapi/selector/List.zig` only checked the element's own `disabled`
content attribute. Per HTML "selector-disabled" + "concept-fe-disabled"
+ "concept-option-disabled", a form control inside <fieldset disabled>
matches :disabled (with the first-<legend> exception), and an <option>
inside <optgroup disabled> matches :disabled.

Route both pseudo-classes through `Element.isDisabled` (which already
walks the fieldset chain) and extend `isDisabled` to cover the
<option> + <optgroup disabled> case. <option> intentionally does NOT
inherit from <fieldset disabled> or <select disabled> — confirmed
against Chrome.

Closes #2314
2026-04-29 03:36:41 +02:00
Navid EMAD
6211b21813 dom: route <input type=image> click into form submission
Frame.handleClick's .input arm matched only _input_type == .submit and
fell through for .image, so clicking an image button fired the click
event but never scheduled a navigation or dispatched the form's submit
event. Per HTML §4.10.18.6.4 image buttons are submit buttons and must
submit their owning form.

The submitForm path already passes the input element as the submitter,
and FormData.collectForm already handles image submitters by appending
`name.x` and `name.y` (or bare `x`/`y` for unnamed inputs) coordinate
entries to the form-data set. Only the routing in handleClick was
missing. Coordinates are 0 for programmatic .click() per the spec.

Closes #2311
2026-04-29 02:52:50 +02:00
Navid EMAD
8cc82d1d64 lp: move handleJavaScriptDialog pre-arm from Page to LP namespace
Per upstream review (#2261): Page.handleJavaScriptDialog is a standard
CDP method that reactive Chrome-style drivers send in response to a
Page.javascriptDialogOpening event. Repurposing it for the proactive
pre-arm flow risks surprising those drivers — the next dialog they
trigger would be blindly accepted.

Move the pre-arm handler to LP.handleJavaScriptDialog so only
Lightpanda-aware clients opt in. Page.handleJavaScriptDialog reverts
to the upstream stub returning -32000 "No dialog is showing" so the
reactive surface is unchanged. The Page.javascriptDialogOpening event
listener still pops the BrowserContext stash and fills the response
output param — only the setter moved.

Tests rename cdp.page: → cdp.lp: and target LP.handleJavaScriptDialog;
behavior coverage is identical.
2026-04-29 02:04:20 +02:00
Navid EMAD
6c2d78d0f0 Merge remote-tracking branch 'origin/main' into fix-a3-handle-javascript-dialog 2026-04-29 01:56:55 +02:00
Navid EMAD
7c6f2a2a8c forms: normalize CR/LF to CRLF in form-data set encoding
Per the HTML form-data set encoding algorithm, every U+000A (LF) not
preceded by U+000D (CR) and every U+000D (CR) not followed by U+000A
(LF) in an entry's name or value is replaced with the two-byte sequence
CR+LF before percent-encoding. Without this pass, a textarea API value
containing LF (per the textarea wrapping transformation) submits as raw
%0A on the wire instead of the spec-required %0D%0A.

The normalization is gated on URLEncodeMode == .form so URLSearchParams
(.query) still follows the URL standard's serializer, which doesn't
normalize. Same pass covers names + values for both the POST
application/x-www-form-urlencoded body and the GET query-string path
(both go through the same encoder before URL.concatQueryString).

Closes #2307
2026-04-29 01:53:17 +02:00
Karl Seguin
e133b26e9b Merge pull request #2306 from lightpanda-io/feat/2249-htmlframesetelement-stub
Feat/2249 htmlframesetelement stub
2026-04-29 07:46:06 +08:00
Karl Seguin
f15948c5a4 Finalize *partial* frameset support 2026-04-29 07:16:33 +08:00
Navid EMAD
fd2f26a065 Merge remote-tracking branch 'origin/main' into fix-a3-handle-javascript-dialog 2026-04-29 00:57:03 +02:00
Navid EMAD
dfa0ba778d css: address review feedback on UA display:none helper
- Tighten matchesUaDisplayNoneRule docstring; lead with the
  centralization purpose and HTML Rendering §15.3.1 spec citation.
- Reorder checks: tag-name UA list first (O(1) switch, exits for
  ~95% of elements with ordinary tags before the attribute lookup).
- Use el.is(Input) + input._input_type == .hidden instead of
  case-insensitive string compare on the raw "type" attribute;
  matches the pattern used in EventManager / Form / RadioNodeList,
  and _input_type is parsed case-insensitively at attribute-set time.
- Compress the comment block above the matchesUaDisplayNoneRule
  call site in isElementHidden.

Behavior-preserving refactor; full unit test suite (494 tests) passes.
2026-04-29 00:53:10 +02:00
Navid EMAD
7c190d9e69 Merge remote-tracking branch 'origin/main' into fix-a24-ua-stylesheet-display-none 2026-04-29 00:47:56 +02:00
Muki Kiboigo
e8c9acd310 fix request arena leak on CacheLayer hit 2026-04-28 09:48:23 -07: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