Commit graph

6380 commits

Author SHA1 Message Date
Timothy Flynn
ea503a4f68 LibJS+LibUnicode: Integrate Temporal into Intl.DateTimeFormat
The gist is that we need to construct an ICU date-time formatter for
each possible Temporal type. This is of course going to be expensive.
So instead, we construct the configurations needed for the ICU objects
in the Intl.DateTimeFormat constructor, and defer creating the actual
ICU objects until they are needed.

Each formatting prototype can also now accept either a number (as they
already did), or any of the supported Temporal objects. These types may
not be mixed, and their properties (namely, their calendar) must align
with the Intl.DateTimeFormat object.
2024-11-29 09:52:12 +01:00
Tim Ledbetter
4ad8ba11d5 LibWeb: Use the [Reflect] attribute to implement HTMLLinkElement.as
Also ensure that all valid potential destinations are allowed permitted.
2024-11-29 09:48:59 +01:00
Tim Ledbetter
aafc829e6d LibWeb: Don't allow HTMLTextAreaElement rows and cols to be set to 0
In this case we should fall back to the default value.
2024-11-29 09:48:45 +01:00
Tim Ledbetter
ae0c87c747 LibWeb: Limit HTMLInputElement.size to allowed values
Attempting to set `HTMLInputElement.size` to 0 via IDL now throws an
IndexSizeError DOMException. Attempting to set it to a value larger
than 2147483647 results in it being set to the default value.
2024-11-29 09:48:45 +01:00
Pavel Shliak
08812a1f88 LibRequests: Clean up #include directives
This change aims to improve the speed of incremental builds.
2024-11-29 09:48:29 +01:00
devgianlu
46e724729c LibWeb: Match algorithm names case-insensitive
I dug through the code and the WebCryptoAPI spec to figure out the
reason for `... mixed case parameters` WPT tests and figured out that
our implementation was slightly wrong.

By being closer to the spec we can now pass those tests and also remove
a bunch of duplicated code.

Context: https://github.com/LadybirdBrowser/ladybird/pull/2598#discussion_r1859263798
2024-11-28 00:21:49 +01:00
devgianlu
6ebc812035 LibWeb: Rename EcdhKeyDerivePrams to EcdhKeyDeriveParams 2024-11-28 00:21:49 +01:00
devgianlu
13c9874830 LibWeb: Be spec compliant by comparing WebCryptoAPI strings with case
Following the discovery that the WebCryptoAPI spec requires all strings
to be compared case-sensitive, I have updated existing code that did
not respect this criterion.

No test failures are introduced.

Spec: https://www.w3.org/TR/WebCryptoAPI/#conformance
Context: https://github.com/LadybirdBrowser/ladybird/pull/2598#discussion_r1859263798
2024-11-28 00:21:49 +01:00
Andreas Kling
a74954e145 LibWeb: Don't treat auto insets as definite for child of abspos element
This fixes an issue where the welcome screen wasn't showing up the first
time you visit https://puter.com/ :^)
2024-11-27 22:55:14 +01:00
Daniel La Rocque
e43e4d3a93 LibWeb: Add NullOrError to NavigationParamsVariant
To check whether a NavigationParams is null, we have to check whether
it's `Empty` or `NullWithError`. Instead, we can merge both of these
possible variants into an optional error. If `NullOrError` has no
value it's null, otherwise it contains an error message.
2024-11-27 14:15:37 -07:00
Milo van der Tier
5deb2b4cad LibWeb: Do not give the HTML namespace to elements when parsing XML
While the code that did this referred to the HTML spec, other browsers
appear not to have this behavior when parsing XML, and it breaks a WPT
subtest.

This change does not appear to break any tests, and fixes 1 WPT subtest.
2024-11-27 17:10:32 +01:00
Andreas Kling
a7b791050e LibWeb: Only negotiate NavigableContainerViewport size with objects
Size negotiation should not occur for other viewports, such as iframe,
since that would allow content inside the iframe to affect the size of
the iframe in the containing document.

