Commit graph

65079 commits

Author SHA1 Message Date
Shannon Booth
0bf2a8362a LibJS: Make Value inherit from a NanBoxedValue
NanBoxedValue is intended to be a GC-allocatable type which is not
specific to javascript, towards the effort of factoring out the GC
implementation from LibJS.
2024-11-14 15:38:45 +01:00
Shannon Booth
c0bcebeb08 LibJS: Add const versions of Cell::visit 2024-11-14 15:38:45 +01:00
Sam Atkins
1bcc6764ae Tests: Skip flaky text-as-flexitem-size test 2024-11-14 14:35:30 +00:00
Sam Atkins
5a1eb9e220 LibWeb/CSS: Keep invalid parts of <forgiving-selector-list>s around
Attempt 2! Reverts 2a5dbedad4

This time, set up a different combinator when producing a relative
invalid selector rather than a standalone one. This fixes the crash.

Original description below for simplicity because it still applies.

---

Selectors like `:is(.valid, &!?!?!invalid)` need to keep the invalid
part around, even though it will never match, for a couple of reasons:

- Serialization needs to include them
- For nesting, we care if a `&` appeared anywhere in the selector, even
  in an invalid part.

So this patch introduces an `Invalid` simple selector type, which simply
holds its original ComponentValues. We search through these looking for
`&`, and we dump them out directly when asked to serialize.
2024-11-14 13:20:01 +01:00
Jelle Raaijmakers
329cd946ac LibWeb: Implement Web Crypto HMAC algorithm
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-14 11:52:18 +01:00
Jelle Raaijmakers
884a4163a0 LibWeb: Centralize validating a JWK's key_ops field
This gets rid of a couple FIXMEs and allows reusing the logic of
validating this field between different algorithms. While we're here,
expand its logic to match the constraints as outlined in RFC 7517.
2024-11-14 11:52:18 +01:00
Jelle Raaijmakers
f73a434177 LibWeb: Centralize getting the hash algorithm identifier for crypto 2024-11-14 11:52:18 +01:00
Timothy Flynn
4e1dab477a LibWebView+UI: Handle common WebView client initialization in LibWebView
No need to have every UI manually implement these common steps.
2024-11-14 11:47:32 +01:00
Timothy Flynn
44d6601dc5 LibWebView+UI: Handle worker agent requests from within LibWebView
There is no longer any UI-specific facilities needed to launch a worker
agent.
2024-11-14 11:47:32 +01:00
Timothy Flynn
652dde5022 LibWebView+UI: Acquire the paths to helper processes inside LibWebView
We no longer need to acquire these paths from the UI and pass them into
LibWebView - we can figure out these paths internally.
2024-11-14 11:47:32 +01:00
Timothy Flynn
bb7dff7dfe LibWebView+UI: Move ownership of application services to LibWebView
LibWebView now knows how to launch RequestServer and ImageDecoderServer
without help from the UI, so let's move ownership of these services over
to LibWebView for de-duplication.
2024-11-14 11:47:32 +01:00
Lucas CHOLLET
1b38ebcc7f LibWeb/CSS: Resolve percentage values against 1 in CSSColor
This was a silly mistake on my end and percentages values are not
covered by device-independent color space, so I had to add support for
srgb to run a WPT test that made me realize the mistake.

This makes the following test pass:
 - css/css-color/predefined-002.html
2024-11-14 09:26:28 +00:00
Lucas CHOLLET
a3ef24e30a LibWeb/CSS: Add support for the srgb color space in color()
It makes the following WPT tests pass:
 - css/css-color/predefined-001.html
 - css/css-color/xyz-003.html
 - css/css-color/xyz-d50-003.html
 - css/css-color/xyz-d50-004.html
 - css/css-color/xyz-d65-003.html

