Commit graph

74063 commits

Author SHA1 Message Date
Andreas Kling
c1a3cf1290 AK: Add FixedBitmap template class for stack-allocated bitmaps
This is a simple bitmap class that stores its data in a fixed-size
array on the stack, avoiding heap allocation for small, known-size
bitmaps.
2026-01-14 11:46:23 +01:00
Gingeh
eedc358080 Meta: Add test-dumps to the .gitignore 2026-01-14 00:29:16 +01:00
Andreas Kling
794ba270a2 test-web: Improve WebContent crash handling
Two fixes for crash handling:

1. Re-setup output capture after WebContent respawns. When WebContent
   crashes, a new process is spawned with new stdout/stderr pipes.
   We need to set up new notifiers to drain them, otherwise the new
   WebContent blocks on write() when its pipe buffer fills up.

2. Disconnect child view crash handlers between tests. Child views
   (from window.open, iframes, etc.) persist after a test completes.
   If they crash later, we don't want that to affect subsequent tests.
2026-01-13 23:57:46 +01:00
Andreas Kling
07138af5ef test-web: Fix ref test timeout timer getting destroyed prematurely
The timeout timer for ref tests was stored in a local variable that
went out of scope when run_ref_test() returned, causing the timer to
be destroyed before it could fire.

Store the timer in test.timeout_timer (like dump tests already do)
so it persists until the test completes.
2026-01-13 23:57:46 +01:00
Andreas Kling
419afa544c LibWebView: Notify all views when shared WebContent crashes
When multiple views share a WebContent process (e.g. parent and child
views created via window.open()), we need to notify ALL of them when
the process crashes, not just one.

Previously, each view would overwrite the single crash callback on
WebContentClient, so only the last view to initialize would be notified.

This adds WebContentClient::notify_all_views_of_crash() which iterates
over all registered views and notifies each one. Child views also now
propagate crashes to their parent, and can be disconnected between
tests to prevent stale crashes from affecting subsequent tests.
2026-01-13 23:57:46 +01:00
Andreas Kling
d48ba83954 IPCCompiler: Silently ignore async message send failures
Async IPC messages are fire-and-forget by design. If the peer has
disconnected (e.g. crashed), attempting to send will fail, but there's
nothing meaningful we can do about it.

Change the generated code from MUST() to (void) so we don't crash when
trying to send async messages to a dead peer.
2026-01-13 23:57:46 +01:00
Andreas Kling
bbcdb927b2 test-web: Disable output capture notifiers on EOF
When a WebContent process crashes, its stdout/stderr pipes will signal
POLLHUP. The output capture notifiers were not handling this case,
causing the event loop to spin at 100% CPU as poll() kept returning
immediately with POLLHUP set.

Fix by disabling the notifiers when read() returns 0 or an error.
2026-01-13 23:57:46 +01:00
Andreas Kling
ae8f723ba0 test-web: Show live pass/fail/skip counts in TTY mode
Display a color-coded status line showing test results as they come in.
This makes it easy to see at a glance how the test run is progressing.
2026-01-13 23:57:46 +01:00
Andreas Kling
dd51748708 test-web: Don't use FileSystem::copy_file_or_directory on Windows
This function isn't implemented for Windows. Use a simple read/write
approach instead.
2026-01-13 21:05:58 +01:00
Andreas Kling
72a2205b64 test-web: Skip view operations after WebContent crash
After a WebContent process crashes, the view's client is no longer
valid. Calling reset_zoom() would attempt to send IPC messages to the
dead process. Skip this operation when the test result indicates a
crash.
2026-01-13 21:05:58 +01:00
Andreas Kling
7f40f549e1 LibWebView: Improve WebContent crash handling in headless mode
This commit makes several improvements to crash handling for headless
mode (used by test-web and other automated tools):

1. Always respawn WebContent after crashes, ignoring the crash count
   limit. The limit is meant for interactive use to prevent infinite
   crash loops; in headless mode, each test needs a working WebContent.

2. Skip the error page when respawning, as there's no UI to display it.

3. Suppress crash log messages that would corrupt live terminal output.

