Commit graph

79023 commits

Author SHA1 Message Date
Jelle Raaijmakers
168ecb2e7d Everywhere: Update contribution guidelines
We've closed down the public PR route:

  https://ladybird.org/posts/changing-how-we-develop-ladybird/

Update our guidelines and documentation to reflect this.
2026-06-05 10:20:15 +02:00
dependabot[bot]
50892d7370 CI: Bump actions/checkout from 6.0.2 to 6.0.3
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.2 to 6.0.3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6.0.2...v6.0.3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-05 09:21:33 +02:00
Andreas Kling
3f4f0f0c02 Utilities: Keep wasm event loop alive
Create the wasm utility event loop with
Core::EventLoop::initialize_for_current_thread() so it follows the same
process-lifetime model as other program main loops.
2026-06-05 09:18:39 +02:00
Andreas Kling
ab5709edfd LibCore: Tighten EventLoop current-loop checks
Make EventLoop::current() enforce the presence of a current event loop
directly, and make EventLoop::pump() verify that it is pumping the
current thread event loop. This keeps the one-loop-per-thread invariant
explicit across the public EventLoop entry points.
2026-06-05 09:18:39 +02:00
Andreas Kling
789d7cba48 LibWeb: Use direct references to main event loops
Post off-thread font, script, and DNS completion work back to direct
Core::EventLoop references. These callbacks target the process main
loop, which is intentionally kept alive for the lifetime of the
process.
2026-06-05 09:18:39 +02:00
Andreas Kling
aad293dacc LibMedia: Use direct references to main event loops
Pass direct Core::EventLoop references through media producer and
playback plumbing that posts work back to the main thread. The browser
process main loops stay alive for the process lifetime, so these paths
no longer need weak event loop references.

Update LibMedia tests to pass their stack event loop directly to the
producer helpers.
2026-06-05 09:18:39 +02:00
Andreas Kling
b51fde39a2 Services: Use direct references to main event loops
Store direct Core::EventLoop references in WebDriver and the
Compositor when callbacks post back to the process main loop. The
main event loop is intentionally kept alive for the lifetime of these
services, so these paths no longer need WeakEventLoopReference guards.
2026-06-05 09:18:39 +02:00
Andreas Kling
83b293e4f2 LibCore: Keep main event loops alive
Add an explicit initializer for process-lifetime event loops and use it
for browser, helper service, and utility main loops. This preserves weak
event loop references for cross-thread users while making main thread
loop lifetime independent of normal program teardown.
2026-06-05 09:18:39 +02:00
Andreas Kling
02b205361d LibCore: Remove nested EventLoop support
Replace the per-thread EventLoop stack with a single thread-local
pointer. Constructing an EventLoop now requires that the current thread
does not already have one, and exec() and spin_until() operate only on
that current loop instead of pushing a temporary nested loop.

LibLine was the last user that needed nested Core event loops, so the
stack allocation and pthread cleanup machinery can go away.
2026-06-05 00:09:37 +02:00
Andreas Kling
dfb2656d9c Utilities: Replace LibLine with libedit
Use libedit's readline-compatible interface for the JavaScript REPL so
line editing, history, and tab completion no longer depend on LibLine.
The REPL keeps its existing multiline input and completion behavior,
but no longer provides LibLine's live syntax highlighting.

