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.
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.
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.
Largely about passing the 1024 /domxpath/xml_xpath_runner.html WPT cases (0
passing before this).
-evaluate/createExpression's `resolver` can be a function OR an callback object.
We don't use it, so ?js.Function -> ?js.Value is an easy win
-animated use legacy xlink:href attribute if present
-better pseudo namespace support for attributes. We now preserve the prefix in
the attribute name (so xlink:href stays xlink:href) AND, for 3 common
namespaces with fixed prefixes, we getAttributeNS and hasAttributeNS _will_
work. (because these are fixed, it's ok that we don't store the namespace in
attribute, we can just look for the fully qualified name and fallback to the
original check if we don't find it).
Builds ontop of https://github.com/lightpanda-io/browser/pull/3200 to centralize
header enforcement and standardize merge vs overwrite header logic.
The API is still a `setHeader` and `appendHeader`, with a source, but set/append
both are thin wrappers around private `putHeader`. putHeader blocks overwriting
restricted headers (user-agent). The `source` acts as a priority (ordered enum)
which further restricts the header AND depending on whether set or append were
called, controls if the value is overwritten or appended to.
3200 had an always-append which can cause problems, e.g. a script setting
Accept-Language: fr would have results in the value being appended to the
default, e.g.: 'en-US,en;q=0.9, fr'.