Add missing toJSON, use Arena + Finalizers for delivery / GeolocationPosition
and coordinates. Return permission denied if permission isn't set, regardless of
override. Split structs into their own files.
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.
1. The horizontal position of an element is now calculated based on the
horizontal position of it's siblings (up the tree). Rather than merely the
count * default width.
2. translateX is parsed on inline styles and applies to the horizontal position
1 & 2 fix the https://lseo.com/ issue, but they add overhead to APIs that can be
used a lot. So:
3. Most element dimensions api relied on getElementDimensions which calculated
both the height and width dimensions, even though they only needed once
(e.g. getClientHeight only needs the height). These methods now only get
the axis that they care about
4. Because we do more style sheet lookups, and thus more lookups in
Frame._element_styles, Element.flags now has an has_inline_style which
helps avoid the lookup.
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)
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
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.
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)
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.
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).
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).
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.
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.
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.
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.
/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.
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.
This adds a bunch of missing attributes to various HTML Elements, e.g.
div.align.
These attributes all end up calling getAttribute and setAttribute, but with
a fairly fixed set of transformation, e.g. fieldset.disabled has to be a
boolean. So, a new helper has been added to generate bridge accessors. Existing
accessor which are not used in Zig now use this helper.
**The only interesting change here is the addition of:**
src/browser/webapi/element/reflection.zig
Should pass ~9400 WPT cases.