These changes allow test-web to properly recover from WebContent crashes
and continue running subsequent tests.
2026-01-13 21:05:58 +01:00
Andreas Kling
24afab20cc LibWebView: Defer process cleanup to avoid signal handler deadlock
When a child process exits, the SIGCHLD handler was destroying the
Process object synchronously within the signal dispatch context. This
triggered Process::~Process() which called m_connection->shutdown(),
attempting to join the IPC IO thread.

Joining threads from within signal handler context can cause deadlocks,
as observed when WebContent crashes during test-web runs.

Fix this by deferring the on_process_exited callback using
Core::deferred_invoke(), ensuring the Process destruction happens in
normal event loop context.
2026-01-13 21:05:58 +01:00
Andreas Kling
dacd6b4530 LibIPC: Handle EAGAIN on non-blocking wakeup pipe read
The wakeup pipe is created with O_NONBLOCK, but MUST() was used for
reads. This could cause crashes on spurious wakeups when EAGAIN is
returned. Since the read is just to drain the pipe and wake the IO
thread, we can safely ignore any errors.
2026-01-13 21:05:58 +01:00
Andreas Kling
3c69d7bc33 test-web: Improve HTML results viewer with colorized diffs
- Generate colorized HTML diff files (.diff.html) alongside plain text
  diffs (.diff.txt) for each failing test
- Add total test count to results summary
- Improve the results-index.html viewer with a dark theme, keyboard
  navigation, search/filter, and tabbed interface for viewing diffs,
  expected/actual output, and stdout/stderr
- Move s_total_tests assignment outside live display block so it's
  always set
2026-01-13 21:05:58 +01:00
Andreas Kling
b5e01df79d test-web: Add results directory and live terminal display
- Add --results-dir CLI flag to specify output directory
- Default to {tempdir}/test-web-results if not specified
- Capture stdout/stderr from all helper processes (WebContent,
  RequestServer, ImageDecoder) to prevent output spam
- Save captured output to per-test files in results directory
- Save test diffs (expected vs actual) to results directory
- Generate HTML index of failed tests with links to diffs
- Display live-updating concurrent test status with progress bar
- Defer warning messages until after test run completes
2026-01-13 21:05:58 +01:00
Andreas Kling
0e6f2cb734 LibCore: Add pipe2() implementation for Windows
This is needed by LibWebView's process output capture feature.
2026-01-13 21:05:58 +01:00
Andreas Kling
568758e55a LibCore: Fix Windows build for STDOUT_FILENO/STDERR_FILENO macros
Wrap the _get_osfhandle() return value with to_fd() to convert from
intptr_t to int, fixing a narrowing conversion error on Windows.
2026-01-13 21:05:58 +01:00
Andreas Kling
3f6358b992 Tests: Skip flaky css-shapes tests for now
Tests became flaky after 668d3afde0.
2026-01-13 20:35:16 +01:00
Timothy Flynn
b517e5b947 LibJS: Avoid sign negations in Temporal's DifferenceZonedDateTime
This is an editorial change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/407fa01
2026-01-13 13:02:22 -05:00
Timothy Flynn
3eabdcf460 LibJS: Replace Temporal's BalanceISODate with AddDaysToISODate
This is an editorial change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/b28ef08
2026-01-13 13:02:22 -05:00
Christoffer Haglund
14ccc87190 LibWeb: Address edge case on async module load
Issue #6294 describes an edge case where the browser crash if the same
module is loaded three times in a document, but all attempts fail.

Failure scenario:
1. Module load 1 set the state to "Fetching"
2. Module load 2 registers a callback to `on_complete` since the
   current state is "Fetching"
3. Module load 1 finish with a failure, invoking the callback for load
   number 2
4. Module load 3 cause a crash. The state is neither "Fetching" or
   "ModuleScript", so we'll reset the state to "Fetching". This invokes
   the callback for module load 2 again, now with an unexpected state
   which will cause an assert violation.

Proposed fix is to remove the condition that invokes `on_complete`
immediately for successfully loaded modules only, the callback should
be invoked regardless of whether the fetch succeeded or failed.

