Commit graph

4964 commits

Author SHA1 Message Date
Shannon Booth
5ef34ecb7a LibURL: Use libpsl for public suffix matching
Replace the generated public suffix table and custom matcher with a
direct LibURL PublicSuffixData implementation backed by libpsl. This
drops our PSL download/generator path and uses the same library already
used by libcurl.

Performance is comparable before and after, while LibURL binary size
is smaller.
2026-06-10 11:43:44 +02:00
Andreas Kling
ec3ea7ed25 Meta: Enable glibc fortify checks on Linux
Define _FORTIFY_SOURCE=3 for Linux builds so glibc can use dynamic
object size checks around fortified libc calls.
2026-06-10 01:33:39 +02:00
Andreas Kling
65eddc925c Meta: Enable stack clash protection on Linux
Pass -fstack-clash-protection for Linux builds. This asks the
compiler to probe large stack allocations incrementally so they cannot
skip over stack guard pages.
2026-06-10 01:33:39 +02:00
Andreas Kling
30ec75ee74 Meta: Enable full RELRO on Linux
Pass -z relro and -z now to ELF linkers on Linux when the
linker supports them. This makes relocation sections read-only after
startup and disables lazy binding so the GOT is protected as well.
2026-06-10 01:33:39 +02:00
Shannon Booth
6c2ad3af02 LibWeb/Bindings: Reuse @@iterator method for sequence union conversion
When converting an object to a union containing a sequence, Web IDL
first gets @@iterator to decide whether the sequence arm applies, then
creates the sequence from the iterable using that same method.

The generator instead called sequence_to_idl_value(), which repeated the
@@iterator lookup. Split out create_sequence_from_iterable() and use it
from union sequence/FrozenArray conversion so overridden Symbol.iterator
accessors are only observed once.
2026-06-09 21:24:18 +02:00
Andrew Kaster
076f636667 Meta: Enable Gtk UI on macOS 2026-06-09 17:10:31 +02:00
Andreas Kling
4522340416 LibWeb: Preserve implemented overloads with FIXME siblings
Do not emit an unimplemented prototype property for an operation name
when at least one overload with that name is implemented. The overload
resolver already filters FIXME overloads out of the native overload set,
so defining an unimplemented property afterwards replaces the working
function with undefined.

This lets WebGL2RenderingContext.texImage2D keep its implemented WebGL1
and typed-array overloads even though the PBO-offset overload remains
marked FIXME.
2026-06-09 16:08:44 +02:00
Andreas Kling
13a804dbf6 LibWeb: Compact generated CSSStyleProperties bindings
Stop emitting every generated CSS property accessor as an IDL attribute.
Instead, generate a compact CSSStyleProperties initializer that installs
all property aliases from a table and dispatches through one native
function class carrying the UTF-16 property name.

This keeps the generated binding file focused on cssFloat and moves the
large property list into a simple generated table.
2026-06-09 11:48:02 +02:00
Andreas Kling
aa01898299 LibWeb: Reuse generated attribute name IDs
Emit each generated attribute name once and reuse that UTF-16 id when
creating the getter, creating the setter, and defining the accessor.
This avoids repeating the same Utf16FlyString literal at every generated
attribute binding.
2026-06-09 11:48:02 +02:00
Andreas Kling
388ec003ca LibWeb: Take UTF-16 names in CSS property APIs
Move the remaining CSSStyleDeclaration property-name APIs to
Utf16FlyString. This lets CSSOM binding and generated accessor code
pass JS property names without first constructing FlyString values.

Keep internal custom-property and descriptor storage unchanged for now.
Those remaining FlyString conversions are at storage boundaries that
will be migrated in follow-up commits.
2026-06-09 11:48:02 +02:00
Andreas Kling
22a26babc5 LibWeb: Take UTF-16 names in get_property_value
Change get_property_value() to take a Utf16FlyString so generated CSS
property accessors can pass their JS property names through without
constructing FlyString instances first.

