Commit graph

66792 commits

Author SHA1 Message Date
Shannon Booth
51102254b5 LibWeb/HTML: Scroll to the fragment before loading the document
Otherwise nowhere ends up scrolling to the fragment specified by the
fragment in document's URL. This fixes ladybird scrolling to the
correct location in the document when navigating to a link that
has a fragment, e.g:

https://html.spec.whatwg.org/multipage/browsing-the-web.html#try-to-scroll-to-the-fragment

As well as use of the :target selector.
2025-01-15 12:43:48 +00:00
Shannon Booth
e74ca82083 LibWeb/XHR: Isomorphic decode accessing XMLHttpRequest response headers
Fixes a crash on:

https://wpt.live/html/browsers/browsing-the-web/navigating-across-documents/refresh/subresource.any.html
2025-01-15 12:35:56 +00:00
Tim Ledbetter
731c2365b6 WebDriver: Disable scrollbar painting when launching the browser 2025-01-15 12:33:53 +00:00
Tim Ledbetter
dd819d1dea LibWebView: Add an option to disable painting viewport scrollbars 2025-01-15 12:33:53 +00:00
Tim Ledbetter
639ed5a052 WebContent+LibWeb: Add an option to disable painting viewport scrollbars 2025-01-15 12:33:53 +00:00
Andrew Kaster
7c3b590d44 LibWeb/WebGL2: Implement MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS
This is a parameter for getParameter()
2025-01-15 11:25:22 +00:00
Andrew Kaster
f5e06a2457 LibWeb/WebGL2: Implement MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS
This is a parameter for getParameter()
2025-01-15 11:25:22 +00:00
Shannon Booth
7b637b1eee LibWeb/HTML: Only use maxlength <input> attribute when applicable 2025-01-15 11:41:39 +01:00
Shannon Booth
5aeae5e583 LibJS: Parse dates like "Wednesday, Jan 15, 2025"
This was getting called on abc.com
2025-01-15 10:42:29 +01:00
Timothy Flynn
e95096d2a9 LibWeb: Mark a few calls to set_attribute as infallible
These cannot possibly throw an exception because the attribute names are
already known to be valid.
2025-01-15 08:46:51 +01:00
stelar7
b43bb2429a LibWeb: Rename ConnectionQueue to RequestList 2025-01-14 23:46:09 +01:00
stelar7
439245b14a LibWeb: Import WPT tests for IDBKeyRange 2025-01-14 23:46:09 +01:00
stelar7
73272d92f0 LibWeb: Implement IDBKeyRange 2025-01-14 23:46:09 +01:00
stelar7
596f1d8426 LibWeb: Move IDBDatabase::close out of line 2025-01-14 23:46:09 +01:00
stelar7
47b8a015a7 LibWeb: Turn IDB internal Key into a GC type 2025-01-14 23:46:09 +01:00
Psychpsyo
5b9d18b462 LibWeb: Improve <select> dropdown position 2025-01-14 07:34:51 +00:00
stasoid
3e81d7ea2e AK: Show executable name in rich debug format on Windows 2025-01-13 20:05:05 -07:00
Psychpsyo
8cd2fe3d08 LibWeb: Fix CSS clip-path ignoring scroll position 2025-01-13 20:03:28 -07:00
Aliaksandr Kalenik
98691810b1 LibWeb: Fix insert/delete rule invalidation for adopted style sheets
Invalidation for adopted style sheets was broken because we had an
assumption that "active" style sheet is always attached to
StyleSheetList which is not true for adopted style sheets. This change
addresses that by keeping track of all documents/shadow roots that own
a style sheet and notifying them about invalidation instead of going
through the StyleSheetList.
2025-01-13 23:03:07 +01:00
devgianlu
24e374d7e1 LibCrypto: Remove old unused padding schemes and codes 2025-01-13 17:00:18 +01:00
devgianlu
a59b48cffc LibCrypto+LibWeb: Replace RSA_OAEP-EME implementation
This replaces the old `OAEP` implementation with one backed by OpenSSL.
The changes also include some added modularity to the RSA class by
making the `RSA_EME` and `RSA_EMSE` for encryption/decryption and
signing/verifying respectively.
2025-01-13 17:00:18 +01:00
devgianlu
70bc26e32a LibCrypto+LibTLS: Replace RSA_PKCS1-EMSA implementation
This commit replaces the old implementation of `EMSA_PKCS1_V1_5` with
one backed by OpenSSL. In doing so, the `sign` and `verify` methods of
RSA have been modified to behave like expected and not just be
encryption and decryption.

