Commit graph

68626 commits

Author SHA1 Message Date
Andreas Kling
5308d77600 LibRegex: Don't use Optional<T> inside regex::Match
This prevented Match from being trivially copyable, which we want it to
be for fast Vector copying.
2025-04-14 17:40:13 +02:00
Andreas Kling
54edf29f1b LibRegex: Make Match::capture_group_name an index into the string table
This removes another Match member that required destruction. The "API"
for accessing the strings is definitely a bit awkward. We'll think of
something nicer eventually.
2025-04-14 17:40:13 +02:00
Andreas Kling
9d47cc54f8 LibRegex: Remove unused regex::Match::string and unused constructor
This shrinks regex::Match by 8 bytes and removes a member that needs
destruction.
2025-04-14 17:40:13 +02:00
Jelle Raaijmakers
8eb16633fe CI: Fix SHA-256 signature in webhook callback for js-benchmarks workflow 2025-04-14 17:09:41 +02:00
Aliaksandr Kalenik
3e1d718b7f LibWeb: Ignore boxes without layout node in intersection observer steps
Check if box has associated layout node is not mentioned in the spec,
but it is required to match behavior of other browsers that do not
invoke intersection observer steps for boxes without layout node.
2025-04-14 17:01:53 +02:00
Aliaksandr Kalenik
ea8a6b43f7 LibWeb: Reserve zero for not supported transfer type
Previously we were using 0 for both unsupported type and MessagePort,
which led to crashing on attempt to decode unsupported transfer type as
MessagePort.

Fixes crashing on
https://docs.mapbox.com/mapbox-gl-js/clip-layer-building-demo.html
2025-04-14 17:01:41 +02:00
Jelle Raaijmakers
e18e7d6019 CI: Simplify workflow name for js-benchmarks.yml
No need to state 'Run the' part.
2025-04-14 14:15:49 +02:00
Jelle Raaijmakers
e6f674fb7f CI: Run benchmarks on macOS as well
This introduces a matrix for the js-benchmarks workflow and runs both
the Linux x86_64 and macOS arm64 JS repl builds against our benchmarks
repository.
2025-04-14 14:15:49 +02:00
Jelle Raaijmakers
4600f9a5b0 CI: Call benchmarks webhook with curl instead of a dedicated action
The workflow-webhook action that was being used didn't work on macOS or
machines without Docker, so let's create the payload ourselves, sign it
and send it over using plain old `curl`.
2025-04-14 14:15:49 +02:00
Jelle Raaijmakers
458c96727c CI: Install pkg-config in setup
We have this package listed in our build instructions but did not
install it for CI, causing some errors on new/clean runners.
2025-04-14 14:15:49 +02:00
Jelle Raaijmakers
4014930278 CI: Select XCode 16.3 for macOS builds
This is the version running on our self-hosted Mac runner.
2025-04-14 14:15:49 +02:00
Timothy Flynn
3c6010c663 LibWeb: Implement ReadableStreamPipeTo reads with less observability
The spec states:

    Public API must not be used: while reading or writing, or performing
    any of the operations below, the JavaScript-modifiable reader,
    writer, and stream APIs (i.e. methods on the appropriate prototypes)
    must not be used. Instead, the streams must be manipulated directly.

This migrates the default request request we were using to a custom read
request which does not involve extra promises.

I'm not sure about an analogous change with the way we write chunks to
the receiving end. There isn't a "WriteRequest" utility to be used here,
and no matter what AO we use, promises will be involved. Our current
implementation at least does not seem to affect any tests.
2025-04-14 07:38:11 -04:00
Timothy Flynn
99550dc4ad LibWeb: Import ReadableStreamPipeTo observability tests 2025-04-14 07:38:11 -04:00
Sam Atkins
6ff2324f26 LibWeb/DOM: Actually stub out pointer-capture API
For real this time.