Keep the existing internal descriptor and custom-property storage shape
for now, and convert at those boundaries while the remaining CSS
property APIs are migrated separately.
2026-06-09 11:48:02 +02:00
Tim Ledbetter
a8d729ff9c Fuzzers: Bail from ASN1 fuzzer on malformed input
Previously, the return value of `drop()` wasn't being checked, so
malformed input could cause `drop()` to fail and reading of further
bytes to stall, leading to an infinite loop.
2026-06-09 08:02:44 +01:00
Tim Ledbetter
a241c31d61 Fuzzers: Avoid crash on empty input in MatroskaReader fuzzer 2026-06-09 16:46:32 +12:00
Shannon Booth
20bfc49083 LibURL: Preserve trailing dots in public suffix matching
PublicSuffixData handled trailing-dot hosts incorrectly when a PSL rule
matched, causing returned public suffix and registrable-domain results
to drop the trailing dot.

Make PublicSuffixData skip leading dots for matching, ignore a single
trailing dot while running the PSL algorithm, and append that trailing
dot back to returned results.
2026-06-08 20:19:06 +02:00
Shannon Booth
d21044de15 LibURL: Fix public suffix matching for canonical hosts
Public suffix matching could fail when callers passed host text that
was not already in the same form as the generated PSL table. In
particular, uppercase ASCII hosts like EXAMPLE.COM and UTF-8 IDN hosts
could miss matches even though URL hosts are canonically represented as
lowercase ASCII/IDNA.

Make the PublicSuffixData API difficult to misuse by routing all
invocations through URL::Host overloads so that the canonical hostname
is always what is matched against.
2026-06-08 20:19:06 +02:00
Shannon Booth
9b80ac00be LibURL: Move registrable-domain PSL lookup to PublicSuffixData
Move the registrable-domain helper from URL into PublicSuffixData and
name it find_matching_registrable_domain().

This keeps it alongside find_matching_public_suffix(), making it clear
that both APIs only return results matched from the PSL data, while
Host::public_suffix() implements the URL Standard fallback to the
top-level domain.
2026-06-08 20:19:06 +02:00
Shannon Booth
ac344a5196 LibURL: Clarify PSL matching API names
Rename PublicSuffixData's raw lookup helpers to make it clear that they
only return public suffixes matched from the PSL data.

This distinguishes them from Host::public_suffix(), which implements the
URL Standard definition and falls back to the top-level domain when no
PSL rule matches.

We need both layers because address bar handling needs the raw lookup to
decide whether input should be treated as a URL or as a search.
2026-06-08 20:19:06 +02:00
Shannon Booth
2dc3e3da55 Meta: Remove obsolete Lagom host-tools build 2026-06-08 01:11:40 +02:00
Shannon Booth
4a681c9148 Libraries: Remove LibIDL
Move the overload-resolution metadata types into LibWeb::WebIDL and
update the Python generator and overload resolver to use them.

LibIDL no longer has any users after the C++ bindings generator removal,
so remove the library and unlink it from LibWeb.
2026-06-08 01:11:40 +02:00
Shannon Booth
efe144552c Meta: Remove obsolete LibWeb BindingsGenerator
Remove the old C++ LibWeb bindings generator now that the build uses
the Python generator.
2026-06-08 01:11:40 +02:00
Shannon Booth
dba62aefc0 LibWeb/Bindings: Port IDL bindings generator to Python
Replace the Lagom C++ bindings generator invocation with the new Python
generator under Meta/Generators/libweb_bindings.

Fold the exposed-interface generation into the same generator entry
point, and keep generated overload metadata using the existing LibIDL
types for now.
2026-06-08 01:11:40 +02:00
Tim Ledbetter
2a5f239d11 LibURL: Reverse host labels before searching the public suffix table
The generated public suffix table stores each entry with it's labels
reversed, but the lookup we were using didn't reverse its input before
searching. This led to multi-label public suffixes not matching when
they should have.
2026-06-07 14:00:48 +02:00
sideshowbarker
270024aaad Meta: Retry the vcpkg bootstrap to ride out transient download failures
Problem: CI jobs were very often failing at the install-vcpkg step,
after the prebuilt-vcpkg-tool download fails with an HTTP 504.

