Commit Graph

72565 Commits

Author SHA1 Message Date
Lorenz A
f54793315c LibWeb: Adjust buttons computed display style
Some checks failed
CI / ${{ matrix.os_name }}, ${{ matrix.arch }}, ${{ matrix.build_preset }}, ${{ matrix.toolchain }} (arm64, Sanitizer, false, macOS, ["macos-15", "self-hosted"], Clang) (push) Has been cancelled
CI / ${{ matrix.os_name }}, ${{ matrix.arch }}, ${{ matrix.build_preset }}, ${{ matrix.toolchain }} (x86_64, All_Debug, false, Linux, ["blacksmith-16vcpu-ubuntu-2404"], Clang) (push) Has been cancelled
CI / ${{ matrix.os_name }}, ${{ matrix.arch }}, ${{ matrix.build_preset }}, ${{ matrix.toolchain }} (x86_64, Fuzzers, false, Linux, ["blacksmith-16vcpu-ubuntu-2404"], Clang) (push) Has been cancelled
CI / ${{ matrix.os_name }}, ${{ matrix.arch }}, ${{ matrix.build_preset }}, ${{ matrix.toolchain }} (x86_64, Sanitizer, false, Linux, ["blacksmith-16vcpu-ubuntu-2404"], GNU) (push) Has been cancelled
CI / ${{ matrix.os_name }}, ${{ matrix.arch }}, ${{ matrix.build_preset }}, ${{ matrix.toolchain }} (x86_64, Sanitizer, true, Linux, ["blacksmith-16vcpu-ubuntu-2404"], Clang) (push) Has been cancelled
Build Dev Container Image / build (push) Has been cancelled
Run test262 and test-wasm / run_and_update_results (push) Has been cancelled
Lint Code / lint (push) Has been cancelled
Label PRs with merge conflicts / auto-labeler (push) Has been cancelled
Push notes / build (push) Has been cancelled
Nightly Lagom / ${{ matrix.os_name }}, ${{ matrix.arch }}, ${{ matrix.build_preset }}, ${{ matrix.toolchain }} (arm64, Distribution, false, Linux, ["blacksmith-8vcpu-ubuntu-2404-arm"], Clang) (push) Has been cancelled
Nightly Lagom / ${{ matrix.os_name }}, ${{ matrix.arch }}, ${{ matrix.build_preset }}, ${{ matrix.toolchain }} (arm64, Distribution, false, macOS, ["macos-15"], Clang) (push) Has been cancelled
Nightly Lagom / ${{ matrix.os_name }}, ${{ matrix.arch }}, ${{ matrix.build_preset }}, ${{ matrix.toolchain }} (arm64, Sanitizer, false, Linux, ["blacksmith-8vcpu-ubuntu-2404-arm"], Clang) (push) Has been cancelled
Nightly Lagom / ${{ matrix.os_name }}, ${{ matrix.arch }}, ${{ matrix.build_preset }}, ${{ matrix.toolchain }} (arm64, Sanitizer, false, macOS, ["macos-15"], Swift) (push) Has been cancelled
Nightly Lagom / ${{ matrix.os_name }}, ${{ matrix.arch }}, ${{ matrix.build_preset }}, ${{ matrix.toolchain }} (x86_64, Distribution, false, Linux, ["blacksmith-8vcpu-ubuntu-2404"], GNU) (push) Has been cancelled
Nightly Lagom / ${{ matrix.os_name }}, ${{ matrix.arch }}, ${{ matrix.build_preset }}, ${{ matrix.toolchain }} (x86_64, Sanitizer, false, Linux, ["blacksmith-8vcpu-ubuntu-2404"], Swift) (push) Has been cancelled
Nightly Lagom / ${{ matrix.os_name }}, ${{ matrix.arch }}, ${{ matrix.build_preset }}, ${{ matrix.toolchain }} (x86_64, Windows_Sanitizer_CI, false, Windows, ["windows-2025"], ClangCL) (push) Has been cancelled
Nightly Lagom / Flatpak ${{ matrix.arch }} (aarch64, ["ubuntu-24.04-arm"]) (push) Has been cancelled
Nightly Lagom / Flatpak ${{ matrix.arch }} (x86_64, ["ubuntu-24.04"]) (push) Has been cancelled
Nightly Android / CI (macos-14, Android) (push) Has been cancelled
2025-11-01 13:02:44 +00:00
Andreas Kling
4bcb34d7a0 Revert "LibJS: Allocate callee execution contexts in call instruction handler"
This reverts commit cdcbbcf48b.