Also we now render the reference of color-mix-currentcolor-nested-for-
color-property.html properly. Which means that it's now different from
the actual test, that is still rendered incorrectly. In other word, the
false positive for this test is now turned into a true negative.
2024-11-14 09:26:28 +00:00
Shannon Booth
3b04c983f1 LibWeb: Check for overflow when creating ImageData
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
We would overwise crash on overflow.
2024-11-13 19:23:25 -05:00
Timothy Flynn
25c067872c headless-browser: Ensure crashing tests cause LibWeb tests to fail 2024-11-13 19:21:57 -05:00
Pavel Shliak
ce56bc29e2 UI: Set headless-browser width and height 2024-11-13 16:52:33 -05:00
Shannon Booth
1e54003cb1 LibJS+LibWeb: Rename Heap::allocate_without_realm to Heap::allocate
Now that the heap has no knowledge about a JavaScript realm and is
purely for managing the memory of the heap, it does not make sense
to name this function to say that it is a non-realm variant.
2024-11-13 16:51:44 -05:00
Shannon Booth
9b79a686eb LibJS+LibWeb: Use realm.create<T> instead of heap.allocate<T>
The main motivation behind this is to remove JS specifics of the Realm
from the implementation of the Heap.

As a side effect of this change, this is a bit nicer to read than the
previous approach, and in my opinion, also makes it a little more clear
that this method is specific to a JavaScript Realm.
2024-11-13 16:51:44 -05:00
Andreas Kling
2a5dbedad4 Revert "LibWeb/CSS: Keep invalid parts of <forgiving-selector-list>s around"
This reverts commit 698dd600f2.

This caused multiple tests to crash on macOS:
https://github.com/LadybirdBrowser/ladybird/pull/2317#issuecomment-2474725826
2024-11-13 21:37:34 +01:00
Sam Atkins
698dd600f2 LibWeb/CSS: Keep invalid parts of <forgiving-selector-list>s around
Selectors like `:is(.valid, &!?!?!invalid)` need to keep the invalid
part around, even though it will never match, for a couple of reasons:

- Serialization needs to include them
- For nesting, we care if a `&` appeared anywhere in the selector, even
  in an invalid part.

So this patch introduces an `Invalid` simple selector type, which simply
holds its original ComponentValues. We search through these looking for
`&`, and we dump them out directly when asked to serialize.
2024-11-13 20:38:12 +01:00
Sam Atkins
1849eca503 WebContent: Dump style sheets that are inside shadow roots
Also include a header to say what shadow root each style sheet is in, so
we can distinguish between them.
2024-11-13 20:37:29 +01:00
Timothy Flynn
957032809b UI: Send the current system visibility state to new WebContent clients
After a crash, we need to inform the new WebContent process of the
current system visibility state.
2024-11-13 20:36:47 +01:00
Timothy Flynn
83b1db785a LibWebView+WebContent+UI: Remember the current system visibility state
We will want to re-inform WebContent of the system visibility state when
we create a new process after a crash. This changes the IPC to just send
the enum value directly, instead of a boolean, so that we can just store
that enum value directly on the ViewImplementation class.
2024-11-13 20:36:47 +01:00
Shannon Booth
c04b14d0cb LibWeb: Use alternative workaround for null strategy algorithm on abort
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
This unfortunately caused a regression for the included WPT test.
Instead of reordering the spec step, fall back to the default size
strategy of 1.
2024-11-13 10:44:22 -05:00
Sam Atkins
c64521aa4f Tests: Remove duplicate skipped test 2024-11-13 10:43:40 -05:00
Timothy Flynn
47543b7076 LibWeb: Disable HTTP server test
Occasionally seeing this time out.
2024-11-13 10:43:23 -05:00
Sam Atkins
a6822986bb LibWeb/Painting: Apply clip and mask operations that are off-screen
These operations should still apply even if they are off screen, because
they affect painting of things outside of their bounding rectangles.

This commit makes us always apply these, regardless of if they are in
the visible region. However, if they are outside that region, we
replace them with simple clip-rect commands, which have the same
effect (not painting anything) but are cheaper than computing a full
mask bitmap.
2024-11-13 16:10:15 +01:00
Timothy Flynn
3e5476c9e0 LibWeb: Guard MediaQueryList event listener removal against null
A recently imported WPT test has a subtest that effectively does the
following:

    const mql = window.matchMedia("");
    mql.removeListener(null);
2024-11-13 14:59:14 +01:00
Timothy Flynn
213155ad7d LibWeb: Use GCPtr in MediaQueryList 2024-11-13 14:59:14 +01:00
Luke Wilde
4dd14d812f LibWeb: Make iframe insertion steps check the shadow including root
The insertion steps for iframes were following an old version of the
spec, where it was checking if the iframe was "in a document tree",
which doesn't cross shadow root boundaries. The spec has since been
updated to check the shadow including root instead.

