Commit graph

66752 commits

Author SHA1 Message Date
sideshowbarker
e9dedeee34 Tests: Import ARIAMixin string attributes CEReactions tests (no code) 2024-12-20 05:17:05 -08:00
R-Goc
579484e065 LibCore: Fix compilation of EventLoopImplementationWindows.cpp 2024-12-20 13:57:43 +01:00
R-Goc
9cb397914e Meta: Enable warning for the use of VLAs
This commit enables warnings when using variable length arrays. For
disabling this warning locally use -Wno-vla, as it will work both across
Clang and GCC.
2024-12-20 09:37:56 +01:00
R-Goc
74309ce8c2 Tests: Remove use of VLAs from TestRSA.cpp
This commit removes the use of variable length arrays from the tests for
RSA. This is the last remaining place using VLAs.
2024-12-20 09:37:56 +01:00
Timothy Flynn
edd3b14ddf LibCrypto: Protect the SignedBigInteger ctor against integer overflow
In particular, if given a value of -2147483648, we would invoke signed
integer overflow (which is UB).
2024-12-19 23:37:30 +01:00
Totto16
540c840755 LibWeb: Add test for getComputedStyle with a PseudoElement argument
This test checks the case, where an unknown pseudo element is used as
second argument to getComputedStyle
2024-12-19 19:35:57 +00:00
Totto16
d21bfda900 LibWeb: Handle special cases of PseudoElement::Type correctly
There are some special values for CSS::Selector::PseudoElement::Type
which are after `KnownPseudoElementCount` and therefore not present in
various arrays of pseudo elements, this leads to some errors, if a type
after `KnownPseudoElementCount` is used without checking first. This
adds explicit checks to all usages
2024-12-19 19:35:57 +00:00
devgianlu
8620a2af47 LibCrypto: Ensure RSA decryption with CRT works for all inputs
Ensure becomes `m1` greater than `m2` even when smaller by more than
one `p`. Since the next operations on `m1` are modulus `p` we can add it
as many times as it's needed.
2024-12-19 18:43:23 +01:00
Sam Atkins
1c9f0601e9 Tests: Re-enable slow WPT svg-in-iframe/object tests
These all use `<meta name=timeout content=long>` and so should now be
safe to run without timing out.

Fixes #2792
2024-12-19 17:27:33 +00:00
Sam Atkins
f62ccb010d Tests: Let WPT tests set their own timeout
The official WPT runner supports a `<meta name=timeout content=long>`
tag to let tests opt-in to a longer timeout. Modify our harness to pass
that custom timeout to our runner, so that we don't incorrectly time
out if our default time is shorter than the requested one.
2024-12-19 17:27:33 +00:00
Sam Atkins
be6a9940ad headless-browser: Let tests set their own timeout duration
Some tests take longer than others, and so may want to set a custom
timeout so that they pass, without increasing the timeout for all other
tests. For example, this is done in WPT.

Add an `internals.setTestTimeout(milliseconds)` method that overrides
the test runner's default timeout for the currently-run test.
2024-12-19 17:27:33 +00:00
Andreas Kling
9164c9784d LibGfx: Treat PNG files with invalid frame data as transparent
If we have a valid PNG header with geometry info etc, we should still
display it as *something*, even if the image data itself is missing or
corrupted.

This matches the behavior of other browsers, and is something that
Cloudflare Turnstile checks for.

To achieve this, we split the PNG decoder's initialization into two
steps: "everything except reading frame data" and "reading frame data".
If the latter step fails, we yield a transparent bitmap with the
geometry from the PNG's IHDR chunk.
2024-12-19 16:49:28 +01:00
Andreas Kling
f44166ebd0 LibGfx: Allow IPC encode/decode of empty BitmapSequence
This would fail with EINVAL earlier, due to an attempt to create a
zero-length Core::AnonymousBuffer.

We fix this by transferring the buffer length separately, and only
going down the AnonymousBuffer allocation path if the length is
non-zero.
2024-12-19 16:49:28 +01:00
Andreas Kling
6737b8b065 IPCCompiler: Don't silently ignore failure to encode IPC message
When message encoding failed for some reason, we'd just swallow the
error without saying a word, and carry on without sending anything.

