Commit Graph
9542 Commits
Author SHA1 Message Date
Halil Durak 5ff3af6178 AdBlocker: update tests 2026-08-13 16:39:12 +03:00
Halil Durak 58286369ed AdBlocker: integrate HostnameTrie to AdBlocker 2026-08-13 16:39:12 +03:00
Halil Durak da96cffe9c mem.trimRight -> mem.trimEnd 2026-08-13 16:39:12 +03:00
Halil Durak 0055ed63fc mem.trimLeft -> mem.trimStart 2026-08-13 16:39:12 +03:00
Halil Durak b553139d1c HostnameTrie: add a Zig port of uBO's HNTrie
Add a faithful port of `HNTrie`; from the benchmarks made, memory usage is lower than hashmap approach (with wyhash as hasher), roughly ~1.8x.
2026-08-13 16:39:11 +03:00
Halil Durak 67a166b88e initial implementation for easy list parsing
This introduces `adblock`; which implements parsing rules required to generate `NetworkFilter`s out of fed easy list bytes. Cosmetic filters and conditionals are currently  omitted.
2026-08-13 16:39:11 +03:00
Karl Seguin aa0909aef1 chore: bump WPT --max-mem from 100 to 200
Some WPT tests just take more memory, e.g. shadow-dom/declarative/gethtml.html.

Also left some placeholder comments for profiling JS (which I used to make sure
this was just v8 memory usage). These placeholders used to exist but didn't
survive the session multi-page refactor (figured I'd fix it next time I needed
it, and now I needed it).
2026-08-13 21:06:31 +08:00
Pierre Tachoire 84daa37e22 Merge pull request #3186 from lightpanda-io/readme-wpt-link
chore: link to our daily wpt results
2026-08-13 15:02:42 +02:00
Karl Seguin bc805ec18a Merge pull request #3178 from lightpanda-io/prebuild-shared-v8
dev: support for pre-build shared library
2026-08-13 20:06:19 +08:00
Karl Seguin ff339f0342 chore: link to our daily wpt results 2026-08-13 20:04:35 +08:00
Karl Seguin c95135b5c2 update v8 dep 2026-08-13 19:31:37 +08:00
Karl Seguin af99e845df dev: support for pre-build shared library
Supports prebuild-v8 shared library and adds a `download-v8-shared` make target.
Depends on: https://github.com/lightpanda-io/zig-v8-fork/pull/198

The auto-discovery of the .so is done in the build.zig, which is different than
the auto-discovery of the .a which is done in the Makefile. This is intentional
and if we inverse -Ddev_fast so that it's on by default, the .a's auto discovery
will be moved to build.zig for consistency and explicitness. As-is, we have no
way to tell whether -Dprebuilt_v8_path=v8.a is being injected by Makefile or
is explicit (which isn't a problem so long as we're not doing dev_fast by
default).
2026-08-13 19:28:21 +08:00
Karl Seguin dbb4bab0a0 webapi: improve console conformance
Saw a non-fatal error on cnn.com related to console. All members are supposed
to be static. Ran it through WPT /console/ and improved a few different thigns:

