Commit graph

65794 commits

Author SHA1 Message Date
Sam Atkins
8b984c0c57 LibURL: Clarify whether an Origin is opaque
Origins are immutable and we know on construction whether an Origin is
opaque. This also removes an implicit reliance on Host's Empty state.
2024-11-30 12:07:39 +01:00
Sam Atkins
3124dca528 LibURL+LibWebView: Move public suffix data to LibURL 2024-11-30 12:07:39 +01:00
Sam Atkins
edcdcea92d LibWebView: Simplify string joining in GeneratePublicSuffixData
Super minor, but gets rid of a clangd warning about the builder name
already being used.
2024-11-30 12:07:39 +01:00
Shannon Booth
91007eb476 LibWeb: Ensure principal realm returned for nested Shadow Realms
Recently reported against the shadow realm proposal after running into
issues with WPT tests.

In a nested shadow realm, the associated realm is a shadow realm, not
the principal realm. One such issue this fixes is a crash when a nested
shadow realm performs an operation which requires the principal settings
object.
2024-11-30 11:55:11 +01:00
Shannon Booth
218ac86b67 LibWeb: Use relevant principal settings for HighResolutionTime
Fixes a crash when setting the timestamps when creating a DOM event
within a ShadowRealm.
2024-11-30 11:55:11 +01:00
Shannon Booth
6a668f27c7 LibWeb: Push promise rejection handling onto UniversalGlobalScopeMixin
This is needed for shadow realms which don't have a window or worker
global object. Fixes a crash for the attached test.
2024-11-30 11:55:11 +01:00
Shannon Booth
fb17f8ff66 LibWeb: Get document for cookies usage from principal realm
Needed for when a shadow realm does an HTTP fetch as part of an import.
2024-11-30 11:55:11 +01:00
Shannon Booth
bc10729af6 LibWeb: Add relevant principal helper abstract operations
These were recently added into the shadow realm merge request as
convenience helpers.
2024-11-30 11:55:11 +01:00
Shannon Booth
d5aaff818e LibWeb: Adjust 'resolve a module specifier' to shadow realm proposal 2024-11-30 11:55:11 +01:00
Shannon Booth
bb10b0e301 LibWeb: Always assert that principal realm returns a principal realm
There was a bug in the HTML proposal where a synthetic realm settings
object's principal realm was a shadow realm if there were nested shadow
realms, which this assertion catches more directly (rather than later
down the track, where it is used).

We were meant to also assert for this case, but we were previously
returning early.
2024-11-30 11:55:11 +01:00
Shannon Booth
27f1e3676f LibWeb: Visit proper base class in SyntheticHostDefined
This was a goof of mine from when I added a common HostDefined base
class.
2024-11-30 11:55:11 +01:00
Shannon Booth
b39f4f0b5a LibWeb: Add stub definition for WorkletGlobalScope 2024-11-30 11:19:35 +01:00
Shannon Booth
286c177896 LibWeb: Support 'Worklet' exposed 2024-11-30 11:19:35 +01:00
Shannon Booth
cc11dcc9a1 LibWeb: Add stubbed implementation for ServiceWorkerGlobalScope 2024-11-30 11:19:35 +01:00
Shannon Booth
4417f63ca0 LibWeb: Move ServiceWorker classes to ServiceWorker namespace
These are defined by the ServiceWorker spec, not the HTML one.
2024-11-30 11:19:35 +01:00
Shannon Booth
2918405360 LibWeb: Rename ServiceWorker::ServiceWorker to ServiceWorkerRecord
This is to resolve naming conflicts between the ServiceWorker JS exposed
object and the internal representation of a ServiceWorker which is going
to be stored cross process.
2024-11-30 11:19:35 +01:00
Shannon Booth
04508841e9 LibWeb: Fix indent of the IDL generator using namespace hack 2024-11-30 11:19:35 +01:00
Timothy Flynn
53a507303c LibJS: Prevent extensions of TypedArray exotic objects
This is a normative change in the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/c1040ff
2024-11-30 11:18:26 +01:00
devgianlu
c6e684791f LibWeb: Remove useless bytes conversion in ECDH.exportKey
Using `generate_public_key_point` instead of `generate_public_key`
removes a bit of redundant code.
2024-11-30 11:17:44 +01:00
devgianlu
399b3d2430 LibCrypto+LibWeb: Parse EC public key in parse_subject_public_key_info
Replicate what we are doing with RSA and parse both the private and
public key when parsing the ASN1.