300 new subtest passes on WPT. :^)
2024-11-27 14:47:05 +01:00
Psychpsyo
e602578501 LibWeb: Add handling for 'an end tag whose tag name is sarcasm' 2024-11-27 10:42:58 +00:00
Psychpsyo
397579096f LibWeb: Add search element to list of Special tags 2024-11-27 11:00:58 +01:00
Tim Ledbetter
7fe3bf07e2 LibWeb: Limit HTMLTextAreaElement attributes to allowed values
If `HTMLTextAreaElement.rows` or `HTMLTextAreaElement.cols`
is set to a value larger than 2147483647, then it should be set to its
default value.
2024-11-27 11:00:25 +01:00
Tim Ledbetter
a8719a706b LibWeb: Limit HTMLMarqueeElement attributes to allowed values
If `HTMLMarqueeElemnt.scrollAmount` or `HTMLMarqueeElemnt.scrollDelay`
is set to a value larger than 2147483647, then it should be set to its
default value.
2024-11-27 11:00:25 +01:00
devgianlu
6fa53a4382 LibWeb: Implement ECDH.exportKey 2024-11-27 10:59:48 +01:00
devgianlu
228276a383 LibWeb: Implement ECDH.importKey 2024-11-27 10:59:48 +01:00
devgianlu
e6056ab959 LibWeb: Implement ECDH.deriveBits 2024-11-27 10:59:48 +01:00
devgianlu
4fb19913a1 LibWeb: Switch ECDH.generateKey to use internal keys instead of bytes
Previously, `ECDH::generate_key` was implemented by storing a
`ByteBuffer` in the `InternalKeyData`. This improves the implementation
by using internal structures of already-parsed data.
2024-11-27 10:59:48 +01:00
devgianlu
fd336ed619 LibWeb: Define EcKeyImportParams 2024-11-27 10:59:48 +01:00
devgianlu
6cf89e46c9 LibCrypto: Parse EC private key when parsing an ASN.1 PrivateKeyInfo
Parse and store the `ECPrivateKey` extracted from the
`privateKeyAlgorithm` field of the ASN.1 `PrivateKeyInfo` sequence when
the algorithm identifier is `ec_public_key_encryption`.

The parsing function returns `ErrorOr` instead of an "empty" key, like
`parse_rsa_key` does. To me, this seemed better in terms of reliability.
 As mentioned in the previous commit, there is room for improvement.
2024-11-27 10:59:48 +01:00
devgianlu
5f3f089494 LibCrypto: Implement ECPrivateKey and ECPublicKey
Added basic EC private and public key definitions as well as ASN.1
encoding and decoding.

A lot of refactoring can be made around the ASN.1 processing (here and
in other parts of the codebase) by utilizing what is available
in `LibCrypto::Certificate` as macros, but I think it's outside the
scope of implementing ECDH support for WebCryptoAPI.
2024-11-27 10:59:48 +01:00
devgianlu
a2522172ad LibCrypto: Expose parse_ec_parameters
This will be required to parse the ASN.1 `ECPrivateKey` sequence in the
next commits.
2024-11-27 10:59:48 +01:00
devgianlu
6e54baadea LibCrypto: Add secpxxxr1 OIDs
Added the following OIDs:
    - secp256r1_oid
    - secp384r1_oid
    - secp521r1_oid
2024-11-27 10:59:48 +01:00
devgianlu
f897af36c2 LibCrypto: Add SECPxxxr1 methods to work with points
It looks like the `SECPxxxr1` was made mainly to work with the TLS
implementation which requires everything to be bytes. This is not always
 the case and a loss of generality.

 I have added some methods that take and return `UnsignedBigInteger`s
 for better interoperability with ASN.1 stuff. I would like to remove
 the old methods relying on bytes, but I haven't made my mind around how
  to generalize it for all curves.
2024-11-27 10:59:48 +01:00
devgianlu
9eea94aa14 LibCrypto+LibWeb: Support passing parameters to ASN.1 wrappers
Add support for encoding parameters in `wrap_in_private_key_info` and
`wrap_in_subject_public_key_info` as well as turn `Span<int>` into
`Span<int const>`.
2024-11-27 10:59:48 +01:00
Shannon Booth
1647893fc8 LibWeb/Streams: Update comments for resolved spec bug
Our bug report has been resolved in the same way we had already
applied a fix (just with some asserts added) with:

https://github.com/whatwg/streams/commit/86d07e
2024-11-27 10:58:45 +01:00
Tim Ledbetter
cc0ad0d1ef LibWeb: Use [URL] extended attribute for HTMLInputElement.src 2024-11-26 23:20:20 +00:00
Jelle Raaijmakers
24069d55bf LibWeb: Partially implement MediaSource.isTypeSupported() 2024-11-26 23:51:02 +01:00
Gingeh
0adf261c32 LibWeb: Don't end parsing after reaching the insertion point 2024-11-26 23:50:18 +01:00
Tim Ledbetter
e176871fdf LibWeb: Use [Reflect] to implement HTMLImageElement.decoding
This ensures the correct behavior when the value of the `decoding`
attribute is changed with `setAttribute()`.
2024-11-26 21:56:28 +00:00
Timothy Flynn
0d635100c4 LibJS: Port Date.parse string arguments to String 2024-11-26 15:02:07 -05:00
Timothy Flynn
fc6155cf2c LibJS: Differentiate between failed ISO8601 parsing and invalid values
If we were able to parse an ISO8601 Date string, but the parse results
in an invalid date (e.g. out of the min/max range), we should abort
parsing immediately.
2024-11-26 15:02:07 -05:00
Timothy Flynn
511029807a LibJS: Implement Date.prototype.toTemporalInstant 2024-11-26 15:02:07 -05:00
Timothy Flynn
8e8c133db5 LibJS: Use Temporal for the Date constructor and Date.now() 2024-11-26 15:02:07 -05:00
Timothy Flynn
7aee254708 LibJS: Use correct epoch offset in InterpretISODateTimeOffset 2024-11-26 15:02:00 -05:00
Tim Ledbetter
9face18ab2 LibWeb: Use correct integer parsing rules in HTMLOListElement::start() 2024-11-26 19:09:24 +01:00
Tim Ledbetter
a61883ae88 LibWeb: Use correct integer parsing rules in HTMLLIElement::value() 2024-11-26 19:09:24 +01:00
Tim Ledbetter
67d05b0104 LibWeb: Use [URL] extended attribute for HTMLVideoElement.poster 2024-11-26 19:07:53 +01:00
Tim Ledbetter
8ad3479e0e LibWeb: Update Screen IDL definition to not inherit from EventTarget 2024-11-26 18:44:26 +01:00
Tim Ledbetter
d73f809af5 LibWeb: Implement HTMLElement.enterKeyHint
This reflects the value of the `enterkeyhint` content attribute
2024-11-26 18:38:38 +01:00
Tim Ledbetter
12fc1de9ca LibWeb: Implement HTMLElement.inputMode
This reflects the value of the `inputmode` content attribute
2024-11-26 18:38:38 +01:00
Andreas Kling
733c6b14ff LibWeb: Teach HTMLObjectElement to negotiate natural size with SVGs
We do this by generalizing the code previously used for SVGSVGBox into
something that can be used for NavigableViewportContainer as well.
2024-11-26 18:32:48 +01:00
Andreas Kling
2405805ddf LibWeb: Delay load event in more HTMLObjectElement situation 2024-11-26 18:32:48 +01:00
Andreas Kling
e88286b337 LibWeb: Mark HTMLObjectElement as potentially delaying the load event 2024-11-26 18:32:48 +01:00
Andreas Kling
b859a6f2e0 LibWeb: Recurse into NavigableContentViewport in layout dumps 2024-11-26 18:32:48 +01:00
Andreas Kling
3ebc7fbd28 LibWeb: Create layout node for HTMLObjectElement navigable containers
This makes SVGs in object elements actually render!
2024-11-26 18:32:48 +01:00
Andreas Kling
dd7623eb30 LibWeb: Rename NestedBrowsingContextP => NavigableContainerViewportP
...where P is for Paintable :^)
2024-11-26 18:32:48 +01:00
Andreas Kling
11d966f3ba LibWeb: Make NavigableContainerViewport always have a NavigableContainer
Let's not limit this to only corresponding to an HTMLIFrameElement.
2024-11-26 18:32:48 +01:00