It made MicroBench/call-*-args.js faster, but some of the macro
benchmarks got significantly slower on macOS, so let's revert until we
understand it better.
2025-11-01 13:07:53 +01:00
ayeteadoe
f846b6f2d9 CMake: Remove unnecessary WebContent dependencies on Windows
In the initial work that got Ladybird running on Windows, there were
some DLLs that WebContent implicitly depended on which was causing
runtime errors when launching as they didn't exist in libexec.

So the workaround was to explicitly link the targets that had issues to
WebContent and use lagom_copy_runtime_dlls() to ensure they got copied
to libexec.

But given libexec is not a standard Windows convention, in a later
review we made sure Services got output to the bin folder, but those
initial workarounds were not removed even though they were now
unnecessary.
2025-11-01 07:58:12 -04:00
Andreas Kling
55636432e9 LibJS: Make ExecutionContext constructor ALWAYS_INLINE 2025-11-01 08:40:32 +01:00
Andreas Kling
8a02acbab6 LibJS: Make ExecutionContext::identifier_table a raw pointer
We were already skipping the bounds checks on this thing anyway,
so might as well shrink ExecutionContext by 8 bytes by doing this.
2025-11-01 08:40:32 +01:00
Andreas Kling
5b9469786e LibJS: Move ExecutionContext::cached_source_range to rare data 2025-11-01 08:40:32 +01:00
Andreas Kling
3ef55f8859 LibJS: Only assign initial "accumulator" value if actually provided 2025-11-01 08:40:32 +01:00
Andreas Kling
6f9d297c3c LibJS: Coerce empty completion to "undefined" early in Interpreter
Instead of always checking if we're about to return an empty completion
value in Interpreter::run_executable(), we now coerce empty completions
to the undefined value earlier instead.

This simplifies the most common path through run_executable(), giving us
a small speedup.
2025-11-01 08:40:32 +01:00
Andreas Kling
75d49c4b55 LibJS: Remove effectively unused value span from ExecutionContext
Instead of using this span, we can just use the getter that calculates
the base of the register/constant/local/argument array based on the
ExecutionContext's own address.
2025-11-01 08:40:32 +01:00
Andreas Kling
e1344afff3 LibJS: Move ExecutionContext::context_owner to rare data
This is only used by ExecutionContexts owned by an HTML::ESO.
2025-11-01 08:40:32 +01:00
Andreas Kling
d234e9ee71 LibGC: Add GC::Heap::the()
There's only ever one GC::Heap per process, so let's have a way to find
it even when you have no context.
2025-11-01 08:40:32 +01:00
Andreas Kling
8b1f2e4e24 LibJS: Remove unused ExecutionContext::local(size_t) 2025-11-01 08:40:32 +01:00
Andreas Kling
cd3ef805c4 LibJS: Avoid redundant bounds check in ExecutionContext::argument() 2025-11-01 08:40:32 +01:00
Andreas Kling
13e1881bf7 LibJS: Store length of Call instructions in a member variable
This means we don't have to do a bunch of math to find the next
instruction boundary, and gives us a small speedup.
2025-11-01 08:40:32 +01:00
Andreas Kling
1e0b56586b LibJS: Move ExecutionContext members with destructors to "rare data"
This makes ExecutionContext trivially destructible, which means less
work to do on function exit.
2025-11-01 08:40:32 +01:00
Andreas Kling
9ded35f98f LibJS: Make CachedSourceRange GC-allocated
This gets rid of a RefPtr in ExecutionContext, bringing us one step
closer to destructor-less ExecutionContext.
2025-11-01 08:40:32 +01:00
Timothy Flynn
583164e412 Meta: Upgrade prettier to version 3.6.2
This version is installed by default nowadays and has slight differences
from 3.3.3.
2025-10-31 19:55:50 -04:00
Timothy Flynn
019c529c07 Meta: Increase the line length enforced by prettier to 120
This matches our coding style recommendation in CodingStyle.md, and
matches our python formatting.
2025-10-31 19:55:50 -04:00
Timothy Flynn
b7ecdad685 CI: Use same versions of wabt on Linux and macOS 2025-10-31 18:10:45 -04:00
Luke Wilde
35c6d52d7d LibWeb/CSP: Update invalid sample assertion in violation reporting
Asserting that a sample is not provided if the resource is not Inline
is not quite valid, since Eval, TrustedTypesSink and TrustedTypesPolicy
also provide a sample.