Remove the unused LibLine dependency from the wasm utility and delete
the LibLine library from the build now that it has no remaining
consumers.
2026-06-05 00:09:37 +02:00
Ali Mohammad Pur
08221aebab LibWasm: Start execution immediately after validation
This adds a tier-up mechanism at loop edges, making it so we can
seamlessly (ish) transition between interpreted and native code so we
can start running wasm code immediately after validation while
compilation happens in the background, and switching to native code
eventually once we hit a big enough function that would benefit from
being compiled to begin with.
2026-06-05 00:08:11 +02:00
Ali Mohammad Pur
3c89c36158 LibWasm+LibWeb: Restore disk cache for compiled wasm modules
Also untangle the confusing validation layering on async compilation.
2026-06-05 00:08:11 +02:00
Timothy Flynn
85c7620805 UI/Qt: Collapse hover-expanded vertical tabs after leaving window
When collapsed vertical tabs are expanded on hover, the collapse check
used QCursor::pos() against the vertical tabs rect. On some platforms,
after the cursor leaves the browser window entirely, that position can
remain at the last in-window coordinate, so the tabs stay expanded.
2026-06-04 22:16:16 +01:00
Sam Atkins
879fc69f89 LibWeb/CSS: Link DevTools rules to UA stylesheets
UA and user stylesheets do not have owner nodes or owner rules, so their
matched rules cannot be mapped through the generic stylesheet identifier
helper. Share the built-in UA stylesheet enumeration and map UA rules by
the matched CSSStyleSheet object, so that they stay in sync with any
future changes.
2026-06-04 20:54:33 +01:00
Sam Atkins
64e0aa8c26 LibWeb+LibDevTools: Link style rules to CSS sources
Resolve applied-rule stylesheet identities through StyleSheetsActor and
include Firefox parentStyleSheet, line, and column fields on rule forms.
Firefox can then show matched rules as stylesheet rules and open the
corresponding CSS source location from the Rules panel.
2026-06-04 20:54:33 +01:00
Sam Atkins
b2b164ebd7 LibWeb+WebContent: Report CSS rule source data
Include parser rule locations and stylesheet identities in the applied
style rule data sent to DevTools. This gives the protocol layer enough
information to map matched rules to existing stylesheet resources
without guessing from displayed rule text.
2026-06-04 20:54:33 +01:00
Sam Atkins
52e1d30404 LibWeb+LibDevTools: Report applied style rules to Firefox
Collect the style rules that apply to an inspected element and expose
them through the existing DOM node inspection path. This gives Firefox's
Rules panel real rule forms instead of the previous empty getApplied
response.
2026-06-04 20:54:33 +01:00
Sam Atkins
121105eb83 LibWebView+WebContent: Pass DOM inspection options
Extend the existing DOM node inspection request with an options payload
and carry it through the browser process, WebView, IPC, and WebContent.
This lets later DevTools requests forward Firefox's top-level flags
without changing any inspected-node behavior yet.
2026-06-04 20:54:33 +01:00
Sam Atkins
1b3296b574 LibDevTools: Avoid stale callbacks during server teardown
DevTools server callbacks can outlive the server when deferred work is
queued during connection shutdown. Capture weak pointers for those tasks
and clear socket callbacks while the server is being destroyed so later
actor cleanup cannot touch freed state.

Add protocol coverage that destroys a server with deferred actor cleanup
pending, before adding the style-rule actor path that depends on this.
2026-06-04 20:54:33 +01:00
Sam Atkins
39106f9326 LibWeb/CSS: Parse authored declarations for DevTools
Add a parser entry point that preserves authored CSS declarations for
DevTools. The Rules panel needs the original property names, shorthand
values, invalid declarations, custom properties, and !important flags
rather than only the expanded computed representation.
2026-06-04 20:54:33 +01:00
Sam Atkins
ee24561ab4 LibWeb/CSS: Store source positions on CSS rules
DevTools needs rule-level source positions to link applied style
rules back to their source sheets. The parser already tracks token
line and column information, so carry that through qualified rules
and nested declarations when creating CSSRule objects.
2026-06-04 20:54:33 +01:00
Sam Atkins
df41e7a1cf LibWeb/CSS: Move Token::Position into SourcePosition
There's nothing about this that's specific to Tokens, and moving it
makes it easier to use for other types. We'll need this for the
following commits.
2026-06-04 20:54:33 +01:00
Sam Atkins
18ac54a402 LibWeb: Invalidate styles for scoped imports
Include scoped import start and end selectors in stylesheet selector
insights, and treat scoped `@import` additions or removals as broad
stylesheet invalidation triggers. Scoped import boundaries can change
which descendants match imported rules, so add/remove invalidation
cannot rely only on the imported style rule selectors.

Add local coverage for changing an import-scope root, changing an end
boundary, replacing or removing a scoped import rule, selector-insight
tracking, and stylesheet removal invalidation.
2026-06-04 20:52:28 +01:00
Sam Atkins
85e14f5f1f LibWeb: Apply scopes from imported stylesheets
Treat a scoped `@import` rule as a scope descriptor while traversing
style-producing rules from imported stylesheets. Imported rules now
inherit an outer scope for unscoped imports and replace it when the
import itself carries scope(...).

Scope resolution was generalized to handle both CSSScopeRule and
CSSImportRule descriptors. Import-scope boundaries are matched using
the stylesheet that parsed the `@import` rule, while normal imported
selectors keep using the imported stylesheet context. This lets
implicit scopes, nested `@scope` rules, :scope, and top-level `&` behave
as the Cascade 6 model requires.
2026-06-04 20:52:28 +01:00
Sam Atkins
538dca4448 LibWeb: Parse scoped CSS import rules
Parse and store the optional `scope` clause in `@import` preludes.

