Commit Graph

5919 Commits

Author SHA1 Message Date
Karl Seguin
9d271ce4ae Fix more DOM assumptions that callback and document.write can break
As we've seen before, both document.write and custom elements callbacks can
introduce otherwise impossible states. See https://github.com/lightpanda-io/browser/pull/2172
for just one example.

The issue with both is that they can trigger code during DOM manipulation that
renders the state of that DOM manipulation invalid. This commit started with
a fairly easy case to understand (one that actually happened in production). It
goes something like:

```
<div id=x>
  <script>
    document.write('<script>x.innerHTML = "";</script>');
  </script>
</div>
```
Here we see that the written script deletes the node which is in the process
of being rendered.

These issues are almost always easy to fix, but they're hard to predict. After
fixing this issue, I asked Claude to check for other cases, and it was able to
find / reproduce / fix two more involving custom elements callback.
2026-04-29 09:09:07 +08: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
muki
f0675a8d2b Merge pull request #2304 from lightpanda-io/ci-rust-cache
Use Rust Cache in CI for `html5ever`
2026-04-28 11:03:16 -07:00
muki
cf34a508d4 Merge pull request #2302 from lightpanda-io/http-cache-layer-arena-leak
Fix Request Arena Leak on CacheLayer Hit
2026-04-28 10:27:13 -07:00
Muki Kiboigo
ec0af94939 use rust cache in ci for html5ever 2026-04-28 10:15:14 -07:00
Muki Kiboigo
e8c9acd310 fix request arena leak on CacheLayer hit 2026-04-28 09:48:23 -07:00
Pierre Tachoire
427cdfe3ce Merge pull request #2079 from lightpanda-io/http-client-layering
Layering HTTP Client
2026-04-28 16:23:42 +02: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
Pierre Tachoire
86217dd78f Merge pull request #2295 from lightpanda-io/e2e-matrix
ci: create a matrix for e2e tests
2026-04-28 16:00:52 +02:00
Karl Seguin
8ac769bb10 Merge pull request #2298 from lightpanda-io/nikneym/fix-log-level-regression
`Config`: add a custom validator for `--log-level`
2026-04-28 17:49:29 +08: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
Karl Seguin
70c7b7aa9a Merge pull request #2292 from navidemad/fix-b5-keyboard-keycode
events: implement KeyboardEvent.keyCode and charCode legacy attributes
2026-04-28 15:46:54 +08:00
Pierre Tachoire
ece2ec3753 ci: create a matrix for e2e tests 2026-04-28 09:31:54 +02: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
Karl Seguin
2bbf23b3bd Merge pull request #2280 from navidemad/fix-2277-input-range-step-matching
forms: round <input type=range> value to nearest step on the step ladder
2026-04-28 10:55:48 +08:00