1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00
Commit graph

4064 commits

Author SHA1 Message Date
Timothy Flynn
ac1c2a956a LibWeb: Implement caching of reflected element array attributes
For attributes like Element.ariaControlsElements, which are a reflection
of FrozenArray<Element>, we must return the same JS::Array object every
time the attribute is invoked - until its contents have changed. This
patch implements caching of the reflected array in accordance with the
spec.
2025-04-26 17:29:38 -04:00
Timothy Flynn
6f894ccd77 Meta: Remove -Wno-overloaded-virtual from clang compilation
This silenced warning was added a long time ago when we were first
bringing up Lagom: a619943001

The commit message indicates we were seeing errors due to this warning
in many places. We now compile just fine with this warning enabled, so
let's remove its silencer to be a little more consistent between clang
and GCC.
2025-04-26 09:04:45 -06:00
Timothy Flynn
62167d923c LibWeb: Convert ARIA attributes to FrozenArray 2025-04-25 16:43:43 +02:00
Timothy Flynn
98f73a6b31 LibWeb: Implement FrozenArray IDL attributes
A FrozenArray is simply a sequence whose integrity level is "frozen".
2025-04-25 16:43:43 +02:00
Shannon Booth
041ff0c7ff LibWeb/HTML: Hook up a WorkerAgent for web workers 2025-04-25 14:07:51 +02:00
Shannon Booth
8263a9863f LibJS+LibWeb: Do not return error from VM::create
This never returns an error to propogate, also allowing ErrorOr
to be removed from creating the main thread VM.
2025-04-25 14:07:51 +02:00
Shannon Booth
084cceab5c LibWeb: Split out SimilarOriginWindowAgent from HTML::Agent
To allow for adding the concept of a WorkerAgent to be reused
between shared and dedicated workers. An event loop is the
commonality between the different agent types, though, there
are some differences between those event loops which we customize
on the construction of the HTML::EventLoop.
2025-04-25 14:07:51 +02:00
Timothy Flynn
13ac6c4fde LibWeb: Implement ariaActiveDescendantElement spiritually closer to spec
We are meant to store a weak reference to the element indicated by this
attribute, rather than a GC-protected strong reference. This also hoists
the "get the attr-associated element" AO into its own function, rather
than being hidden in IDL, to match "get the attr-associated elements".
2025-04-25 01:20:12 +01:00
Timothy Flynn
f985ac8884 LibWeb: Implement element-referencing ARIA attributes
There are ARIA attributes, e.g. ariaControlsElements, which refer to a
list of elements by their ID. For example:

    <div aria-controls="item1 item2">

The div.ariaControlsElements attribute would be a list of elements whose
ID matches the values in the aria-controls attribute.
2025-04-25 01:20:12 +01:00
Andrew Kaster
7b0c2da14f LibWeb: Account for LegacyNamespace attribute in constructor generator
When playing games with cross-realm construction, we need to make sure
that any calls to ensure_web_prototype for LegacyNamespace objects use
the correctly namespaced prototype name.
2025-04-23 14:09:09 +02:00
Andrew Kaster
e1369aa7d6 CMake: Explicitly set CMAKE_OSX_SYSROOT to macosx for macOS host builds
The implicit default CMAKE_OSX_SYSROOT was a workaround in CMake for
macOS ~10.8. As of CMake 4.x, CMake expects macOS host compilers to have
their own default sysroot detection logic. However, upstream llvm does
not actually do this, only Apple Clang does. To keep supporting homebrew
clang and manually compiled clang from llvm/llvm-project, we need to
set the sysroot explicitly.

The behavior difference and lack of default detection logic in the clang
driver is tracked at https://gitlab.kitware.com/cmake/cmake/-/issues/26863
2025-04-22 17:31:12 -04:00
Ali Mohammad Pur
f341bb0522 IDLGenerators: Cast wrapped references to a known reference type
They may be GC::Ref<T> objects, which should be converted to T const&
before being so nicely const-cast to T&.
2025-04-22 08:43:46 -06:00
Ali Mohammad Pur
3a6b6a732e IDLGenerators: Unbreak sequence<dictionary> codegen
This was completely busted (where it would generate a variable inside a
block, and try to access it outside the block); this commit fixes this
in the least annoying way possible.
2025-04-22 08:43:46 -06:00
Ali Mohammad Pur
51bab5b186 LibWasm: Make traps hold on to externally-managed data
...instead of specially handling JS::Completion.
This makes it possible for LibWeb/LibJS to have full control over how
these things are made, stored, and visited (whenever).