This led to some very confusing situations.
2024-12-19 16:49:28 +01:00
Tim Ledbetter
e74d8a6003 LibWeb: Report exceptions that occur during resize observer callback 2024-12-19 15:25:08 +00:00
Tim Ledbetter
62ecff0b40 LibWeb: Report exceptions that occur during microtask callback 2024-12-19 15:25:08 +00:00
Tim Ledbetter
7a41ab960c LibWeb: Report exceptions when invoking intersection observer callback 2024-12-19 15:25:08 +00:00
Tim Ledbetter
7cacf5ca55 LibWeb: Report exceptions when invoking custom element reactions 2024-12-19 15:25:08 +00:00
Tim Ledbetter
d8511e39c9 LibWeb: Report exceptions that occur during mutation observer microtask 2024-12-19 15:25:08 +00:00
Tim Ledbetter
4a6e457d4b LibWeb: Update run_timer_initialization_steps to the latest spec
This fixes a number of WPT tests, which expect an error to be reported
if an exception is thrown in the timer callback.
2024-12-19 15:25:08 +00:00
Tim Ledbetter
1f57df34f1 LibWeb: Update WebIDL::invoke_callback() to follow the latest spec
`WebIDL::invoke_callback()` now takes an `exception_behavior`
parameter, which can be set to `report` to report an exception before
returning. Setting `exception_behavior` to `rethrow` retains the
previous behavior.
2024-12-19 15:25:08 +00:00
Aliaksandr Kalenik
07635d4554 LibWeb/WebGL: Set INVALID_OPERATION if object does not belong to context 2024-12-19 13:38:43 +01:00
Aliaksandr Kalenik
fbae24f7a9 LibWeb/WebGL: Don't treat WebGLUniformLocation as WebGLObject
...in code generator. `is_webgl_object_type()` is only supposed to
return true for objects inheriting from WebGLObject.
2024-12-19 13:38:43 +01:00
Aliaksandr Kalenik
cf730870c5 LibWeb: Save WebGL context pointer in WebGLObject
This way we could be sure that context object won't be deallocated
before any of the objects that belong to it.

Having a context pointer is also going to be used in upcoming changes
to generate an INVALID_OPERATION error if an object does not belong to
the context it's being used in.
2024-12-19 13:38:43 +01:00
Lucien Fiorini
b909e3d587 Tests: Add screenshot test for Canvas2D fillstyle opacity 2024-12-19 13:31:12 +01:00
Lucien Fiorini
26970201bd LibGfx: Fix color opacity regression in Canvas2D
The color alpha was being overwritten by the global alpha instead of
being multiplied.
2024-12-19 13:31:12 +01:00
Lucas CHOLLET
61755b29c9 Tests: Import a bunch of css-color tests from WPT 2024-12-19 09:54:14 +00:00
Lucas CHOLLET
9261688488 Tests: Import a few ICC profiles related tests 2024-12-19 09:54:14 +00:00
Lucas CHOLLET
2b56a53d41 Meta: Also download support files of WPT tests' reference pages 2024-12-19 09:54:14 +00:00
Lucas CHOLLET
cc76225c1f Meta: Refactor map_to_path() to use a basic loop 2024-12-19 09:54:14 +00:00
Lucas CHOLLET
ccb4c205cd Meta: Remove one global variable in the wpt import script 2024-12-19 09:54:14 +00:00
Lucas CHOLLET
8a0c63f168 headless-browser: Stop considering support files from WPT as tests 2024-12-19 09:54:14 +00:00
Lucas CHOLLET
325d1bb853 Meta: Download support images along their respective WPT tests 2024-12-19 09:54:14 +00:00
Jelle Raaijmakers
f29457b61e LibWeb: Resolve performance FIXME in Node::is_equal_node() 2024-12-18 23:46:22 +00:00
Jelle Raaijmakers
c357fbf036 LibWeb: Remove unused (Tree)Node::index_of_child() 2024-12-18 23:46:22 +00:00
devgianlu
637f934f69 LibWeb: Correctly normalize HashAlgorithmIdentifier
Make sure that `HashAlgorithmIdentifier` is passed through
`normalize_an_algorithm` to verify that the hash is valid and supported.

