Commit Graph
8748 Commits
Author SHA1 Message Date
Rohit a67bfbb74d feat(webapi): resolve navigator.geolocation from the emulation override 2026-08-19 20:33:02 +05:30
Rohit 0e875e2b03 feat(webapi): add navigator.geolocation with async error delivery
Adds the Geolocation and GeolocationPositionError interfaces plus a
navigator.geolocation accessor. getCurrentPosition schedules delivery
on the frame's js.Scheduler so callbacks always fire off the calling
stack, and covers the no-override path where no
Browser.geolocation_override is set: the error callback receives a
GeolocationPositionError with code POSITION_UNAVAILABLE (2), or
PERMISSION_DENIED (1) if the geolocation permission was denied via
CDP. Reading an override into a successful GeolocationPosition and
watchPosition/clearWatch are left for later work.
2026-08-19 20:16:21 +05:30
Rohit 56ef7b95ee feat(cdp): store Emulation.setGeolocationOverride on the browser 2026-08-19 19:53:16 +05:30
Karl Seguin 46de01944e Merge pull request #3228 from lightpanda-io/js-promise-reject-bad-receiver
webapi: promise-returning operations reject, don't throw, on bad receiver
2026-08-19 15:38:14 +08:00
Karl Seguin 6f53c42df9 Merge pull request #3227 from lightpanda-io/xml-parse-fidelity
webapi: xml parsing reject documetns that are not well formed
2026-08-19 15:38:03 +08:00
Karl Seguin 9c609d056d Merge pull request #3218 from pasmud/gaz/lightpanda-io-browser-aboutblank-global
fix: replace bootstrap about:blank global on first navigation (#3215)
2026-08-19 13:24:30 +08:00
Karl Seguin 5f96fc1c3c Add condition to full page reload on about:blank from CDP
The unconditional full load incurs a performance hit in the common case where
the about:blank is safe to use. This commit restores the fast-path only when
(a) the page is waiting for its initial navigate (same as before) and (b)
no Runtime.* methods were executed (i.e. no driver-driven JS was executed on
about:blank)
2026-08-19 12:48:21 +08:00
Karl Seguin 289620fbf8 webapi: promise-returning operations reject, don't throw, on bad receiver
We currently implement a v8 signature check on the receiver. This throws on
failure. However, for a promise-returning function, it should reject the
promise instead. This skips the (v8) signature check for promise-returning so
that it flows through the normal code which does rejection.

Fixes a few WPT cases (in fetch and FileAPI, but probably others too).

This reject, don't throw, is an ongoing thing that we're fixing, e.g.
https://github.com/lightpanda-io/browser/pull/3095
2026-08-19 12:00:14 +08:00
Karl Seguin 6acfc03579 Merge pull request #3226 from navidemad/agents-md-download-v8
AGENTS.md: mention make download-v8 before building
2026-08-19 08:55:41 +08:00
Karl Seguin 25aa46a6ca webapi: xml parsing reject documetns that are not well formed
Hooks into the xml5ever parse_error callback to capture parse errors and reject
malformed XML. Because of this stricter error handling, we need to do some
input pre-processing for edge cases (thank you WPT). We need to strip out
<!DOCTYPE svg [ <!ENTITY ...> ]> which comes form Illustrator SVG export since
that now causes errors (but should be ignored).

Finally, by default xml5ever closes any opened tags at the end of the stream.
Per WPT, these should be invalid.

The rust work was all Claude-driven.
2026-08-19 08:52:15 +08:00
Karl Seguin 1ed8d4a35d trim comments 2026-08-19 08:25:57 +08:00
Karl Seguin f2b4043171 Merge pull request #3222 from lightpanda-io/style-attr-resync
webapi: Re-parse element.style when style attribute changes
2026-08-19 07:45:36 +08:00
Karl Seguin 4b06c248e7 use element.ownerFrame to access StyleManager 2026-08-19 07:33:38 +08:00
Karl Seguin 20293bca9d Merge pull request #3220 from lightpanda-io/fileapi-filereader-async
webapi: make FileReader asynchronously + proper text decoding
2026-08-19 06:55:13 +08:00
Karl Seguin 411eed0a80 Merge pull request #3224 from lightpanda-io/cd-obey-robots
cdp: add obeyRobots to LP.configureCDP
2026-08-19 06:54:49 +08:00
Navid EMAD 2aecdab322 AGENTS.md: point agents at make download-v8 before building 2026-08-18 22:56:16 +02:00
Pierre Tachoire 067709bb58 cdp: add obeyRobots to lp.configureCDP 2026-08-18 17:07:18 +02:00
Karl Seguin d3c26f589e Merge pull request #3219 from lightpanda-io/sec-ch-ua-full-version
send Sec-Ch-Ua-Full-Version-List header
2026-08-18 20:00:44 +08:00
Pierre Tachoire 0a0164c972 remove useless null terminated version_z 2026-08-18 12:28:21 +02:00
Pierre Tachoire 9ff1ad8306 fix header key case for Sec-Ch-Ua* 2026-08-18 12:25:40 +02:00
Pierre Tachoire d91a5b1abd update getHighEntropyValues 2026-08-18 12:25:11 +02:00
Karl Seguin 34ca271b33 Merge pull request #3221 from lightpanda-io/option-multiple
undocument comma separated list option
2026-08-18 17:03:29 +08:00
Karl Seguin 701e361dd5 webapi: Re-parse element.style when style attribute changes
If we have a materialized element.style (stored in Frame._element_styles) and
the style attribute changes (e.g. via setAttribute('style', '....'), then the
materialized CSSStyleDeclaration has to be updated (cleared and the style
re-parsed)
2026-08-18 17:00:02 +08:00
Pierre Tachoire 0797eaf97a Merge pull request #3216 from lightpanda-io/ws-send-small-buffer
fix: support sending websocket data on a small buffer
2026-08-18 10:38:28 +02:00
Pierre Tachoire 25c85d9de4 undocument comma separated list option 2026-08-18 09:50:30 +02:00
Pierre Tachoire 85b52927ad Merge pull request #3211 from lightpanda-io/node-assigned-slot-optimization
perf: Introduce Node.flags for lookup shortcircuit
2026-08-18 09:40:09 +02:00
Karl Seguin 0d28a1c119 webapi: make FileReader asynchronously + proper text decoding
FileReader.readAs* now do their processing (and fires events) asynchronously on
the next scheduler tick. readAsText also now uses its encoding argument using
html5ever.encoding_decode (added for TextDecoder's encoder support).

FileReaderSync is a new (simple) Worker-only API.
2026-08-18 15:38:42 +08:00
Pierre Tachoire a961156283 send Sec-Ch-Ua-Full-Version-List header
Add Sec-Ch-Ua-Full-Version-List header with the full LP version

```
Sec-Ch-Ua-Full-Version-List: "Lightpanda";v="1.0.0-dev.8713+33867c727"
```
2026-08-18 09:38:00 +02:00
Karl Seguin 5c0aa90ea4 Merge pull request #3187 from lightpanda-io/http-header-option
add --http-header option to send headers on every HTTP requests
2026-08-18 15:24:10 +08:00
Pierre Tachoire 53f939be92 adjust --http-header help 2026-08-18 08:59:11 +02:00
Pierre Tachoire 33867c7275 Merge pull request #3116 from lightpanda-io/nikneym/adblocker-init
Initial implementation for easy list parsing and AdBlocker
2026-08-18 08:50:42 +02:00
Merge_Conflict - Pasi 45c4f7e93c fix: replace bootstrap about:blank global on first navigation (#3215)
A JS global set on a freshly-created target's initial about:blank page
survived the first Page.navigate: the CDP fast path navigated the active
blank frame in place, reusing its V8 context/global. A cross-document
navigation must replace the JS global object, so route every root
navigation through initiateRootNavigation, which commits a fresh
page/window/global and discards the bootstrap blank one (matching the
already-correct second-navigation behavior).
2026-08-18 06:26:22 +00:00
Karl Seguin c9bb82c968 fix: support sending websocket data on a small buffer
I don't know why, but I had assumed libcurl wouldn't give us a 1 byte buffer. It
did. This adjusts the send path so that it works when given a 1 byte buffer (
instead of failing an assertion).
2026-08-18 13:31:03 +08:00
Karl Seguin a9b96fe5f8 Centralize header validation
Mime.isHttpToken already exists for the header name, added
Mime.isHttpHeaderValue which was extracted from het/Headers.zig. Now Config (
for validating CLI headers), net/Headers for script headers, and cdp/network.zig
all use the same validation methods.
2026-08-18 13:02:15 +08:00
Karl Seguin 51b706ffd5 Merge pull request #3210 from lightpanda-io/nested-click-protection
webapi: prevent click() from triggering click()
2026-08-18 07:18:31 +08:00
Karl Seguin 8d455964a6 Merge pull request #3214 from lightpanda-io/urlpattern
webapi: URLPattern
2026-08-18 07:12:27 +08:00
Karl Seguin 1b66abf9ee Merge pull request #3213 from lightpanda-io/performance-observer-uaf
fix: UAF when Performance Observer disconnects in callback
2026-08-18 07:12:15 +08:00
Pierre Tachoire a6afdce444 add --http-header option to send headers on every HTTP requests 2026-08-17 17:18:13 +02:00
Karl Seguin a4b2583051 fix: UAF when Performance Observer disconnects in callback
WPT /performance-timeline/po-mark-measure.any.html in debug (can pass in release
since this is UB). Performance observers disconnected during callback are only
removed after the run completes.
2026-08-17 18:22:21 +08:00
Karl Seguin 3a646d162d webapi: URLPattern
This is almost all Claude driven. I guided it for the arena/finalizer, asserted
it's unit test work in Firefox, and WPT'd the result. (WPT 15/2440 -> 2440/2440)
It's a single WebAPI interface that isn't used from within Zig.
2026-08-17 17:56:15 +08:00
Pierre Tachoire 366f889c29 Merge pull request #3201 from lightpanda-io/robots-allowed-disallowed
`robots.txt` status handling
2026-08-17 11:54:27 +02:00
Karl Seguin a32c65522b perf: Introduce Node.flags for lookup shortcircuit
https://github.com/lightpanda-io/browser/pull/3195 introduced a Flags within the
padding of Element to avoid map lookups on the shadow dom piercing hot path.

This does the same thing for Node for Frame._assigned_slots. Node also has spare
padding,and this lookup happens on every hot of every event path.
2026-08-17 12:04:34 +08:00
Karl Seguin e2e8d4c730 webapi: prevent click() from triggering click()
/html/editing/activation/click_checkbox.html is a DCHECK crash (debug only) and
just a failure in ReleaseFast.

click() handler shouldn't trigger its own click(). Click is singled out for this
behavior, which is 'do nothing':
https://html.spec.whatwg.org/multipage/interaction.html#click-in-progress-flag

Used the new Element flags. There's a simple way to implement this in
EventManager, but the element flag is cheaper and it's currently not used. If
someone ever needs that bit, they can implement the stack-based solution.
2026-08-17 11:36:46 +08:00
Karl Seguin 2724e1704c Merge pull request #3204 from lightpanda-io/improve-xpath-support
webapi: improve xpath support
2026-08-17 08:35:30 +08:00
Karl Seguin 866eaa2b98 Merge pull request #3206 from lightpanda-io/dom-reflection
webapi: Add (and rework) many element getter/setters
2026-08-17 08:35:15 +08:00
Karl Seguin 95c26ed346 Merge pull request #3205 from lightpanda-io/label-click-crash
crash: Fix potential crash on label click.
2026-08-17 08:34:57 +08:00
Adrià Arrufat 8ffc8de6e8 Merge pull request #3207 from lightpanda-io/build-zig-cleanup
build: simplify build.zig
2026-08-16 15:09:59 +02:00
Muki Kiboigo 3bebe80e2f 401 and 403 are treated as disallow by RobotsGate 2026-08-15 11:48:06 -07:00
Adrià Arrufat 904e34b102 build: simplify build.zig
Deduplicate the three executable blocks and the vendored C library
module setup, drop vestigial error unions, and replace hand-rolled
formatting with b.fmt/b.pathJoin/std.mem.concat.

The snapshot-creator and skills executables now get the same
sanitize_c/sanitize_thread flags as the browser executable, which
they were silently missing.

Prebuilt V8 discovery now reports every cache miss with the probed
path. Previously a miss on the static archive path fell back to the
source build without a message, and the dev_fast message claimed a
source build was starting when the graph might not compile anything.
2026-08-15 15:08:41 +02:00
Karl Seguin 2fce4d6afd crash: Fix potential crash on label click.
This fixes a WPT crash on /html/semantics/forms/the-label-element/clicking-noninteractive-labelable-content.html

The short of it is that a label activates a click on a different element (it's
the only element that does this), and if that element is inside the label and
has its own activation behavior, you end up in an infinite loop.
2026-08-15 19:40:57 +08:00