Spec issue: https://github.com/w3c/webappsec-csp/issues/788
2025-10-31 09:08:36 +01:00
Andreas Kling
2492c07430 LibJS: Remove redundant VERIFYs in running_execution_context()
Vector::last() will already verify that the context stack is non-empty.
2025-10-31 08:56:02 +01:00
Andreas Kling
1796089f29 LibJS: Demote a VERIFY in run_executable() to ASSERT 2025-10-31 08:56:02 +01:00
Andreas Kling
62781f4818 LibJS: Use return_value register for "last completion" return values
This simplifies the epilogue in run_executable().
2025-10-31 08:56:02 +01:00
Andreas Kling
5706831328 LibJS: Make run_executable() return simple ThrowCompletionOr<Value>
We don't need to return two values; running an executable only ever
produces a throw completion, or a normal completion, i.e a Value.

This necessitated a few minor changes, such as adding a way to check
if a JS::Cell is a GeneratorResult.
2025-10-31 08:56:02 +01:00
Jelle Raaijmakers
2f7797f854 LibWeb: Implement WebGL2's getBufferSubData()
This allows copying data from a buffer to an ArrayBufferView's storage.
2025-10-30 16:20:33 -07:00
Jelle Raaijmakers
25d78f7c8e LibWeb: Implement WebGL2's readPixels with a byte offset argument
We pass it in as a `void*` since that's what this API expects when you
have bound the GL_PIXEL_PACK_BUFFER buffer.
2025-10-30 16:20:33 -07:00
Jelle Raaijmakers
7b5940d27d LibWeb: Store and return pixel (un)pack buffer bindings in WebGL2 2025-10-30 16:20:33 -07:00
ayeteadoe
30729feebb LibWeb: Prevent crash in content calculations for ListItemMarkerBox
In several content calculation methods in FormattingContext, we assumed
that if create_independent_formatting_context_if_needed() fails the
input Layout::Box is a BlockContainer; however, the web platform test
css/css-pseudo/parsing/marker-supported-properties-in-animation.html is
one scenario where the input is a Layout::ListItemMarkerBox instead and
there is no FormattingContext supported for it yet.
2025-10-30 18:21:24 +00:00
R-Goc
991ab62dd7 AK: Increase MonotonicTime precision on Windows
MonotonicTime was using 32 bit floats for operations on the values
converted from an i64 returned by the performance counter. This caused
to either precision losses or complete losses of the data for timing
even things as long as hundreds of miliseconds, which should never be a
problem with the resolution of the performance counter. This change
fixes that behavior.
2025-10-30 09:42:40 -06:00
Callum Law
c2ca712406 LibWeb: Properly simplify sum nodes containing negated sum nodes
This is ad-hoc, see https://github.com/w3c/csswg-drafts/issues/13020

Gains us 5 WPT tests
2025-10-30 12:18:24 +00:00
Sam Atkins
9c06d58b2e LibWeb/CSS: Implement and use ValueType::DashedIdent
Reduces the repeated code for parsing these, and makes them available to
the generic value parser.
2025-10-30 11:33:45 +00:00
Andreas Kling
6671cbef41 LibJS: Precompute the number of regs/constants/locals in Executable
Instead of doing it again on every call. Minor bump in call performance.
2025-10-30 08:54:45 +01:00
Andreas Kling
cdcbbcf48b LibJS: Allocate callee execution contexts in call instruction handler
By handling call instructions in an inline (C++) function, we were
breaking the alloca() optimization and adding stack overhead. We fix
this by using a macro instead. It looks awful but it works.

1.07x speedup on MicroBench/call-00-args.js
2025-10-30 08:54:45 +01:00
Andreas Kling
667354fd12 LibJS: Always assume module bindings access is in strict mode
Modules are always in strict mode anyway, no need to look at the
strictness flag here.
2025-10-30 08:54:45 +01:00
Zaggy1024
fae2888103 Tests: Add a test for WebGL framebuffers retaining data after present 2025-10-29 22:06:31 -07:00
Zaggy1024
7e20b21879 LibWeb: Bind the default frame/render buffers when resetting context
This fixes the masking and warping effects on pixijs.com.

Co-authored-by: Luke Wilde <luke@ladybird.org>
2025-10-29 22:06:31 -07:00
ayeteadoe
3708ac5599 Meta: Use non-aliased "ladybird" ninja target on Windows in ladybird.py
When attempting to use "Ladybird" as the target passed to ninja, we get
"ninja: error: unknown target 'Ladybird', did you mean 'ladybird'?".