The only thing that changed in the tests is the error message.
2024-11-30 11:17:44 +01:00
devgianlu
1f7586ce14 LibCrypto: Use ASN1 macros for RSA key parsing
Improve error handling in `RSA::parse_rsa_key` by using ASN1 macros and
generalizing the parsing to both private and public keys.
2024-11-30 11:17:44 +01:00
devgianlu
ee50a8c0f7 LibCrypto: Do not parse PKCS#8 in RSA::parse_rsa_key
The decoding inside `RSA::parse_rsa_key` is quite complex because it
tries to understand if it's decoding PKCS#8 or PKCS#1. Simplify the code
 by moving the burden to the PEM decoder.
2024-11-30 11:17:44 +01:00
devgianlu
57ecd72256 LibCrypto: Return PEM type when decoding and sanity check footer
Improve PEM decoding by parsing the header and returning it along the
data. Also verify if the header is equal to the footer.
2024-11-30 11:17:44 +01:00
devgianlu
0280838944 LibCrypto: Use ASN1 macros for EC key parsing
Improve error handling in `EC::parse_ec_key` by using ASN1 macros and
generalizing the parsing to both private and public keys.
2024-11-30 11:17:44 +01:00
devgianlu
40f17d9260 LibCrypto: Move ASN1 macros to Crypto::ASN1
Makes more sense to have them in `Crypto::ASN1` rather than in
`Crypto::Certificate`.
2024-11-30 11:17:44 +01:00
devgianlu
51f69be51f LibCrypto: Move ASN1 constants to Crypto::ASN1
Makes more sense to have them in `Crypto::ASN1` rather than in
`Crypto::Certificate`.
2024-11-30 11:17:44 +01:00
devgianlu
ab2960e49f LibCrypto+LibWeb: Reorganize OID ASN1 constants
I have divided ANS1 constants by length so that they don't have
trailing zeros that need to be removed.

Also moved OIDs lists to the only place they are used for clarity.

Fixed a couple of WPT tests by adding SECP521r1 to the list of known
curves.
2024-11-30 11:17:44 +01:00
Tim Ledbetter
b39fdcfec2 LibWeb: Implement the HTMLInputElement.height attribute
This allows the height of an image button input to be set and queried.
2024-11-30 11:01:33 +01:00
Tim Ledbetter
45a2823e08 LibWeb: Implement the HTMLInputElement.width attribute
This allows the width of an image button input to be set and queried.
2024-11-30 11:01:33 +01:00
Sam Atkins
8e3adbe082 LibWeb: Serialize text-decoration closer to spec
This gets us 32 WPT subtest passes that I'm aware of. :^)
2024-11-30 11:01:12 +01:00
Sam Atkins
c405c4bcf1 LibWeb: Allow calling property_initial_value() without a Realm
In this situation we're only able to get initial values that have
already been parsed. It's a little sketchy but doesn't seem to break
anything.
2024-11-30 11:01:12 +01:00
Sam Atkins
671d3e8a48 LibWeb/CSS: Sort text-decoration-line values in spec order
This wins us 49 WPT subtest passes! :^)
2024-11-30 11:01:12 +01:00
Sam Atkins
fa1e102f3c Tests: Import text-decoration WPT tests 2024-11-30 11:01:12 +01:00
Sam Atkins
9453c25925 LibWeb/CSS: Don't repeat CSS-wide keywords when serializing shorthands
Regardless of what the shorthand property is, if all its longhands are
the same CSS-wide keyword such as "initial" or "inherit", then it's the
same as the shorthand being that value.

This gets us 2 WPT subtest passes.
2024-11-30 11:01:12 +01:00
Sam Atkins
0c39d07b4d LibWeb/CSS: Serialize overflow correctly
When the x and y values are the same, we only want to serialize one.