WPT doesn't directly test the serialization behaviour for this, so add a
custom test for it.
2026-06-04 20:52:28 +01:00
Sam Atkins
bec9b35e56 Tests: Import WPT coverage for scoped imports
Import the scoped `@import` WPT testharness tests and their shared
stylesheet resource. This records the upstream coverage before the
LibWeb implementation changes, so the parser, matching, and
invalidation commits can be reviewed against a stable baseline.

This commit intentionally avoids nearby reftests, because the direct
scoped-import coverage in this WPT checkout is testharness-based and
ref tests should only be imported after confirming that they pass.
2026-06-04 20:52:28 +01:00
Andreas Kling
d1d9d14dc5 Compositor: Terminate immediately on client disconnect
Keep notifying connected WebContent clients that the compositor is
gone, but terminate the Compositor process without running exit-time
destructors after the controlling client disconnects.
2026-06-04 19:20:49 +02:00
Andreas Kling
83a69706de ImageDecoder: Terminate immediately after last client disconnects
Keep the existing per-client cleanup and background thread shutdown,
but use Core::Process::terminate_immediately() once the final decoder
client is gone. This avoids running exit-time destructors during
ImageDecoder shutdown.
2026-06-04 19:20:49 +02:00
Andreas Kling
0e88314e5e WebWorker: Terminate immediately on client disconnect
Use Core::Process::terminate_immediately() when the owning client goes
away, matching WebContent and avoiding exit-time destructor work in the
worker process shutdown path.
2026-06-04 19:20:49 +02:00
Andreas Kling
26de1ca600 WebContent: Terminate immediately on client disconnect
Use Core::Process::terminate_immediately() when the UI process goes
away or a sync IPC request fails because the client disconnected. This
avoids running exit-time destructors during WebContent shutdown.

Enable -Wexit-time-destructors for the WebContent executable and
service target, then convert the existing warning sites to permanent
process lifetime storage.
2026-06-04 19:20:49 +02:00
Andreas Kling
164ed80244 Meta: Enable exit-time destructor warnings for libraries
Enable -Wexit-time-destructors for all in-tree library targets and
update process-lifetime library statics so they no longer register
exit-time destructors. Long-lived caches, lookup tables, singleton
registries, and generated constants now use NeverDestroyed or leaked
references where the data is intended to live until process exit.

Update LibWeb, LibLine, and the binding generators so regenerated
sources follow the same rule instead of reintroducing destructed
statics.
2026-06-04 19:20:49 +02:00
Andreas Kling
8c7b5b4de6 LibCore: Add immediate process termination helper
Add Core::Process::terminate_immediately() as the shared primitive
for terminating a process without running exit-time destructors. Use
_exit() on POSIX and TerminateProcess() on Windows.
2026-06-04 19:20:49 +02:00
InvalidUsernameException
2635c334b0 test-web: Exit more gracefully if --test-path is not provided 2026-06-04 17:52:59 +02:00
InvalidUsernameException
8e21673577 test-web: Do not crash test runner on missing ref-test expectation file
Individual tests should not be able to crash the runner. Instead simply
fail the test in question.
2026-06-04 17:52:59 +02:00
InvalidUsernameException
22866843bf Tests/LibWeb: Remove test expecation links from test expectations
These don't do anything and all look like copy-paste mistakes.
2026-06-04 17:52:59 +02:00
François Guerraz
f756219841 LibDNS: Reject domain name labels longer than 63 octets
A DNS label length octet is a 6-bit value, so a label can be at most 63
octets. Several code paths violated this and aborted the process:

- DomainName::from_raw() treated any length octet that was not a
  compression pointer as an ordinary label, including the reserved
  0b01/0b10 top-bit encodings, yielding labels of up to 191 octets.
- DomainName::to_raw() then VERIFY-aborted on any label longer than 63
  octets while encoding it back to the wire.
- Resolver::lookup() encoded the outgoing query with MUST(to_raw(...)),
  so even once to_raw() fails gracefully the MUST would still abort.

Together these crash RequestServer, which drives DNS for the whole
browser. When a custom resolver is configured (e.g. --dns-server), a web
page that references a host name containing a label longer than 63
characters aborts RequestServer while the query is encoded. A response
carrying a reserved-length label is also accepted by the parser and then
aborts when the name is re-encoded (for example during DNSSEC
validation).

Reject over-long labels when parsing, return an error instead of
aborting when encoding, and reject the lookup promise instead of
MUST-aborting at the query call site.
2026-06-04 17:41:09 +02:00
Sam Atkins
4ad7f06099 Revert "LibWeb: Delay load event during CSS @import fetch"
This reverts commit 1e0f6d1f7c.