This makes panning the KendoReact map widget actually work:
https://www.telerik.com/kendo-react-ui/components/map
2025-04-14 12:55:44 +02:00
sideshowbarker
cfc1fd7305 LibWeb: Handle “default step”/“step scale factor” for more input types
This change adds “default step” and “step scale factor” handling for all
remaining HTMLInputElement input types for which the spec defines such
and that we didn’t yet have handling for.
2025-04-14 09:43:16 +01:00
Simon Farre
55483b0096 LibWeb: Set user activation when this is Document
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
EventTarget::dispatch_event, per comments, does ad-hoc solution for UA,
and I don't know why it checks if `this` is window or `element`, but
web platform tests would fail, because `this` would actually be a
`Document` type.
2025-04-13 10:36:31 -06:00
Simon Farre
87f6a11e47 LibWeb: Add user activation for pointerdown/up
Fixed FIXME's for pointerdown and pointerup events.
2025-04-13 10:36:31 -06:00
stasoid
a821fc03be Headless: Compile on Windows 2025-04-13 10:19:23 -06:00
stasoid
2ac53794c3 LibCore: Implement System::isatty on Windows
Also fixes a bug introduced in 642b7b6a5e: Core::System functions
expect a handle now, so we have to use _get_osfhandle in STD*_FILENO.
2025-04-13 10:19:23 -06:00
0GreenClover0
c286d38765 Meta: Update vcpkg to latest master
Some checks failed
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Build Dev Container Image / build (push) Has been cancelled
Includes a fix for vcpkg git commands not working in git versions
below 2.35.
2025-04-12 19:14:58 -06:00
Andreas Kling
e068ff5a5d LibWeb: Always store ComputedProperties, even if no invalidations
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Before this change, we'd skip storing the new ComputedProperties in
Element::recompute_style() if there was no invalidation needed.

This caused us to lose the information about which properties are
inherited and/or important (which is also carried by ComputedProperties,
but doesn't affect invalidation).

Consequently, we'd then fail to recompute inherited styles, since that
mechanism depends on this data.

The fix is simply to always store the new ComputedProperties.
2025-04-13 00:43:49 +02:00
Luke Wilde
9ba76ea25a Meta: Use presets, chosen clang and explicit sysroot to build fuzzers
This near enough matches what CI does to build fuzzers, with the
differences being the explicit -GNinja and setting CMAKE_OSX_SYSROOT,
as CMake 4 no longer does that for us.
2025-04-12 16:13:15 -06:00
Andreas Kling
2aa6d7636c LibWeb: Invalidate sheet owners after mutating cssText of its rules
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This fixes one source of flakiness on WPT (of many) where we wouldn't
recompute style after programmatically altering the contents of a style
sheet, but instead had to wait for something else to cause invalidation.
2025-04-12 14:15:57 +01:00
Andreas Kling
6db20a9453 LibJS: Simplify ECMAScriptFunctionObject.[[Realm]] slot handling
Our engine already keeps track of the home realm for all objects.
This is stored in Shape::realm(). We can use that instead of having
a dedicated member in ESFO for the same pointer.

Since there's always a home realm these days, we can also remove some
outdated fallback code from the days when having a realm was not
guaranteed due to LibWeb shenanigans.
2025-04-12 11:07:48 +02:00
Andreas Kling
e4941a36b0 LibJS: Remove unused struct NativeStackFrame 2025-04-12 11:07:48 +02:00
Andreas Kling
d78e3590d5 LibJS: Don't convert to UTF-8 in order to compare two UTF-16 strings
If we have two PrimitiveString objects that are both backed by UTF-16
data, we don't have to convert them to UTF-8 for equality checking.
Just compare the underlying UTF-16 data. :^)
2025-04-12 11:07:48 +02:00
Andreas Kling
e80d1c1a86 LibJS: Add fast_is<T> for JS::Array (array exotic objects)
Nukes a 0.3% profile item on Speedometer 2.1.
2025-04-12 11:07:48 +02:00
Aliaksandr Kalenik
6507d23e29 LibWeb: Save ScrollState snapshot in DisplayList to avoid race condition
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
With this change we save a copy of of scroll state at the time of
recording a display list, instead of actual ScrollState pointer that
could be modifed by the main thread while display list is beings
rasterized on the rendering thread, which leads to a frame painted with
inconsistent scroll state.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/4288
2025-04-12 02:55:18 +02:00
Sam Atkins
d855adf767 LibWeb: Add slider- prefix to slider pseudo-element names
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Corresponds to 9549bb8951
2025-04-11 21:27:47 +01:00
Sam Atkins
11b6bd8138 LibWeb/DOM: Stub out Element pointerevents methods 2025-04-11 21:27:13 +01:00
mikiubo
8ec72d6906 LibUnicode: Avoid rejecting end-of-text position as a valid boundary
When the cursor was positioned at the end of text,
attempting to move it left(using the left arrow key)
would fail because align_boundary() was rejecting
the end-of-text position as a valid boundary.
2025-04-11 15:30:17 -04:00
Timothy Flynn
0b23717bc9 LibWeb/WebDriver: Use WebIDL promise AOs to execute async scripts
This removes the use of `spin_event_loop_until` when waiting for async
script results.
2025-04-11 14:35:37 -04:00
Timothy Flynn
8b7bbc81e3 LibWeb/WebDriver: Execute script bodies in a promise-calling manner
This is a bit of a peculiarity with the synchronous script executor. We
must wrap the script result in a promise.
2025-04-11 14:35:37 -04:00
Timothy Flynn
7539d808cd LibWeb/WebDriver: Add a FIXME about allowing await in script bodies
There will soon only be a couple of remaining script execution WPT
promise.py failures. This comment is to explain why.
2025-04-11 14:35:37 -04:00
Timothy Flynn
eb0a51faf0 LibWeb: Implement ReadableStreamPipeTo according to spec
Our existing implementation of stream piping was extremely ad-hoc. It
did nothing to handle closed/errored streams, and did not read from or
write to streams in a way required by the spec.