This gets us 10 local WPT subtest passes. :^)
2024-11-30 11:01:12 +01:00
Sam Atkins
e4d55a6037 LibWeb/CSS: Use ShorthandStyleValue to serialize shorthands
This wins us 65 new WPT subtest passes! It also shows up that we're
doing the wrong thing in ShorthandStyleValue in places, notably with
the grid properties. However, having one place to fix instead of two
will make it easier to correct them. :^)

In order to be fully correct, we should use the algorithm here:
https://drafts.csswg.org/cssom/#serialize-a-css-value

However, it's quite hand-wavy. What we do have in the meantime is
`ShorthandStyleValue::to_string()`, where we special-case the
serialization rules for shorthands with a generic fallback that's
equivalent to what the previous `get_property_value()` code was doing.
2024-11-30 11:01:12 +01:00
Sam Atkins
bc17a3c2eb LibWeb: Correctly skip "decimal" in counter() serialization
It's not a keyword, it's a custom-ident. The simplest way of comparing
is by serializing it as a string.

This gets us 2 subtest passes.
2024-11-30 11:01:12 +01:00
Sam Atkins
917d659f8b LibWeb/CSS: Remove unwanted newline from list serialization
Gets us 1 subtest pass.
2024-11-30 11:01:12 +01:00
Sam Atkins
8cdb8ca193 LibWeb/CSS: Add missing commas to rect() serialization
Gets us 1 WPT subtest pass.
2024-11-30 11:01:12 +01:00
Sam Atkins
5bcd9abc42 LibWeb/CSS: Serialize background-repeat correctly
This gets us 4 WPT subtest passes.
2024-11-30 11:01:12 +01:00
Sam Atkins
2fc164c0b6 Tests: Import WPT CSSOM tests about serialization
This is an area we're lacking in, so let's bring these in-tree to track
them more easily. :^)
2024-11-30 11:01:12 +01:00
joshua stein
12442ca430 LibWeb: Remove a misleading duplicate comment in HTMLParser 2024-11-30 07:07:30 +00:00
Pavel Shliak
f2a406f8cc Tests: Import WPTs to prevent optional string argument regressions 2024-11-29 20:23:01 +00:00
Pavel Shliak
a25ff8d46e Tests: Import WPT inputevent constructor test 2024-11-29 20:23:01 +00:00
Pavel Shliak
d223cf25af LibWeb: Fix LegacyNullToEmptyString flag handler in IDL 2024-11-29 20:23:01 +00:00
PiyushXCoder
ec425702a4 Build: Fix libpxbackend dependency mismatch
libpxbackend was not being installed from vcpkg which lead to use of
libpxbackend on the system causing library mismatch in rolling
distros(ie arch linux)

a
2024-11-29 09:50:46 -05:00
stasoid
a90b7026fb LibWeb/Layout: Account for box-sizing in table width/height calculations
Fixes #1726

Fixes
wpt/css/CSS2/abspos/abspos-containing-block-initial-004c.xht
wpt/css/CSS2/abspos/abspos-containing-block-initial-004d.xht
wpt/css/CSS2/abspos/abspos-containing-block-initial-005b.xht
wpt/css/CSS2/abspos/abspos-containing-block-initial-005d.xht
2024-11-29 15:43:59 +01:00
Tim Ledbetter
99f8972928 LibWeb: Ignore negative values when setting HTMLProgressElement.max
When attempting to set `HTMLProgressElement.max` to a value not greater
than 0, we were previously setting the value to 1. We now retain the
previous value.
2024-11-29 15:32:04 +01:00
Kostya Farber
81f8866606 LibWeb: Lay out the fieldset's rendered legend 2024-11-29 12:36:52 +00:00
Tim Ledbetter
6218f1a609 LibWeb: Limit HTMLSelectElement.size to allowed values
This change ensures that the correct default value of 0 is used and
that values greater than 2147483647 will fall back to the default value.

It also splits the display size concept into a separate method, as
this isn't supposed to be used when getting the IDL property.
2024-11-29 13:30:57 +01:00