This reveals a separate bug in HTMLScriptElement, where
`mark_as_ready()` can be invoked before
`m_steps_to_run_when_the_result_is_ready` is assigned.
This appears to be a spec bug, reported as
https://github.com/whatwg/html/issues/12073 and addressed by delaying
the callback by a task, similar to the issue was resolved for inline
scripts.
2026-01-13 18:12:38 +01:00
Shannon Booth
1106496d1c LibWeb/HTML: Ensure data: URL workers are same-origin with themselves
See: https://github.com/whatwg/html/commit/baff3f5
2026-01-13 16:59:54 +01:00
Shannon Booth
6107775ebe WebWorker: Move hack for initializing global scope's URL even earlier
In the next commit, we will rely on global scope's URL being
initialized even earlier in the process of setting up the environment
for the Worker global. Move this hack just before that.
2026-01-13 16:59:54 +01:00
dependabot[bot]
cc4f7375ae CI: Bump JamesIves/github-pages-deploy-action from 4.7.6 to 4.8.0
Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.7.6 to 4.8.0.
- [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases)
- [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.7.6...v4.8.0)

---
updated-dependencies:
- dependency-name: JamesIves/github-pages-deploy-action
  dependency-version: 4.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-13 16:20:50 +01:00
Sam Atkins
692760b109 LibWeb/CSS: Update links to css-scoping and css-shadow-parts specs
These have been merged together into a new "CSS Shadow Module" spec. No
behaviour changes.

Corresponds to:
80d140567a
2026-01-13 16:18:11 +01:00
Gingeh
fbde887cc8 LibWeb: Remove API URL character encoding
See https://github.com/whatwg/html/pull/9755/
2026-01-13 13:51:32 +00:00
Gingeh
68a349974c LibWeb: Update XHR::open to use 'encoding-parse a URL'
See https://github.com/whatwg/xhr/pull/382
2026-01-13 13:51:32 +00:00
Psychpsyo
fe2bc2bfe7 LibWeb: Improve scrollingElement handling
This change is currently entirely undetectable because of what the
added FIXME talks about. Currently, the HTML element's overflow is
always set to visible in both axes, so it getting set to "clip" in
the imported test ends up not mattering at all.
2026-01-13 11:47:13 +00:00
Tim Ledbetter
03f262f03d LibWeb: Normalize rotate3d() axis vector when computing transform matrix 2026-01-13 12:40:55 +01:00
Callum Law
668d3afde0 LibWeb: Properly parse attributes for CSS-connected FontFace
Previously we would just set the attributes to the serialized
descriptors, even if they were the empty string.

We now apply defaults when we have empty descriptors and apply parsing
logic from the various `set_*` methods (only applicable to `font-family`
so far where we now extract the value from either a string or a
custom-ident)

Fixes an issue in some css/css-shapes WPT tests where we weren't
properly matching fonts.
2026-01-13 10:40:00 +00:00
Callum Law
bbfe7c64fe LibWeb: Disconnect font face if descriptor change makes it invalid 2026-01-13 10:40:00 +00:00
Callum Law
9af90f81bf LibWeb: Use correct base-url for CSS-connected FontFace
Previously we would always try to load the font URL relative to the
document's base URL. This commit means that for CSS-connected
`FontFace`s we now try to load relative to the URL of the stylesheet
that contains the associated `CSSFontFaceRule`
2026-01-13 10:40:00 +00:00
Callum Law
3996d9ec82 LibWeb: Support setting FontFace::family with StringStyleValue 2026-01-13 10:40:00 +00:00
Callum Law
06313acac0 LibWeb: Store updated attributes directly within FontFace
The spec states that updates to descriptors in a `@font-face` rule
should be reflected in the connected `FontFace`'s attributes.

Previously this was achieved by directly accessing those descriptors
when calling the attribute getters, but this has a couple of issues:
 a) The changes are only reflected if we use the accessors (i.e.
    `FontFace::family()` rather than `FontFace::m_family`) which isn't
     the case everywhere
 b) The changes aren't persisted after the `FontFace` is disconnected
    from it's `CSSFontFaceRule`