Cause: The bootstrap-vcpkg.sh script’s curl call retries span only a few
seconds — too soon to get past an outage — and the build_vcpkg.py script
runs with no retry at all. So one transient 504 hard-fails everything.

Fix: Do the bootstrap in build_vcpkg.py with retries and some backoff —
so one transient download failure no longer breaks the entire build.
2026-06-07 11:34:17 +02:00
sideshowbarker
e97de4fc84 Meta: Retry required-file downloads and cache the WASM spec tests
Problem: CI intermittently fails when a required-file download hiccups;
e.g., the WASM spec test suite fetch failed on both its primary URL and
the Web Archive fallback on the same run — breaking configure under CI.

Cause: download_file_multisource was trying each source only once — so a
single transient HTTP error could break the whole build. The WASM spec
test tarball was also being fetched fresh every run — rather than from
the shared download cache — so each build was exposed to that flakiness.

Fix: Retry each fetch a few times across all sources — for every config-
time download: the WASM spec tests, HSTS preload list, and public-suffix
list. Cache the WASM spec test tarball across CI runs — keyed by commit,
so it’s (re)fetched only once per commit bump.
2026-06-07 11:33:29 +02:00
Zaggy1024
28f670f09f LibMedia: Implement audio time stretching with WSOLA
The algorithm is ported over from Chromium's, which produces very good
results for speech, while being not objectionable for music, especially
in the background.

Other algorithms were tested.

Phase vocoders:
- Bungee
- Signalsmith Stretch
- pvdoneright
All three of these exhibited the usual phase shifting artifacts,
causing speech to sound slightly shifted into the high end. Speech is
the main thing we want to optimize for, so these aren't ideal.

Sonic (TD-PSOLA) performs better than WSOLA for speech, especially at
rates higher than 2x, but makes background sounds/music garbled and
unpleasant. It is still worth considering for speech clarity, and could
be added as an optional feature.
2026-06-06 19:58:17 -05:00
Shannon Booth
2e09af3116 Meta: Parse WebIDL declarations into structured objects
Teach the python WebIDL parser to retain typed declarations instead of
keeping or skipping raw text.
2026-06-06 19:16:52 +02:00
Shannon Booth
b09d8966a5 Meta: Handle escaping more cpp types
Handle all which are needed for IDL code generation.
2026-06-06 19:16:52 +02:00
Shannon Booth
d4f8879e8b Meta: Ignore wpt-import folder from python, shell and executable linting
As these are third party.
2026-06-06 13:48:43 +02:00
Shannon Booth
ecded38b55 LibWeb/Bindings: Don't include constants in default toJSON conversion
We should only be including regular attributes.
2026-06-06 13:41:55 +02:00
Tim Ledbetter
e02131c40f Meta: Remove fuzzers that primarily exercise third-party libraries
These fuzzers fed untrusted input almost entirely into bundled
libraries with negligible native glue, duplicating coverage those
projects already get from their own fuzzing infrastructure.
2026-06-06 11:39:51 +01:00
Andreas Kling
dfb2656d9c Utilities: Replace LibLine with libedit
Use libedit's readline-compatible interface for the JavaScript REPL so
line editing, history, and tab completion no longer depend on LibLine.
The REPL keeps its existing multiline input and completion behavior,
but no longer provides LibLine's live syntax highlighting.

Remove the unused LibLine dependency from the wasm utility and delete
the LibLine library from the build now that it has no remaining
consumers.
2026-06-05 00:09:37 +02:00
Andreas Kling
164ed80244 Meta: Enable exit-time destructor warnings for libraries
Enable -Wexit-time-destructors for all in-tree library targets and
update process-lifetime library statics so they no longer register
exit-time destructors. Long-lived caches, lookup tables, singleton
registries, and generated constants now use NeverDestroyed or leaked
references where the data is intended to live until process exit.