I was not able to split this commit because the changes to `verify` and
`sign` break pretty much everything.
2025-01-13 17:00:18 +01:00
devgianlu
4b832b67fb LibWeb: Add RSA-OAEP WPT tests
This serve as a regression check for the next commits
2025-01-13 17:00:18 +01:00
devgianlu
6e721110f9 LibCrypto: Make RSA class easily configurable
This is a small change to allow subclasses of `RSA` to configure the
`EVP_PKEY_CTX` without rewriting everything.
2025-01-13 17:00:18 +01:00
devgianlu
91c393ea98 LibCrypto: Use OpenSSL for RSA encryption and decryption 2025-01-13 17:00:18 +01:00
devgianlu
daa81c9b32 LibCrypto: Remove OpenSSL as a public header dependency
Add a forwarding header for OpenSSL types so that we can build without
propagating the OpenSSL dependency.
2025-01-13 17:00:18 +01:00
devgianlu
559c5a7311 LibCrypto: Move OpenSSL RAII helper methods out of line 2025-01-13 17:00:18 +01:00
devgianlu
977af95b5b LibCrypto: Move hash constructors out of line 2025-01-13 17:00:18 +01:00
devgianlu
0fc02d4d00 LibCrypto: Make PKSystem methods return a ByteBuffer directly
It used to be that the caller would supply a buffer to write the output
to. This created an anti-pattern in multiple places where the caller
would allocate a `ByteBuffer` and then use `.bytes()` to provide it to
the `PKSystem` method. Then the callee would resize the output buffer
and reassign it, but because the resize was on `Bytes` and not on
`ByteBuffer`, the caller using the latter would cause a bug.

Additionally, in pretty much all cases the buffer was pre-allocated
shortly before.
2025-01-13 17:00:18 +01:00
Jelle Raaijmakers
81eb66c6eb CI: Remove conditional execution based on changed paths
Originally we used the `paths-ignore` feature to skip the Lagom jobs if
no source code was changed. Afterwards, we enabled the 'required checks'
feature to prevent merging pull requests that have failing checks.
Unfortunately, marking a check as required means it always needs to be
successfully executed, even if a conditional caused it to be skipped.

By using the `paths-filter` action we were able to add the conditional
to the job instead, theoretically causing the 'required checks' feature
to start working again for documentation-only changes. As it turns out,
not the job, but the steps should get the new conditionals.

As that requires adding an `if` to every individual step and the
conditional execution has caused enough headaches since its
introduction, let's remove it for now and take the unfortunate execution
of CI jobs for granted.
2025-01-13 15:44:35 +01:00
Noah Bright
18b4dc2153 LibWeb: Update add_libweb_test.py to support Screenshot, Ref, and Layout
Changed the usage from `add_libweb_test.py test_name.html` to
`add_libweb_test.py test_name.html test_type` with no default,
and supports automatically generating input/output files in the
right directories for test types Screenshot, Text, Ref, and Layout.