Fixes an issue where we couldn't roundtrip a JS exception through Wasm.
2025-04-22 08:43:46 -06:00
Tim Ledbetter
9cf04f40f6 LibWeb: Implement the color-mix() function
This takes 2 color values and returns the result of mixing them by a
given amount.
2025-04-22 12:19:51 +02:00
Shannon Booth
a14711a9d7 LibWeb/Bindings: Use realm's globalObject as thisValue if nullish
We were missing the step to use realm's global object if thisValue
was nullish. This is very trivial to fix, as `impl_this` already
handles everything as it should, allowing us to also remove the
special casing for WindowProxy.
2025-04-22 12:17:14 +02:00
Andreas Kling
e1777f6e79 LibWeb: Make :hover invalidation logic reusable for all pseudo classes
We achieve this by keeping track of all checked pseudo class selectors
in the SelectorEngine code. We also give StyleComputer per-pseudo-class
rule caches.
2025-04-17 19:45:55 +02:00
Andrew Kaster
d1f6f5649e LibWeb: Make storage of CSS::CalculationNodes const-correct
Now we consistently use `RefPtr<CalculationNode const>` for all
CalculationNodes.
2025-04-16 10:41:44 -06:00
Andrew Kaster
6d11414957 LibWeb: Make storage of CSS::StyleValues const-correct
Now we consistently use `RefPtr<StyleValue const>` for all StyleValues.
2025-04-16 10:41:44 -06:00
Andrew Kaster
7d797b2c32 CMake: Remove warning suppression for unknown attributes
We should take care of these with macros or other means instead of
suppressing them.
2025-04-15 02:19:06 -06:00
Andrew Kaster
b133c27305 CMake: Disable [[no_unique_address]] when Swift is enabled
There's an upstream bug on this already.
2025-04-15 02:19:06 -06:00
Timothy Flynn
c0ead1b01a LibIDL+LibWeb: Begin support for async iterator in IDL
This adds support for async iterators of the form:

    async iterable<value_type>;
    async iterable<value_type>(/* arguments... */);

It does not yet support the value pairs of the form:

    async iterable<key_type, value_type>;
    async iterable<key_type, value_type>(/* arguments... */);

Async iterators have an optional `return` data property. There's not a
particularly good way to know what interfaces implement this property.
So this adds a new extended attribute, DefinesAsyncIteratorReturn, which
interfaces can use to declare their support.
2025-04-14 17:43:11 -04:00
Timothy Flynn
296a81c4b8 LibWeb: Add Streams to the list of IDL interface namespaces
Otherwise, we are not able to generate a fully qualified name for
Streams objects.
2025-04-14 17:43:11 -04:00
Timothy Flynn
8599917188 LibWeb: Do not throw exceptions from Promise-type attributes
If an attribute's getter were to throw an exception, we must instead
return a rejected promise. We already supported this behavior for
functions.
2025-04-14 15:50:21 -04:00
Timothy Flynn
500fbcb5b8 Meta: Do not lint IDL files imported from WPT 2025-04-14 15:50:21 -04: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
Aliaksandr Kalenik
b53694b4c0 LibIPC+LibWeb: Delete LargeMessageWrapper workaround in IPC connection
Bring back 2d625f5c23
2025-04-10 23:40:02 +02:00
Tim Ledbetter
1ee56d34e7 Revert "LibIPC+LibWeb: Delete LargeMessageWrapper workaround in IPC…
…connection"