This new implementation uses a custom JS::Cell to drive the read/write
loop.
2025-04-11 12:10:46 -04:00
Timothy Flynn
4010c4643a LibWeb: Support removing callbacks from AbortSignal
This will be needed by Streams. To support this, we now store callbacks
in a hash table, keyed by an ID. Callers may use that ID to remove the
callback at a later point.
2025-04-11 12:10:46 -04:00
Timothy Flynn
f268f24dd5 LibWeb: Explicitly rethrow exceptions from writable stream start
This is an editorial change in the Streams spec. See:
https://github.com/whatwg/streams/commit/95a5adf
2025-04-11 12:10:46 -04:00
Timothy Flynn
e9a7694cdb LibWeb: Prefer react_to_promise over upon_fulfillment + upon_rejection
While debugging a spec-compliant implementation of ReadableStreamPipeTo,
I spent a lot of time inspecting promise internals. This is much less
noisy if we halve the number of temporary promises.
2025-04-11 12:10:46 -04:00
Timothy Flynn
3033929bb6 LibWeb: Pass abort signal as its concrete type to ReadableStreamPipeTo
There's no real need to wrap it in a JS::Value just to unrwap it again.
2025-04-11 12:10:46 -04:00
Timothy Flynn
ab43c3be23 LibWeb: Store WritableStream's strategy high water mark as a double
It is received from user JS as a double and is only used as a double in
all subsequent calculations. This bug would cause UBSAN errors in an
upcoming imported WPT test, which passes Infinity as the HWM.

Note there is an equivalent HWM for ReadableStream, which already stores
the value as a double.
2025-04-11 12:10:46 -04:00
Timothy Flynn
1d6e1637cc LibWeb: Implement an AO to close writable streams with error propagation 2025-04-11 12:10:46 -04:00
Timothy Flynn
f7c095a318 LibWeb: Implement an AO to get a promise to wait for promises to settle 2025-04-11 12:10:46 -04:00
Timothy Flynn
cceb4321fc LibGC: Allow visiting vectors with inline capacity
This allows visiting e.g. Vector<Value, 1>.
2025-04-11 12:10:46 -04:00
Aliaksandr Kalenik
87bffe7d22 Tests: Rearrange log order in Messaging-post-channel-over-channel.html
When a message is posted to multiple ports at once, the order in which
the callbacks for these messages are invoked is non-deterministic.
To account for this, the test has been rewritten to accumulate logs
for each port separately, and then print them grouped by port.
2025-04-11 17:13:06 +02:00
Tim Ledbetter
f07a3fe6da LibWeb: Use discrete interpolation for degenerate ratios
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Degenerate ratios cannot be interpolated.
2025-04-11 11:38:05 +01:00
Tim Ledbetter
b3980d40f7 LibWeb: Round to the nearest integer when interpolating integer values 2025-04-11 11:31:54 +01:00
Jelle Raaijmakers
8257788a20 LibWeb: Ignore negative margins for margin box rect
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Negative margins are processed through the `offset` in layout state, and
should not contribute to the margin box' rect's size or position.

Fixes #4249.
2025-04-11 02:34:28 +01:00
Jelle Raaijmakers
76105d6a02 LibWeb: Use LayoutState::set_content_x/y() where possible
No functional changes.
2025-04-11 02:34:28 +01:00
Jelle Raaijmakers
4a6998497f LibWeb: Don't recalculate margin box rect for preceding floats
We already stored that rect while building up the side data during
floating box layout. No functional changes.
2025-04-11 02:34:28 +01:00
stelar7
0a298dba27 LibWeb/IDB: Dont go back to inactive if we finished during upgrade 2025-04-10 19:12:30 -06:00