This is now needed for Cloudflare Turnstile iframe widgets to appear,
as they are now inserted into a shadow root.
2024-11-13 14:40:02 +01:00
Luke Wilde
6df4e5f5e7 LibWeb: Actually traverse the shadow root of the inclusive descendant
Previously, the inclusive descendant, which is the node that
for_each_shadow_including_inclusive_descendant was called on, would not
have it's shadow root traversed if it had one.

This is because the shadow root traversal was in the `for` loop, which
begins with the node's first child. The fix here is to move the shadow
root traversal outside of the loop, and check if the current node is an
element instead.
2024-11-13 14:40:02 +01:00
Tim Ledbetter
d3c21e4038 LibWeb: Copy bitmap onto the returned canvas when taking a screenshot 2024-11-13 14:38:39 +01:00
Tim Ledbetter
b08f12d3e6 LibGfx: Add a method to copy a Bitmap to a PaintingSurface 2024-11-13 14:38:39 +01:00
Jelle Raaijmakers
3d8ab0e67c LibWeb: Add WebGLShaderPrecisionFormat
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-13 11:41:54 +01:00
Jelle Raaijmakers
d63a979bde LibWeb: Add WebGLActiveInfo 2024-11-13 11:41:54 +01:00
Jelle Raaijmakers
889e7942fa LibWeb: Add WebGLUniformLocation 2024-11-13 11:41:54 +01:00
Jelle Raaijmakers
f2a1643650 LibWeb: Add WebGLTexture 2024-11-13 11:41:54 +01:00
Jelle Raaijmakers
2b09afb971 LibWeb: Add WebGLShader 2024-11-13 11:41:54 +01:00
Jelle Raaijmakers
d53cb9833b LibWeb: Add WebGLRenderbuffer 2024-11-13 11:41:54 +01:00
Jelle Raaijmakers
6b7d5dbec6 LibWeb: Add WebGLProgram 2024-11-13 11:41:54 +01:00
Jelle Raaijmakers
5d0b206d6e LibWeb: Add WebGLFramebuffer 2024-11-13 11:41:54 +01:00
Jelle Raaijmakers
b21857b265 LibWeb: Add WebGLBuffer 2024-11-13 11:41:54 +01:00
Jelle Raaijmakers
e6ee7f3e64 LibWeb: Add WebGLObject interface 2024-11-13 11:41:54 +01:00
Jelle Raaijmakers
e8d91f2234 LibWeb: Add missing RGBA8 constant to WebGLRenderingContext 2024-11-13 11:41:54 +01:00
Michael Watt
3b1d1d4582 LibWeb: Compute display: contents as none for unusual elements
https://drafts.csswg.org/css-display-3/#unbox-html specifies certain
elements that have their `display` style computed as `none` when
specified as `contents`.

This fixes at least one WPT test:
http://wpt.live/css/css-display/display-contents-suppression-dynamic-001.html
2024-11-13 11:11:07 +01:00
Shannon Booth
eef9a53eec LibJS: Make Heap own its own StackInfo instance
While this does mean that we keep one copy of the stack info in the VM,
and another in the Heap; keeping a separate instance removes one more
instance of coupling between the heap and LibJS specific details.
2024-11-13 11:08:35 +01:00
Shannon Booth
d199bf60cf LibJS: Do not clear VM's string cache in Heap's destructor
There is definitely a possibility I am misunderstanding the reason
behind it - but this does not appear neccessary. The VM owns both the
string cache and Heap. On destruction, the VM should clear out both
the heap and its string cache.
2024-11-13 11:08:35 +01:00
Shannon Booth
cf27eef583 LibJS: Move WeakContainer into the Heap folder
While this is used in the implementation of Runtime objects itself, Heap
seems like a more appropriate home. This will also help in factoring out
the GC implementation into it's own library as the heap explicitly has
knowledge of WeakContainer.
2024-11-13 11:08:35 +01:00
Shannon Booth
2f6bcb3538 LibJS: Remove some unused runtime headers from Heap folder 2024-11-13 11:08:35 +01:00
Shannon Booth
520aa04092 LibJS: Move Handle's Value specialization to Value header
This is part of an effort to keep JS runtime specifics outside of the
Heap implementation.
2024-11-13 11:08:35 +01:00