- added dir and dirxml
- assert condition is optional
2026-08-13 19:25:45 +08:00
Pierre Tachoire a894331b1d Merge pull request #3170 from guyua9/fix/advertise-host-wildcard
cdp: fall back to loopback when /json/version bind host is a wildcard
2026-08-13 11:43:50 +02:00
Pierre Tachoire 9f18af9225 Merge pull request #3183 from lightpanda-io/split-cdp-conns-from-threads
cdp: split active_conns from active_threads
2026-08-13 11:43:34 +02:00
Muki Kiboigo d1d02e1114 dupe into owned arena for SingleFlight initial 2026-08-13 01:37:21 -07:00
Muki Kiboigo 4ed60ffc90 use reference to http client in SingleFlight tests 2026-08-13 01:37:19 -07:00
Pierre Tachoire b340071d03 config: only flag wildcard bind when no --advertise-host is set 2026-08-13 09:54:28 +02:00
Muki Kiboigo d3a1dd77f2 use test_browser http client in SingleFlight tests 2026-08-13 00:30:30 -07:00
Muki Kiboigo bb8b46145f get rid of SingleFlight abort 2026-08-13 00:26:14 -07:00
Muki Kiboigo f7e6464370 SingleFlight should own the key 2026-08-13 00:25:33 -07:00
Pierre Tachoire 1f4a060765 add a func to detect wildcard host 2026-08-13 09:21:42 +02:00
Karl Seguin fec340f079 Merge pull request #3184 from staylor/fix/mutation-termination-teardown
stability: clear V8 terminating state after a terminated microtask checkpoint
2026-08-13 14:51:32 +08:00
Karl Seguin 9c1998076c stability: cancel a termination only at a safe point
Cancel termination only when all context have a call_depth == 0. This ensures
that termination "sticks" all the way up a nested call. Without this, a nested
call could clear a terminate which targeted something up the stack.
2026-08-13 14:07:32 +08:00
Muki Kiboigo cc5537dd63 discard if failure after single_flight enter 2026-08-12 18:32:46 -07:00
Muki Kiboigo 00d5be5c5b deallocate queued with same singleflight allocator 2026-08-12 18:17:42 -07:00
Muki Kiboigo 82e9496409 use SingleFlight in RobotsGate 2026-08-12 18:04:04 -07:00
Muki Kiboigo 7593eb5af7 add SingleFlight component 2026-08-12 18:04:02 -07:00
Karl Seguin b7868c455b Merge pull request #3181 from lightpanda-io/getHTML
webapi: Element/ShadowRoot getHTML
2026-08-13 06:40:45 +08:00
Karl Seguin 85608c1051 Merge pull request #3180 from lightpanda-io/shadowdom-relocation
webapi: Track node relocation across shadow roots
2026-08-13 06:40:02 +08:00
Scott Taylor d0c145b0c9 Clear V8 terminating state after a terminated microtask checkpoint
A JS entry (JSEntry) clears V8's terminating state when the termination
exception unwinds past it, which is what tryCall and friends rely on.
A microtask checkpoint does not: when a requested termination (watchdog,
CDP-disconnect kill) lands inside a checkpoint-delivered callback such
as MutationObserver delivery, PerformCheckpoint returns with
IsExecutionTerminating still set and nothing ever clears it. Every
later V8 call in that isolate then runs against a terminating isolate
and can return empty where callers don't expect it, ending in SIGSEGV
during connection teardown.

Cancel the V8-level termination after a checkpoint in which a terminate
landed, keeping the sticky terminate_requested so the existing entry
gates keep refusing new JS, and skip the remaining context queues.

Production-observed sequence this covers (SIGSEGV/139 tails):
  watchdog stall -> MutObserver.deliverRecords err=ExecutionTerminated
  -> frame.deliverMutations -> closing connection (pending terminate)
  -> SIGSEGV

Assisted-By: devx/95b8cb7f-8baf-4a28-93bf-61bc21612890
2026-08-12 12:49:42 -04:00
Pierre Tachoire cca6a0d389 rename error.MaxThreadsReached into error.MaxConnectionsReached 2026-08-12 17:43:01 +02:00
Pierre Tachoire 192c3deb0f typo fix 2026-08-12 17:41:31 +02:00
Pierre Tachoire 530c3aef8a cdp: split active_conns from active_threads
Split active_conns and active_threads to free a CDP conn slot as soon as
possible.
It gives a room where we have more active threads than allowed CDP
connections while threads shudown.
2026-08-12 16:19:49 +02:00
Karl Seguin e443922788 webapi: Element/ShadowRoot getHTML
Adds the getHTML methods to Element and ShadowRoot. This is expected to add
another ~6K passing WPT tests (significantly improving out score in the
/shadow-dom/ category). It's also probably also a useful API to implement.
2026-08-12 17:23:20 +08:00
Karl Seguin 59be69b1f8 webapi: Track node relocation across shadow roots
All add/remove node operations come down to Frame.removeNode and
Frame._insertNodeRelative. But not all remove/insert are the same, e.g. removing
a disconnect node is different than removing a connected node. Also, a "move"
operation is a remove+insert, but some move operations appear more atomic than
others. There is both a correctness and an optimization side to these
differences.

Previously, removeNode took a will_be_reconnected: bool option and insert took
a child_already_connected: bool. Essentially, remove wants to know the
post-removal intention, and insert wants to know the pre-insert state.