Now that style sheets can block scripts, we don't need this additional
load delayer.
2026-06-04 16:39:54 +01:00
Sam Atkins
89bdc5f889 LibWeb/SVG: Apply parser-created style timing
Let SVGStyleElement delegate style updates through StyleElementBase so
parser-created inline SVG `<style>` elements update when they are popped
from the parser stack, just like HTML style elements.

This lets SVG style imports participate in script-blocking stylesheet
checks while keeping dynamic text, type, and media changes from
re-blocking parser scripts.
2026-06-04 16:39:54 +01:00
Sam Atkins
5d566040d6 LibWeb/DOM: Evaluate style media for script blocking
Evaluate the associated stylesheet's media queries when a parser-created
`<style>` sheet is created, and re-evaluate them when the media
attribute changes.

This lets HTMLStyleElement::contributes_a_script_blocking_style_sheet()
honor the media clause from the HTML script-blocking rules. A
still-loading parser-created style is removed from the script-blocking
set as soon as its media no longer matches.
2026-06-04 16:39:54 +01:00
Sam Atkins
bb4f8a6621 LibWeb: Track parser-created style sheets
Create parser-blocking style sheets when parser-created `<style>`
elements are popped from the stack of open elements, and ignore dynamic
style updates while those elements are still open in the parser.

Make the shared style-element script-blocking predicate describe the
active style sheet instance. Stale script-blocking entries are removed
when that style sheet is replaced or removed.
2026-06-04 16:39:54 +01:00
Sam Atkins
c1953f93c7 LibWeb: Move style element hooks to StyleElementBase
Move HTMLStyleElement's dynamic update handling, media/type attribute
handling, and script-blocking predicate skeleton into StyleElementBase
so style elements can share that plumbing.
2026-06-04 16:39:54 +01:00
Sam Atkins
5cc0e1408a LibWeb/CSS: Treat non-matching @import supports() as loaded
Mark `@import` rules whose supports() condition is false as loaded
before returning from fetch(). These rules do not fetch a stylesheet,
but they still participate as critical subresources of the parent
sheet.

Leaving them Unloaded kept parser-created `<style>` blocks waiting for
critical subresources that can never finish, which blocked following
parser scripts forever.
2026-06-04 16:39:54 +01:00
Rocco Corsi
e3e78f4372 AK: Verify datetime fetching results and initialize struct tm
Cppcheck 2.17 tool found issue with struct tm under Windows

Checking AK/Time.cpp ...
Checking AK/Time.cpp: AK_OS_WINDOWS...
AK/Time.cpp:488:15: error: Uninitialized variable: &tm [uninitvar]
        (void)localtime_r(&timestamp, &tm);
              ^
32/39 files checked 87% done

Also the gmtime_X` and localtime_X calls were not checked for failures,
so those are now checked too.
2026-06-04 17:32:49 +02:00
Sam Atkins
d3e7a332b3 Tests: Make srcdoc content blocker test deterministic
This test previously did not wait for the iframe to load before it read
its contentDocument, meaning it would sometimes read the blank default
document instead. Add an explicit listener for the iframe's load event,
to make this more predictable.

Also simplify the test by setting the base URL instead of spinning up an
echo server.
2026-06-04 23:44:18 +09:00
Callum Law
4730493667 LibWeb: Apply body attribute link colors as presentational hints
Previously we overrode the resolved values of the `activetext`,
`linktext`, and `visitedtext` system colors based on the values of the
body's `alink`, `link`, and `vlink` attributes respectively.

This was incorrect and the spec instead expects us to apply these to the
relevant link elements as presentational hints while leaving those
colors untouched for other users.
2026-06-04 16:14:05 +02:00
Callum Law
843bd808cf LibWeb: Move `:visited: matching into helper method
And add spec text to explain why it never does.

We will be checking whether the `:visited` pseudo class matches in more
places in a future commit so this avoids duplicating FIXMEs.
2026-06-04 16:14:05 +02:00
Callum Law
b1e3306a24 LibWeb: Remove "attempted pseudo-class match" machinery
This is no longer used anywhere after fa57975
2026-06-04 16:14:05 +02:00
Callum Law
65134fc5da LibWeb: Remove dead code around resolving accent-color <system-color>s
While the spec says that `accentcolor` and `accentcolortext` resolve
relative to the `accent-color` property this isn't implemented by any
other browsers.

This effectively reverts d04b745 but doesn't change behavior since that
was already done in 92897a1.
2026-06-04 16:14:05 +02:00
Tim Ledbetter
9de60cd4f9 LibWeb: Apply the text-anchor property to SVG textPath offset 2026-06-04 16:01:56 +02:00
Tim Ledbetter
ad7105b570 LibGfx+LibWeb: Implement SVGTextPathElement.startOffset 2026-06-04 16:01:56 +02:00