This reverts commit 2d625f5c23.
2025-04-10 16:24:38 +01:00
Aliaksandr Kalenik
2d625f5c23 LibIPC+LibWeb: Delete LargeMessageWrapper workaround in IPC connection
It's no longer needed because TransportSocket is now capable of properly
sending large messages.
2025-04-10 01:30:08 +02:00
stelar7
6ec914c7f7 LibWeb/IDB: Add some debug output 2025-04-09 11:48:49 -06:00
Tim Ledbetter
02d34dd021 LibWeb: Rename CSSColor to ColorFunctionStyleValue
This gives a better idea of what the class represents.
2025-04-09 12:11:33 +01:00
Timothy Flynn
f070264800 Everywhere: Remove sv suffix from format string literals
This prevents the compile-time checks that would catch errors in the
format invocation (which would usually lead to a runtime crash).
2025-04-08 20:00:18 -04:00
Aliaksandr Kalenik
ab35325003 LibIPC: Move early fd deallocation workaround to the transport layer
Reimplements c3121c9d at the transport layer, allowing us to solve the
same problem once, in a single place, for both the LibIPC connection and
MessagePort. This avoids exposing a workaround for a macOS specific Unix
domain socket issue to higher abstraction layers.
2025-04-08 21:09:24 +02:00
Ali Mohammad Pur
6b883c5ccb Meta: Disable -Warray-bounds and -Wstringop-overflow on GCC
These generate what seems to be nonsense warnings on Function and
ByteBuffer; they *should* be investigated at some point, but they don't
provide anything useful at this point.
2025-04-08 14:01:28 +02:00
Ali Mohammad Pur
0a958c8e16 Meta: Add an option to disable LTO for Release builds 2025-04-08 14:01:28 +02:00
Ali Mohammad Pur
fac2ee4452 Meta: Add a link job pool with a configurable size
Parallel linking (esp. with bfd) uses a huge chunk of memory, make it
possible for users to limit the number of link jobs to at least
limit the pain.
2025-04-08 14:01:28 +02:00
rmg-x
514233008b Meta+LibCore: Stop linking against LibCrypt
This was only be used by "Account.cpp" which was removed in:
d8c36ed458
2025-04-08 09:13:33 +02:00
rmg-x
92f5183ced AK+Meta: Remove unused class RecursionDecision 2025-04-08 09:13:33 +02:00
rmg-x
fcf3abd19c AK: Remove unused class DOSPackedTime 2025-04-08 09:13:33 +02:00
Timothy Flynn
3f439efe21 AK: Rename StringImpl to ByteStringImpl
StringImpl is very specific to ByteString. Let's rename it to match, to
avoid confusion with the StringBase and StringData classes.
2025-04-07 17:44:38 +02:00
Timothy Flynn
0a256b0a9a AK+Everywhere: Change StringView case conversions to return String
There's a bit of a UTF-8 assumption with this change. But nearly every
caller of these methods were immediately creating a String from the
resulting ByteString anyways.
2025-04-07 17:44:38 +02:00
Sam Atkins
d2c58e9376 LibWeb/CSS: Generate descriptor initial values
We parse these lazily, and then cache them for future use.
2025-04-07 10:00:21 +01:00
Shannon Booth
f64d5451df LibWeb/Bindings: Do put OptionalNone as member in returned dictionaries
Our handling of 'optional' return values was previously not correct
in that we would always call 'create_data_property' for every
single member of the returned dictionary, even if that property did
not have a value (by falling back to JS::js_null).

This was resulting in a massive number of test failures for URL
pattern which was expecting 'undefined' as the member value, instead
of 'null'.
2025-04-06 08:24:54 -04:00
Shannon Booth
b1b73f32a7 LibWeb/Bindings: Invert logic for nullability check in wrap statements
This is less code, and also makes a future bugfix much simpler to
implement :^)
2025-04-06 08:24:54 -04:00
rmg-x
37998895d8 AK+Meta+LibCore+Tests: Remove unused SipHash implementation
This is a homegrown implementation that wasn't actually used in
dependent classes. If this is needed in the future, using OpenSSL would
probably be a better option.
2025-04-06 01:47:50 +02:00
Aliaksandr Kalenik
c3121c9d8a LibIPC+Meta: Keep message buffer alive until acknowledged by peer
This change ensures that instead of immediately deallocating the message
buffer after sending, we retain it in an acknowledgement wait queue
until an acknowledgement is received from the peer. This is necessary
to handle a behavior of the macOS kernel, which may prematurely
garbage-collect file descriptors contained within the message buffer
before the peer receives them.

The acknowledgement mechanism assumes messages are received in the same
order they were sent so, each acknowledgement message simply indicates
the count of successfully received messages, specifying how many entries
can safely be removed from the acknowledgement wait queue.
2025-04-05 23:14:32 +02:00
Ali Mohammad Pur
396f35c41d Meta: Don't require LTO to build in release mode
check_ipo_supported() will by default fail the generation if IPO is not
available; this commit makes it so we continue the build just without
LTO.
2025-04-05 19:09:59 +02:00
Andrew Kaster
743f8a3a0a CMake: Add macro to wrap C++ command line definitions for swiftc
Similar to the existing macros for compile options and link options,
this macro wraps the command line definitions for swiftc in a way that
avoids warnings about conditional compilation flags not having values.
2025-04-04 13:06:53 -06:00
R-Goc
28d5d982ce Everywhere: Remove unused private fields
This commit removes the -Wno-unusued-private-field flag, thus
reenabling the warning. Unused field were either removed or marked
[[maybe_unused]] when unsure.
2025-04-04 12:40:07 +02:00
Sam Atkins
fd45c53c11 LibWeb: Parse descriptors as style values, using the JSON data
The goal here is to do something a bit smarter with the parsing here
than we do for properties. Instead of the JSON saying "here are the
values, and here are the keywords, and we can have up to 3", here we
place the syntax in the JSON directly (though currently broken up as
one string per option) and then we attempt to parse each one in
sequence. It's something we'll need eventually for `@property` among
other things.

...However, in this first pass, I've gone with the simplest option of
hard-coding the types instead of figuring them out properly. So there's
a PositivePercentage type and a UnicodeRangeTokens type, instead of
properly implementing the grammar for those in a generic way.
2025-04-04 10:40:32 +01:00