Note that "ladybird" also works on Unix; however, given the alias was
carried over from ladybird.sh for convenience, we will keep it in place
for non-Windows builds.
2025-10-29 21:07:52 -06:00
ayeteadoe
5e529fc603 LibCore: Use WinSock2 closesocket() in PosixSocketHelper::close()
Our Core::System::is_socket() helper is not very robust, as it was
incorrectly marking m_fd as a non-socket fd. This meant we were trying
to call CLoseHandle() on a socket which fails. We can just call
closesocket() directly given we are in an explicit socket-only context.
2025-10-29 21:07:52 -06:00
ayeteadoe
7683f1285f AK: Expose helpers to invoke Windows runtime config directly in main()
When shutting down helper processes, PosixSocketHelper::close() in
SocketWindows when trying to close the socket fd with
WSANOTINITIALISED. This was due to us initiating WinSock2 during static
initialization and presumably also not terminating WinSock2 properly.

Similar to WinSock2 initiation, calling CRT during static
initialization is considered dangerous given the CRT DLL itself may not
yet be initialized.

Because of the above, we move to perform this Windows-specific
runtime setup/teardown calls into the main() functions.
2025-10-29 21:07:52 -06:00
ayeteadoe
643f0de422 RequestServer: Instruct curl to use Windows CA cert store
This is required for supporting HTTPS requests. Otherwise we fail with
CURLE_PEER_FAILED_VERIFICATION.
2025-10-29 21:07:52 -06:00
ayeteadoe
95f239a357 CMake: Add Windows executable helper function
The function currently has 2 purposes: (1) To copy dependent dlls for
executables to output binary directory. This ensures that these helper
processes can be ran after a build given not all DLLs from vcpkg libs
get implicitly copied to the bin folder. (2) Allow fully background
and/or GUI processes to use the Windows Subsystem. This prevents
unnecessarily launching a console for the process, as we either require
no user interaction or the user interaction is all handled in the GUI.
2025-10-29 21:07:52 -06:00
ayeteadoe
20f9510687 CMake: Output helper process binaries to bin instead of libexec
libexec is not a standard convention on Windows. Everything should go
into bin
2025-10-29 21:07:52 -06:00
ayeteadoe
6261c433a3 LibWebView: Implement stubbed out BrowserProcess methods on Windows 2025-10-29 21:07:52 -06:00
ayeteadoe
231336f137 LibWebView: Implement stubbed out Process methods on Windows 2025-10-29 21:07:52 -06:00
ayeteadoe
d299df24ac LibRequests: Create ReadStream abstraction for reading request data
Given the RequestServer created the request fd with socketpair() on
Windows and pipe2() on Unix, this abstraction avoids inlined ifdef soup
by hiding the details of how the AK::Stream and Core::Notifier are
created.
2025-10-29 17:47:02 -04:00
ayeteadoe
11ec7c9cea RequestServer: Create RequestPipe abstraction for request data transfer
The Win32 API equivalent to pipe2() is CreatePipe(), which creates read
and write anonymous pipe handles that we can set to non-blocking via
SetNamedPipeHandleState(); however, this initial approach caused issues
as our Windows infrastructure assumes socket-based handles/fds and that
we don't use Windows pipes at all, see Core::System::is_socket() in
SystemWindows.cpp. So we use socketpair() to keep our current
assumptions true.

Given that Windows uses socketpair() and Unix uses pipe2(), this
RequestPipe abstraction avoids ifdef soup by hiding the details about
how the read/write fds pair is created and how response data is written
to the client.
2025-10-29 17:47:02 -04:00
Andreas Kling
9dae1acc31 LibJS: Pass ExecutionContext to Interpreter::run_executable()
This avoids having to get it from the VM's context stack, since most
callers already have it on hand.
2025-10-29 21:20:10 +01:00
Andreas Kling
a7d13b107e LibJS: Move all per-frame state from Interpreter to ExecutionContext
This simplifies function entry/exit and lets us just walk away from the
used ExecutionContext instead of resetting a bunch of its state when
returning control to the caller.
2025-10-29 21:20:10 +01:00
Andreas Kling
59ce6c9b41 LibJS: Shrink two u64 fields in ExecutionContext to u32
To shrink ExecutionContext, these two fields are made 32-bit:

- skip_when_determining_incumbent_counter
- program_counter
2025-10-29 21:20:10 +01:00
Andreas Kling
4c7ffc0552 LibJS: Remove ExecutionContext::function_name field
Instead of having ExecutionContext track function names separately,
we give FunctionObject a virtual function that returns an appropriate
name string for use in call stacks.
2025-10-29 21:20:10 +01:00