Commit graph

4976 commits

Author SHA1 Message Date
Timothy Flynn
7f3cb3efb6 Meta: Move Meta/Lagom/get_linked_lagom_libraries.cmake to Meta/CMake 2026-06-13 10:30:02 -04:00
Timothy Flynn
b9ae2e472e Meta: Hoist the Fuzzers directory up one level 2026-06-13 10:30:02 -04:00
Timothy Flynn
8c800d86c5 Meta: Hoist the ClangPlugins directory up one level 2026-06-13 10:30:02 -04:00
Aliaksandr Kalenik
5b856595b3 Meta+LibWeb/WebGL: Route all GL calls through generated GLFunctions
LibWeb's WebGL implementation currently reaches ANGLE by calling glFoo()
throughout the WebGL context and extension code. That ties the WebGL
spec layer to the concrete GL executor. A future backend that records
operations, sends them to another process, or executes them from the
Compositor would otherwise need to duplicate the WebGL logic or edit
every call site again.

Introduce GLFunctions as an explicit boundary between WebGL semantics
and GL execution. GLFunctions.json lists the GL entry points used by the
implementation, and the generator emits one forwarding method per entry
point. OpenGLContext implements those methods today, so the current
in-process ANGLE path keeps the same behavior while all callers go
through a single replaceable interface.

That boundary is needed before canvas/WebGL rendering can move to the
Compositor: the WebGL context code can keep doing validation, state
tracking, and spec-visible error handling in LibWeb, while a later
implementation can record the same GL calls and replay them where the
canvas surface is produced. The JSON source also gives the recorder and
replayer one shared description of argument shapes, avoiding two
hand-written views of the GL API drifting apart.
2026-06-13 01:58:43 +02:00
Tim Ledbetter
3cddcc8461 LibGfx+LibWeb: Remove TIFF image decoding
This is no longer widely supported by other engines.
2026-06-12 22:37:49 +02:00
Andreas Kling
0607a181a8 UI/Qt: Present Linux DMABUF frames with QVulkanWindow
Use a native QVulkanWindow child for Linux DMABUF presentation instead
of making WebContentView itself a QRhiWidget. This keeps BrowserWindow
on Qt's normal QWidget backing store path while sampling compositor
DMABUF backing stores directly in Vulkan.

Keep WebContentView's paintEvent as fallback for builds without Vulkan
DMABUF support and for cases where the Vulkan instance or window cannot
be created. Set an explicit Vulkan API version before creating the
shared QVulkanInstance so validation layers do not reject Qt defaults.
2026-06-12 21:45:22 +02:00
Shannon Booth
6ea6ba3866 LibWeb/Bindings: Don't install inherited members on global objects
When generating global mixins, only define regular members from the
[Global] interface itself on the global object. Inherited members remain
available through the prototype chain.

This was found due to a timeout on:

https://wpt.live/html/dom/idlharness.any.worker.html

Installing inherited members created fresh own functions on worker
globals, so self.importScripts differed from
WorkerGlobalScope.prototype.importScripts. That confused idlharness into
taking its null-this check path for importScripts, which then attempted
to import "null" and timed out.
2026-06-11 21:35:56 +02:00
Shannon Booth
cc871620e6 LibWeb/Bindings: Preserve object EventHandler assignments
EventHandler attributes are nullable callback function attributes with
[LegacyTreatNonObjectAsNull]. Assigning a non-object value should
produce null, but assigning an object value should preserve that object
as the callback value, even when the object is not callable.

Previously, object values such as `{ handleEvent() {} }` could pass the
nullable conversion and then be converted to null by the inner callback
function conversion. This made MessagePort.onmessage in the fixed test
return null after such an assignment.

Handle the non-object-to-null rule in nullable conversion, and let the
legacy callback conversion wrap object values without rejecting them for
not being callable.

Fixes a regression in the python port of the IDL generator.
2026-06-11 21:33:58 +02:00
Tim Ledbetter
3424c08b27 LibImageDecoders: Decode GIFs using wuffs
Replace the homegrown GIF parser and LZW decompressor with the wuffs
GIF decoder, which is memory-safe by construction and already used in
other engines via Skia.

One behavior change is that `loop_count()` now reports the correct
value, since the raw value stored in the file does not include the
first frane and should be incremented by 1 to be compatible with what
callers expect.
2026-06-10 20:29:11 +02:00
Tim Ledbetter
0fc92a5929 Meta: Add vcpkg overlay port for wuffs 0.3.4
This will be used for GIF decoding.
2026-06-10 20:29:11 +02:00
Ali Mohammad Pur
38f8f747ee Meta+Tests: Fix test generation for extern refs and module definition 2026-06-10 14:10:57 +02:00
Andreas Kling
37e7526367 LibGfx: Split image decoders into a separate library
Move the image loader sources and decoder-only dependencies from LibGfx
into a new LibImageDecoders library. This keeps the APNG-enabled PNG
loader out of processes that only need core graphics and image writers.

Link the ImageDecoder service, direct decoder tests, fuzzers, test-web,
and the image utility against LibImageDecoders where they still decode
images in-process.
2026-06-10 11:55:48 +02:00
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