The simple booleans work for simple cases, but fail for ShadowDOM: it isn't
enough to know if `will_be_reconnected`...we need to know in what root it'll
be reconnected. Both remove and insert become tristate:

1 - is staying in the same root
2 - is staying connected, but in a different root
3 - is becoming connected for the first time

This commits changes `will_be_reconnected: bool` to `reconnect_to: ?*Node` and
`child_already_connected: bool` to `previous_root: ?*Node`. So most callsites
had to be updated - which is why so many files were touched. But the bulk of
the change is in those two Frame method which must now handle the tristate.
2026-08-12 16:03:26 +08:00
Karl Seguin 23bba947da Merge pull request #3169 from lightpanda-io/eventtarget-bare-tag
mem: Swith EventTarget's _type to a bare tag
2026-08-12 09:48:16 +08:00
Karl Seguin a7d94c18b3 Merge pull request #3175 from staylor/fix/playwright-redirect-chain
Fix Playwright redirect routing chains
2026-08-12 09:22:10 +08:00
Karl Seguin bbf2493695 zig fmt 2026-08-12 08:01:17 +08:00
Karl Seguin 0f6ea46b2e mem: Swith EventTarget's _type to a bare tag
Same change as https://github.com/lightpanda-io/browser/pull/3128 but for
EventTarget. This shrinks all EventTargets (i.e. most WebAPI interfaces) by 8
bytes.
2026-08-12 08:01:12 +08:00
Karl Seguin efc7613768 Merge pull request #3172 from lightpanda-io/js_mem_gauge
metrics: Add js memory gauge
2026-08-12 07:46:21 +08:00
Scott Taylor ba01f0a963 cdp: scope redirect response to redirect events
Assisted-By: devx/c10f9997-2afd-4688-a7fa-f3839c4cc22e
2026-08-11 14:24:57 -04:00
Scott Taylor ff975b106f cdp: report redirect chains before interception
Assisted-By: devx/c10f9997-2afd-4688-a7fa-f3839c4cc22e
2026-08-11 14:15:09 -04:00
Karl Seguin 99bfc2fdeb Merge pull request #3167 from lightpanda-io/self-hosted
dev: add -Ddev_fast flag
2026-08-11 20:47:43 +08:00
Karl Seguin fff4b4b44d Merge pull request #3171 from lightpanda-io/nikneym/webkit-matches-selector
`Element`: alias `matches` with `webkitMatchesSelector`
2026-08-11 20:38:07 +08:00
Karl Seguin 5b3de8a400 Merge pull request #3168 from lightpanda-io/shadowroot-events
webapi: improve events from shadowroot
2026-08-11 20:34:03 +08:00
Karl Seguin 6dba13b218 metrics: Add js memory gauge
Unlike the histogram, which is only captured on page teardown, this attempts to
capture the live memory (at a few selected known points, e.g. "load").
2026-08-11 20:30:45 +08:00
Halil Durak 4d8c0f6d92 update tests 2026-08-11 14:46:48 +03:00
Halil Durak 4b70b9523a Element: alias matches with webkitMatchesSelector 2026-08-11 14:46:17 +03:00
guyua9 8be30d56f8 cdp: fall back to loopback when /json/version bind host is a wildcard
buildJSONVersionResponse() previously formatted whatever Config.advertiseHost()
returned straight into webSocketDebuggerUrl. When serve was started with
--host 0.0.0.0 (or ::) without an explicit --advertise-host, advertiseHost()
returned the literal wildcard, so CDP discovery handed remote clients a
URL like ws://0.0.0.0:9222/ that can never be dialed. This was the root
cause reported in issue #1922: Playwright MCP and chromedp fail with
ECONNREFUSED when connecting through the official Docker image, which
sets --host 0.0.0.0 unconditionally.

AdvertiseHost now substitutes 127.0.0.1 for wildcard binds so the
discovery URL stays connectable from the same host (covers the official
Docker image via its published port, plus WSL's localhost bridge).
Users who serve from a dedicated interface can still pin the URL with
--advertise-host.

buildJSONVersionResponse now emits a one-time log.note when the bind
host is a wildcard so operators know to set --advertise-host for
multi-host setups. Tests cover the wildcard, the explicit-override and
the concrete-host cases.
2026-08-11 18:20:42 +08:00