Commit graph

1395 commits

Author SHA1 Message Date
Andreas Kling
a7b3360fb6 LibWeb: Make HTMLIFrameElement.sandbox.supports() not throw
We have to list the set of allowed values for the DOMTokenList to not
throw when asking if one is supported.

This fixes an issue where YouTube embeds would hang indefinitely trying
to report an endless series of exceptions, seen on https://null.com/
2024-12-03 15:30:18 +01:00
Andreas Kling
b1796ebd2c Tests: Import a WPT test that uses HTMLIFrameElement.sandbox.supports() 2024-12-03 15:30:18 +01:00
devgianlu
dace140b0d LibCrypto+LibWeb: Implement ECDSA.sign
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Gained ~20 tests, failing only on P-521.
2024-12-03 13:20:51 +01:00
devgianlu
0c60f7c995 LibWeb: Migrate ECDSA.generateKey and ECDSA.verify away from ByteBuffer
Use instances of `ECPublicKey` and `ECPrivateKey` instead of
`ByteBuffer` for ECDSA. Fixes another ~200 tests.
2024-12-03 13:20:51 +01:00
devgianlu
f0fbd50c66 LibWeb: Implement ECDSA.importKey and ECDSA.exportKey
Very similar implementation to ECDH. Fixes ~700 tests!
2024-12-03 13:20:51 +01:00
Andreas Kling
940cdc7cf9 Tests: Rebaseline tests after changes to imported WPT harness
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
2024-12-03 00:26:03 +01:00
Andreas Kling
0ed5278772 Tests: Rebaseline a recently-added editing test 2024-12-03 00:19:15 +01:00
Shannon Booth
6ac018bcb6 LibWeb: Fix crash accessing 'empty' PromiseRejectionEvent reason
The 'reason' was getting initialized to 'empty' state when not
provided through the constructor, which results in a crash when
accessed through throw_dom_exception_if_needed in the generated
IDL getter.
2024-12-03 00:18:11 +01:00
Jelle Raaijmakers
217567981a LibWeb: Implement "plaintext-only" state for contenteditable 2024-12-03 00:18:03 +01:00
Tim Ledbetter
cc1ea02949 LibWeb: Disable test output for imported WPT tests
This reduces the runtime of all imported WPT tests from 8.2 seconds to
4.5 seconds on my local machine.
2024-12-02 22:41:51 +00:00
Tim Ledbetter
61ae388140 Tests: Create imported WPT test output from completion callback data
This allows us to disable test output, which performs expensive assert
tracking. This was making our imported tests run significantly slower
than tests run via `WPT.sh`.

Formatting the output ourselves also allows us to remove unnecessary
information from the test output.

This commit also rebaselines all existing imported WPT tests to follow
the new format.
2024-12-02 22:41:51 +00:00
Gingeh
0afd7f166a LibWeb: Improve grid-template-area parsing and serialization 2024-12-02 16:19:47 +00:00
Tim Ledbetter
44cf457fd2 LibWeb: Limit HTMLTableColElement span to allowed values
This change ensures that `span` is clamped to the maximum value of 1000
if the given value is larger than 2147483647.
2024-12-02 10:25:27 +01:00
Tim Ledbetter
9fc2a63131 LibWeb: Limit HTMLTableCellElement rowSpan to allowed values
This change ensures that `rowSpan` is clamped to the maximum value of
65534 if the given value is larger than 2147483647.
2024-12-02 10:25:27 +01:00
Tim Ledbetter
4630b1a44b LibWeb: Limit HTMLTableCellElement colSpan to allowed values
This change ensures that `colSpan` is clamped to the maximum value of
1000 if the given value is larger than 2147483647.
2024-12-02 10:25:27 +01:00
Tim Ledbetter
7097152ebc LibWeb: Restrict HTMLTextAreaElement::min_length to the range of i32 2024-12-02 10:25:27 +01:00
Tim Ledbetter
ac7fad52f6 LibWeb: Restrict HTMLTextAreaElement::max_length to the range of i32 2024-12-02 10:25:27 +01:00
Tim Ledbetter
bc484258c2 LibWeb: Restrict HTMLInputElement::min_length to the range of i32 2024-12-02 10:25:27 +01:00
Tim Ledbetter
40d6b9d44e LibWeb: Restrict HTMLInputElement::max_length to the range of i32 2024-12-02 10:25:27 +01:00
Konstantin Konstantin
1915574165 LibWeb: Fix NavigationType enum to string conversion
Convert NavigationType to lowercase strings, as described in the spec.

Import related WPT test.
2024-12-02 06:47:49 +00:00
Pavel Shliak
4d5acc7a00 LibWeb: Remove IDBRequest.idl FIXME
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
2024-12-01 22:04:05 +01:00
Pavel Shliak
e02fd4ca8c Tests: Reimport Event-constants WPT
I reimported and rebaselined it using the latest version
of our WPT importer. Now it passes.
2024-12-01 22:01:48 +01:00
Tim Ledbetter
a486c86eee LibWeb: Limit HTMLCanvasElement width and height to allowed values
Setting the `width` or `height` properties of `HTMLCanvasElement` to a
value greater than 2147483647 will now cause the property to be set to
its default value.
2024-12-01 15:12:04 +00:00
Tim Ledbetter
b05bc71002 LibWeb: Limit HTMLImageElement width and height to allowed values
Setting the `width` or `height` properties of `HTMLImageElement` to a
value greater than 2147483647 will now cause the property to be set to
0.
2024-12-01 15:12:04 +00:00
Shannon Booth
30c8510725 LibWeb: Ensure requests modules is not empty before indexing into it
Regression from 5af613aa65

Fixes: #2676
2024-12-01 15:49:16 +01:00
Netanel Haber
d743fcb376 LibWeb: Take namespace into account when matching attribute 2024-11-30 16:47:14 +00:00
Jelle Raaijmakers
033cd9cab3 LibWeb: Add test for document.execCommand("delete")
Anchor the minimum functionality for this. WPT has an extensive suite
to test editing functionalities, but they all take a long time to
execute - so let's have a simple regression test in-tree for now.
2024-11-30 17:35:45 +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
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
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
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
Pavel Shliak
f2a406f8cc Tests: Import WPTs to prevent optional string argument regressions
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
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
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