Co-authored-by: Sam Atkins <sam@ladybird.org>
2025-01-13 14:25:26 +00:00
Psychpsyo
bb5d1ac4a3 LibWeb: Fix CSS tag seletor case sensitivity for SVG elements
They can appear in HTML documents but must not be matched
according to the HTML spec.
2025-01-13 12:11:34 +00:00
Psychpsyo
7757df5bb5 LibWeb: Implement CSS 'isolation' property 2025-01-13 11:07:55 +00:00
Sam Atkins
4e1aa96dce LibWeb/CSS: Use CalcSV's context to determine what percentages are
This lets us implement the `matches_number()` and `matches_dimension()`
methods of `CSSNumericType` to spec, instead of being an ad-hoc hack.
2025-01-13 10:59:16 +00:00
Sam Atkins
6f60c258ce LibWeb/CSS: Mark transform property as resolving percentages as lengths 2025-01-13 10:59:16 +00:00
Sam Atkins
a40dbd080d LibWeb/CSS: Remove CSSNumericType::matches_resolution_percentage()
This isn't a spec type.
2025-01-13 10:59:16 +00:00
Sam Atkins
4efdb76857 LibWeb/CSS: Give calc() a CalculationContext for resolving percentages
This is passed in at construction, meaning we will be able to refer to
it later, when we're no longer inside the Parser.
2025-01-13 10:59:16 +00:00
Sam Atkins
bc00ef8314 LibWeb/CSS: Replace Parser "current property" with a stack of contexts
`current_property_id()` is insufficient to determine if a quirk is
allowed. For example, unitless lengths are allowed in certain
properties, but NOT if they are inside a calc() or other function. It's
also incorrect when we are parsing a longhand inside a shorthand. So
instead, replace that with a stack of value-parsing contexts. For now,
this is either properties or CSS functions, but in future can be
expanded to include media features and other places.

This lets us disallow quirks inside functions, like we're supposed to.

It also lays the groundwork for being able to more easily determine
what type a percentage inside a calculation should become, as this is
based on the same stack of contexts.
2025-01-13 10:59:16 +00:00
Tim Ledbetter
619df0bc2c LibWeb: Don't crash when upgrading custom element with a bad constructor
Previously, a crash would occur when attempting to throw an error in
this case because the method used to create the exception tried to get
the current realm from the execution context stack, which is empty. The
realm is now passed explicitly when constructing the error, avoiding
the crash.
2025-01-13 10:55:46 +00:00
Gingeh
403cda5cd6 LibWeb: Allow color keywords in theme-color metadata 2025-01-12 19:47:01 +00:00
Gingeh
9f2ce259ad LibWeb: Check for missing node or invalid query in obtain_theme_color 2025-01-12 19:47:01 +00:00
Gingeh
6fd03425b2 UI: Prevent crash when right clicking on an unloaded image 2025-01-12 19:29:57 +00:00
Shannon Booth
57479c2d4b LibWeb/HTML: Include better information in 'report an exception' event
Instead of always reporting a colno and lineno of zero try and use the
values from the Error object that may be provided, falling back to the
source location of the invocation if not provided. We can definitely
improve the reporting even more, but this is a start!

Also update this function to latest spec while we're in the area.
2025-01-12 18:49:55 +00:00
Shannon Booth
f388d3c88c LibWeb/HTML: Fix crash creating canvas pattern without context
This isn't a full fix, as the paint function does not handle this
either. But instead of getting the bitmap from the image source
immediately, follow the spec a bit more closely by creating the
CanvasPatern object with the ImageSource directly.

Fixes a crash for the 5 included WPT tests.
2025-01-12 18:40:37 +00:00
Shannon Booth
dfdcfc8e88 LibWeb/Bindings: Generate undefined in a union as 'Empty'
This can only ever be undefined, and no other JS value, so it makes
sense to use undefined to represent this case.
2025-01-12 18:39:24 +00:00
devgianlu
fef1f62ecc LibCrypto: Use OpenSSL to generate RSA keys
Replace our slow, possibly incorrect RSA key generation with OpenSSL.

This should fix many WPT tests that are timing out because we were too
slow at computing keys.
2025-01-12 01:13:19 +01:00
devgianlu
130f890497 LibCrypto: Add methods to convert OpenSSL BN <-> UnsignedBigInteger
These methods allow to convert between OpenSSL big numbers and ours.
2025-01-12 01:13:19 +01:00
devgianlu
7b38923144 LibCrypto: Refactor OpenSSL RAII wrappers to a macro 2025-01-12 01:13:19 +01:00
devgianlu
df05cc8478 LibCrypto: Make PKSystem methods return ErrorOr
Make `encrypt`, `decrypt`, `sign` and `verify` return `ErrorOr` for
better error propagation.
2025-01-12 01:13:19 +01:00
devgianlu
6ba627b047 LibCrypto: Remove default key size for RSA::generate_key_pair
The current default is unsafe, but determining a safe value is not easy.
Leave it up to the caller to decide.
2025-01-12 01:13:19 +01:00