This is required by the spec, but we are not following it very strictly
in `normalize_an_algorithm` because it is pretty convoluted.

Fixes ~60 tests.
2024-12-18 12:45:06 -08:00
Sam Atkins
4c5a40579a LibWeb: Match spec changes to "create an element" algorithm
Corresponds to https://github.com/whatwg/html/pull/10857

No code changes, only comments.
2024-12-18 19:22:44 +00:00
Sam Atkins
aa29a3ff6b LibWeb/HTML: Update resource fetch algorithm to match current spec
Changes from https://github.com/whatwg/html/pull/10792

No code changes, only comments.
2024-12-18 19:22:44 +00:00
Sam Atkins
30d23ad090 LibWeb/HTML: Use camelCase for variables in adoption agency comments
This is a spec change but I don't know when it occurred.

Also reformat some of the spec comments for clarity.

No code changes, only comments.
2024-12-18 19:22:44 +00:00
Sam Atkins
5651c6fd9b LibWeb: Match spec changes for "custom element registry" concept
Corresponds to https://github.com/whatwg/html/pull/10845 and
https://github.com/whatwg/html/pull/10865
2024-12-18 19:22:44 +00:00
Lucien Fiorini
97768d8927 LibGfx: Fix dynamic_cast undefined behavior on macOS
MacOS XCode 16 breaks dynamic_cast on final classes where the base
class has a has a virtual destructor defined in the header, which
creates a different virtual table per translation unit.
This is probably a regression in Apple's Clang that causes final
classes to be incorrectly aggressively optimized.
https://stackoverflow.com/questions/79192304/macos-xcode-16-breaks-dynamic-cast-for-final-types-defined-in-shared-library
2024-12-18 18:54:20 +01:00
Lucien Fiorini
d9ab68dd62 Tests: Import WPT test for canvas filter values 2024-12-18 18:54:20 +01:00
Lucien Fiorini
aea0172a44 Tests: Add screenshot test for canvas filters 2024-12-18 18:54:20 +01:00
Lucien Fiorini
a6ef6550f3 LibWeb+LibGfx: Implement Canvas2D filters 2024-12-18 18:54:20 +01:00
Lucien Fiorini
9fd1223992 LibWeb+LibGfx: Refactor CSS filters into LibGfx
CSS filters work similarly to canvas filters, so it makes sense to have
Gfx::Filter that can be used by both libraries in an analogous way
as Gfx::Color.
2024-12-18 18:54:20 +01:00
Sam Atkins
bc971a4ccc UI/Headless: Clear pending data when a test completes
Without this, a crashing ref test is able to take down the entire
process because of the `VERIFY(!m_pending_screenshot);` in
`take_screenshot()`. The dialog/prompt fields were not causing crashes
but clearing them feels more hygienic.
2024-12-18 17:38:53 +00:00
sideshowbarker
ce65457746 LibWeb: Fix internal logic for recognizing non-abstract ARIA roles 2024-12-18 15:24:51 +00:00
Jess
af3d46dc06 Flake/devshell: Port skia skcms fix from local vcpkg overlay
See #4d7b717
2024-12-18 15:15:42 +00:00
Jess
61fcccb104 Flake: Add and run formatter + Rename devshell
Add a formatter output to the flake (`nix fmt`), along with moving +
renaming the devshell so it will work by running `nix-shell` in the root
of the project.
2024-12-18 15:15:42 +00:00
Sam Atkins
6969d1eba3 LibWeb/CSS: Parse calc() as intermediate types instead of UnparsedCN
Previously we created a tree of CalculationNodes with dummy
UnparsedCalculationNode children, and then swapped those with the real
children. This matched the spec closely but had the unfortunate
downside that CalculationNodes couldn't be immutable, and couldn't know
their properties at construct-time. UnparsedCalculationNode is also a
footgun, as if it gets left in the tree accidentally we would VERIFY().

So instead, let's parse the calc() tree into an intermediate format, and
then convert each node in that tree, depth-first, into its
corresponding CalculationNode. This means each CalculationNode knows
what its children are when it is constructed, and they never change.

Apart from deleting UnparsedCalculationNode, we can also get rid of the
for_each_child_node() method that was only used by this "replace the
children" code.
2024-12-18 12:21:22 +00:00