Update LibWeb, LibLine, and the binding generators so regenerated
sources follow the same rule instead of reintroducing destructed
statics.
2026-06-04 19:20:49 +02:00
sideshowbarker
ad6f646d6d Meta: Rebuild Rust crates when the toolchain changes, not just sources
Problem: After a git pull of master, builds fail with an error message
about multiple/duplicate rust_eh_personality definitions/symbols.

Cause: LibWeb links two Rust staticlibs: libweb_content_blocker_rust and
libweb_rust. Both bundle Rust’s standard library (std). When we re-pin
rust-toolchain.toml, a git pull moves a rustup user’s compiler — but we
were only rebuilding the crate whose .rs also changed. So that left one
crate on the old std, and the other crate on the new std.

Fix: Make the cargo custom commands also depend on rust-toolchain.toml
and rustc — so a toolchain change re-triggers every Rust crate.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/9854
Fixes https://github.com/LadybirdBrowser/ladybird/issues/9643
2026-06-04 07:41:45 -04:00
Timothy Flynn
c5bb98bcf0 Meta: Revert to a stable rust compiler
Let's not depend on a nightly pre-release, especially not just for a
linting option. We can enable the linter option once it lands in the
stable release.
2026-06-02 20:12:41 +02:00
Aliaksandr Kalenik
0e6528f9da Meta+LibWeb: Generate accumulated visual context property metadata
Style invalidation kept the list of properties that require rebuilding
the accumulated visual context tree in StyleInvalidation.cpp. That made
the classification separate from the existing property metadata used for
layout and stacking-context invalidation.

Move that classification into Properties.json and teach the PropertyID
generator to emit property_affects_accumulated_visual_contexts(). Style
invalidation now uses the generated predicate, preserving the existing
property set and behavior while making future classification changes
data-driven.
2026-06-02 18:55:25 +01:00
Sam Atkins
693517daa0 LibWeb: Resolve container-relative length units
Add cqw/cqh/cqi/cqb/cqmin/cqmax to the unit tables and generated
helpers, then thread them through the shared length resolution path.

Length::ResolutionContext now carries the subject element and whether
its inline axis is horizontal. Container units need that extra context:
the nearest eligible query container is selected from the subject
element's flat-tree ancestors, and cqi/cqb/cqmin/cqmax map logical axes
through the subject's writing mode before resolving to a physical width
or height.

Teach Length to resolve each axis against the selected container's
content box, fall back to viewport lengths when no eligible container
exists, and mark size-container dependencies so post-layout
recomputation can happen when layout is not up to date.

Also expose the new units through Typed OM, reject them for
computationally independent `@property` initial values, and add focused
font-size coverage.
2026-06-01 08:27:17 +01:00
Andreas Kling
6f616ae9a9 LibGfx: Remove TinyVG image decoding
Remove the TinyVG decoder now that the Qt chrome no longer depends on
TVG resources. Drop the decoder registration, MIME and supported image
type entries, fuzzer target, decoder tests, and TinyVG test inputs.
2026-05-31 19:20:59 +02:00
Shannon Booth
5d9cbee20b LibWeb/Bindings: Follow WebIDL buffer source conversion steps
Handle ArrayBuffer, SharedArrayBuffer, DataView, and typed array
conversions according to the WebIDL buffer source algorithms.

This rejects shared backing buffers unless [AllowShared] is present,
rejects resizable/growable backing buffers unless [AllowResizable] is
present.
2026-05-31 12:05:19 +02:00
Shannon Booth
c942084a16 LibWeb/Bindings: Remove unneeded Location special case
This should be handled by the platform object path.
2026-05-30 11:22:08 +02:00
Shannon Booth
97abc707c7 LibWeb/Bindings: Generate buffer typedefs as variants
Represent BufferSource and ArrayBufferView as ordinary IDL typedefs over
their underlying union types, instead of special casing in the IDL
generator. This allows the union conversion/return machinery handle
these types consistently with other typedefs, which removes buffer
specific paths from the IDL generator.