To fix these issues we now reparse and store the `FontFace`'s attributes
whenever the `CSSFontFaceRule`'s descriptors change.
2026-01-13 10:40:00 +00:00
Callum Law
df03c31e13 LibWeb: Don't crash when serializing @font-face without font-family 2026-01-13 10:40:00 +00:00
Callum Law
e114c7341e LibWeb: Support <custom-ident> in FontFaceSet::load()
This exposed a false positive in our test suite which has been fixed and
made more robust
2026-01-13 10:40:00 +00:00
Callum Law
9b20fe6902 LibWeb: Promote font-style to ValueType
This means we now allow oblique angles when parsing the `font`
shorthand.

This also required us to rename the existing `FontStyle` enum to
`FontStyleKeyword`
2026-01-13 10:21:26 +00:00
Callum Law
1c1476f728 LibWeb: Don't compute font-feature-settings until compute-time
Previously we applied the computation logic (i.e. deduplication and
sorting of tags) at parse time
2026-01-13 10:21:26 +00:00
Callum Law
3a515fd3ee LibWeb: Ignore initial keyword when serializing font shorthand
We know that none of the longhands contain CSS-wide keywords since that
is handled as the first step of `ShorthandStyleValue::serialize()`
2026-01-13 10:21:26 +00:00
Callum Law
252e1d86bd LibWeb: Dont serialize font with non-initial reset-only sub-properties 2026-01-13 10:21:26 +00:00
Tim Ledbetter
49f8fafc2e LibWeb: Treat content-visibility auto as non-hidden in interpolation
This matches the interpolation behavior of the `visibility` property
and of other engines.
2026-01-13 10:49:31 +01:00
Shannon Booth
9eabaa6833 LibWeb/HTML: Set correct length for cross-origin wrapper functions 2026-01-13 10:11:31 +01:00
Shannon Booth
399c62933a LibWeb/HTML: Set correct name for cross-origin wrapper functions 2026-01-13 10:11:31 +01:00
Shannon Booth
d49939e230 LibWeb/HTML: Do not capture GC::Roots in cross origin function objects
JS::NativeFunction should be GC safe, so we should not be capturing
GC roots as it may cause memory leaks.
2026-01-13 10:11:31 +01:00
Jelle Raaijmakers
018fed547c LibWeb: Move onpointer* IDL attributes to PointerEventHandlers.idl
A separate file is used instead of adding the partial interface mixin
to PointerEvent.idl to avoid a circular import dependency.
2026-01-13 10:09:22 +01:00
Jelle Raaijmakers
aed9f6a395 LibWeb: Move onanimation* IDL attributes to AnimationEvent.idl
Use the newly added `partial interface mixin` support to move the
CSS animation event handler attributes to their proper location as
specified in CSS Animations Level 1.
2026-01-13 10:09:22 +01:00
Jelle Raaijmakers
d025e14cb4 LibIDL: Add support for partial interface mixin
This adds parsing support for `partial interface mixin` as specified
in WebIDL. Partial mixins are merged into their corresponding mixins
before the mixins are resolved into interfaces.
2026-01-13 10:09:22 +01:00
Jelle Raaijmakers
0cd1d4f08e Tests/LibWeb: Import WPT designMode-caret-change.html crash test
With both the onanimation* handlers and the designMode fixes in place,
this crash test no longer times out.
2026-01-13 10:09:22 +01:00
Jelle Raaijmakers
1bef8b259a LibWeb: Create selection range when enabling designMode
Previously, setting designMode to "on" would only modify the selection
range if one already existed. Since selections start empty, this meant
no range was created and no selectionchange event was fired.

Use Selection::collapse() instead, which creates a new range if needed
and properly triggers the selectionchange event.
2026-01-13 10:09:22 +01:00
Jelle Raaijmakers
64f1e6e11a LibWeb: Add onanimation* event handler IDL attributes
Add these animation event handlers to GlobalEventHandlers:
- onanimationcancel
- onanimationend
- onanimationiteration
- onanimationstart

They were missing, causing `window.onanimationend = ...` style
assignments to silently fail.
2026-01-13 10:09:22 +01:00