This necessitates changing the WebIDL::BufferSource and
WebIDL::ArrayBufferView classes as views over these variants. This
replaces the old GC backed BufferableObject wrapper structure and
provide convenience helpers to determine things such as the byte length,
byte offset, backing buffer, and typed-array APIs.
2026-05-30 11:22:08 +02:00
Luke Wilde
d4d9fc12f7 Meta: Generate HSTS preload data from Chromium's static list
Download transport_security_state_static.json on configure and
emit a sorted flat array of (name, include_subdomains) pairs.
The generator keeps only force-https entries, drops IP literals,
and validates names against [a-z0-9.-] so the emitted C++ string
literals need no escaping.

Matches Firefox's HSTS preload source:
https://searchfox.org/firefox-main/rev/ca47ec6bb1f3e46a384cd1ebb11c5996cceef90f/taskcluster/docker/periodic-updates/scripts/getHSTSPreloadList.js
2026-05-29 22:23:33 +02:00
Luke Wilde
85fd3bb7b0 LibGC: Introduce ConservativeHashTable 2026-05-28 21:16:23 +02:00
Sam Atkins
d3ad37e635 Meta: Define helper processes for Ladybird and test-web in one place
These both require the same helper processes, and maintaining the same
list in multiple places is error-prone. For example, I spent too long
debugging why test-web was crashing, when the issue was that Compositor
hadn't been rebuilt as test-web didn't depend on it. That problem can
no longer happen if we define the same dependency list for both.
2026-05-28 14:45:48 +01:00
Suraj Yadav
ec2b96f4bf Meta: Restore serenity_gdb.py
Restore serenity_gdb.py => Meta/gdb/PrettyPrinters/ak.py.
Remove VirtualAddress and AKFixedStringBuffer.
Fix Hashmap, IntrusiveList, Optional and Vector printers.
2026-05-28 14:33:25 +01:00
Suraj Yadav
a5b925fdec Meta: Add lldb pretty printers for AK types
fix string printer

Use lldb command to import printer

fix order and use nonsynthetic value

fix optional
2026-05-28 11:55:24 +01:00
Vanand Gasparyan
f3a3488cda Rust: Set import granularity to Item
By default, `rustfmt` persists the import granularity. In practice, most
Rust code has import granularity "Module" due to LSP's actions.

"Item" gets rid of import groupings and achieves cleaner diffs and
better conflict resolution. Better greppability is a positive side
effect.

Note: it's an unstable rustfmt feature. `cargo +nightly fmt` must be
used instead of `cargo fmt`.
2026-05-28 06:52:18 +02:00
Sam Atkins
ae2e01b77c Meta: Mark generated CSS enum to_string() methods as WEB_API
A couple of these are going to be needed by DevTools, running in the
WebContent process. It links to LibWeb, but couldn't link to these
previously.
2026-05-27 17:47:50 +01:00
Shannon Booth
59434095e6 LibWeb/Bindings: Avoid releasing nullable strings when wrapping
Generated wrapping code only needs to read the contained string value
when creating a JS::PrimitiveString. Use value() instead of
release_value() so nullable or optional string wrappers are not consumed
during wrapping, and remove the now-unneeded const_cast workaround.
2026-05-26 21:43:57 +02:00
Shannon Booth
9e68b5c3d8 LibWeb/Bindings: Use IteratorStepValue for sequence conversion 2026-05-26 21:43:57 +02:00
Shannon Booth
df6c3fcfaa LibWeb/Bindings: Remove GenerateAsRequired handling from IDL generator
This was used before we generated dictionary definitions using the IDL
generator, and no longer serves the purpose it used to.
2026-05-26 21:43:57 +02:00