Commit Graph

922 Commits

Author SHA1 Message Date
Shannon Booth
91e7218c22 LibWeb/HTML: Enforce CORS-mode fetch when fetching Worker script
At some point, the FIXME mentioned has been fixed.
2026-04-05 09:52:25 +02:00
Shannon Booth
7f4600f0e9 LibWeb: Apply newTarget prototype in legacy factory constructors
Use WebIDL::set_prototype_from_new_target() in the handwritten Audio,
Image, and Option legacy factory constructors so subclassed
construction uses the correct prototype.

This corresponds to step 1.6 of:

https://webidl.spec.whatwg.org/#legacy-factory-functions
2026-04-05 02:09:39 +02:00
Tim Ledbetter
eb8943cd55 Tests: Remove imported WPT tests that have been deleted upstream 2026-04-04 23:36:58 +02:00
Tim Ledbetter
504a8e6d1d Tests: Resync imported WPT tests 2026-04-04 23:36:58 +02:00
Glenn Skrzypczak
e5dab9e1c7 LibWeb: Support WASM modules
This adds support for importing WASM modules in JavaScript and vice
versa.
2026-04-03 21:21:09 +02:00
Glenn Skrzypczak
7392d2a2f4 LibWeb: Support JSON modules
This adds support for importing JSON objects from JSON files in
javascript.
2026-04-03 21:21:09 +02:00
Glenn Skrzypczak
f1d3244b22 LibWeb: Support CSS modules
This adds support for importing CSS stylesheets from CSS files in
javascript.
2026-04-03 21:21:09 +02:00
Shannon Booth
379461e047 LibWeb: Make global prototype chains immutable
Per https://webidl.spec.whatwg.org/#interface-prototype-object any
global platform object should reject prototype changes (besides
from ShadowRealmGlobalScope), and interface prototype objects on
global prototype chains must be immutable.

We already handled parts of this on the globals themselves, but not
the full chain.

Also align some spec comments to the latest WebIDL spec.
2026-04-03 18:33:45 +02:00
Andreas Kling
17928fa13d LibWeb: Import WPT position-absolute-013 test
Import the css-flexbox abspos position-absolute-013 test from WPT so we
can track its current behavior locally.

The imported baseline currently has 432 subtests total, with 228
passing and 204 still failing.
2026-04-03 14:29:44 +02:00
Andreas Kling
a61a36b184 LibWeb: Import WPT tests for percentage size with indefinite containers
Import tests covering percentage size resolution when the containing
block has auto/indefinite size.
2026-04-03 14:29:44 +02:00
Andreas Kling
7a122c9767 LibWeb: Import WPT tests for percentage heights in flex and grid
Import flex percentage-heights-004 through -010 and -014 (ref tests),
and grid-percentage-rows-indefinite-height-001 and -002 (testharness).

The flex tests all pass. The grid indefinite-height tests have many
failures (16/120 pass and 0/4 pass respectively), reflecting known
gaps in our grid percentage row handling.
2026-04-03 14:29:44 +02:00
Psychpsyo
f4a86c8466 LibWeb: Implement enough of WebXR for xrSession_end test to pass 2026-04-03 13:14:33 +02:00
Timothy Flynn
b3bc5e7956 Tests/LibWeb: Import basic cache storage tests 2026-04-03 11:04:12 +02:00
Jelle Raaijmakers
38342b2ad3 LibWeb: Add valid normal and none keywords for position-anchor
The WPT test was updated from upstream, but still assumes a wrong
initial value of `none`.

Co-authored-by: Rob Ryan <rob@affclicks.com>
2026-04-01 19:41:46 +01:00
Psychpsyo
44ef574902 LibWeb: Properly set visibility state for nested documents
This cannot happen inside the Make Active algorithm, since that gets
called during document creation, which commonly happens before the
document's navigable is created.

Aligns us with a recent spec change and rids us of some AD_HOC
behavior.
2026-04-01 17:26:46 +02:00
Tim Ledbetter
5a05909eab LibWeb: Disallow animation properties inside keyframe declarations
We now ignore all animation properties from `css-animations-1` declared
within keyframes, except `animation-timing-function`, which is treated
specially.
2026-04-01 11:38:48 +01:00
Shannon Booth
a2aff98f07 Tests/LibWeb: Import WPT test for navigation cancel in document.open
This was recently implemented in: 76d9cc4baf
2026-04-01 04:41:11 +02:00
Sam Atkins
bd5424f435 Tests: Import WPT base64() test
This no longer crashes with the StringView fix in the previous commit.
2026-03-31 19:01:10 +02:00
Sam Atkins
37abfa323d Tests: Import some basic WPT @container tests 2026-03-30 14:49:24 +01:00
Callum Law
3aa71034de LibWeb: Support calc() within clip: rect() 2026-03-30 14:05:10 +01:00
Andreas Kling
52c46483d1 LibWeb: Handle raw-secret key formats in wrap_key
Refresh the imported wrapKey_unwrapKey WPT to the current upstream
version and treat the raw-secret and other raw* formats like raw
when wrap_key() and unwrap_key() serialize wrapped key bytes.

The updated test covers ChaCha20-Poly1305 wrapping with the
raw-secret format. Accepting the full set of byte-oriented raw
formats lets those keys round-trip through wrapKey and unwrapKey.
2026-03-29 13:21:36 +02:00
Andreas Kling
472f366ef5 LibWeb: Refresh imported WebCryptoAPI WPT files
Refresh imported WebCryptoAPI WPT files to current upstream versions,
including the shared fixtures and helper scripts they rely on.

This keeps the in-tree imported coverage up to date and rebaselines the
expectations for the refreshed tests that continue to match Ladybird's
current behavior. The wrapKey_unwrapKey update is handled separately,
since the newer upstream test exercises raw-secret key formats that
needed an engine fix first.
2026-03-29 13:21:36 +02:00
Andreas Kling
7fc4571c17 Tests: Import WPT tests for CSS2 floats and floats-clear
Import ref and text tests from css/CSS2/floats,
css/CSS2/floats-clear, css/CSS2/margin-padding-clear, and
css/CSS2/visuren.

These cover float placement, clear behavior, clearance calculations,
and margin collapsing with floats.
2026-03-29 12:05:25 +02:00
Sam Atkins
ed6a5f25a0 LibWeb: Implement scoped custom element registries 2026-03-27 19:49:55 +00:00
Sam Atkins
fe3c6a1f9f Tests: Import WPT custom-elements/registries tests
Includes reimporting the test we already had, which has changed
significantly.

Most of these fail, but importing them now to track progress.
2026-03-27 19:49:55 +00:00
Sam Atkins
86e1be123f Tests: Update WPT test harness scripts
Doesn't affect any of our results.
2026-03-27 19:49:55 +00:00
Callum Law
fc3dc8ac8c Tests: Import some @function parsing tests 2026-03-27 11:19:28 +00:00
Jelle Raaijmakers
6241cbb56d Tests: Import WPT tests for text-decoration-skip-ink parsing 2026-03-26 12:15:36 +00:00
Callum Law
46bebf44c5 LibWeb: Ensure custom property definition is valid <declaration-value>?
Previously we assumed that consumed declarations were always valid but
that isn't the case
2026-03-26 01:11:39 +00:00
Glenn Skrzypczak
6074424486 LibWeb/HTML: Update the button activation behaviour steps
This commit updates the activation behaviour steps of the button
element in order to properly determine if a command is valid for
a target.
2026-03-25 23:14:10 +01:00
mikiubo
be9936263f LibWeb: Re-import KMAC WPT tests 2026-03-25 22:07:53 +01:00
Shannon Booth
d330171be3 Tests/LibWeb: Import WPT test for iframe insertion/removing steps
The failing test is because we are not invoking 'process the iframe
attributes' synchronously in the <iframe> post connection /
insertion steps.
2026-03-25 14:49:36 +01:00
Luke Wilde
6a812cf919 Tests/LibWeb: Import form-associated custom elements WPT tests
These will be worked on in future commits.
2026-03-25 13:18:15 +00:00
Shannon Booth
fa1c046e68 Tests/LibWeb: Import some MessageEvent Origin API tests 2026-03-23 22:32:43 +01:00
Shannon Booth
8d6ce39a9b Tests/LibWeb: Support test-web echo server in get-host-info.sub.js
Make some local file edits to get-host-info.sub.js such that
get_host_info() refers to the echo server through localhost,
and the cross origin server through 127.0.0.1.

This allows many imported WPT tests using this function work
correctly (if loaded from the echo HTTP server).
2026-03-23 22:32:43 +01:00
Shannon Booth
45a87b1dbe LibWeb: Update document URL to the entry document URL in document.open()
When document.open() is called from another window, the opened
document's URL should be updated to match the calling document's URL.
2026-03-23 09:00:39 +01:00
Glenn Skrzypczak
c6bd3173ef LibWeb/HTML: Make form submit event trusted
The form submit event was previously not tagged as trusted. This commit
properly tags the event so that we match the behaviour implemented by
other browsers and expected by WPT.
2026-03-23 02:33:56 +01:00
mikiubo
b7eef098ed LibWeb: ReImport cshake WPT 2026-03-22 14:13:21 +01:00
Zaggy1024
ef845fe22a LibWeb: Don't count unversioned databases in IDBFactory::databases()
This code was treating the parameter to the JS::Array as if it was a
capacity, but that causes JS to see more databases than are actually
accessible if a database was being created in an aborted transaction.
2026-03-20 23:59:35 -05:00
Zaggy1024
547d4eb1f5 LibWeb: Implement IndexedDB request/transaction reverts
To allow these to be reverted, we store mutation logs per object store
in the scope of a readwrite transaction to track the modifications that
were made by it. If a revert is needed, the log is played in reverse to
bring us back to the original state.
2026-03-20 23:59:35 -05:00
Ollie Hensman-Crook
df8ead1f12 LibJS: Treat concise methods as non-constructors 2026-03-20 15:58:05 -05:00
Johan Dahlin
9a34fb59aa LibWeb: Implement HTMLElement.accessKeyLabel
Implement the accessKeyLabel IDL attribute per the HTML spec.

We mimic Chromium's behavior and treat the accesskey attribute value as
a single key rather than splitting on whitespace, since no browser
besides IE/Edge implemented the spec's splitting approach.

See https://github.com/whatwg/html/issues/3769
2026-03-20 15:57:06 -05:00
Shannon Booth
f4f6aefe32 LibURL/Pattern: Ignore extra RegExp captures in match result
execResult may contain additional captures from nested groups
in user-provided regexp parts, exceeding the number of
URLPattern groups.

Fixes a crash in the updated WPT test.

See: https://github.com/whatwg/urlpattern/commit/203d435c32
2026-03-20 11:29:15 +01:00
Shannon Booth
71ba774083 LibWeb/Bindings: Don’t set @@unscopables in unforgeable attribute setup
[Unscopable] members should only affect the interface prototype’s
@@unscopables object. The bindings generator was also creating an empty
@@unscopables object in define_unforgeable_attributes(), installing it
as an own property on instances.
2026-03-19 20:44:36 +01:00
mikiubo
6cc575b8a9 LibWeb: Import KMAC WPT tests 2026-03-19 10:46:49 +01:00
Callum Law
915fc4602b LibWeb: Implement CSS inherit() function
The remaining failing imported tests are due to wider issues which are
covered by FIXMEs (both existing and added in this commit)
2026-03-19 10:25:37 +01:00
Shannon Booth
27436c3971 LibWeb/HTML: Do not run script on child removal
Matching the behaviour of the other big three browser engines,
also tested by WPT, but does not appear to be explicitly specified.

I also noticed when investigating that browser engines disagree
about whether a child mutation should trigger script execution.
For this, I've just gone with the behaviour of Webkit/Chromium of
not running script.
2026-03-19 09:46:54 +01:00
Zaggy1024
2e54c18fb3 LibWeb: Use a queue to process fullscreen request completions
Instead of immediately firing fullscreenchange, defer that until
WebContent's client has confirmed that it is in fullscreen for the
content. The fullscreenchange is fired by the viewport change, so in
cases where the fullscreen transition is instantaneous (i.e. the
fullscreen state is entered at the exact moment the viewport expands),
the resize event should precede the fullscreenchange event, as the spec
requires.

This fixes the WPT element-request-fullscreen-timing.html test, which
was previously succeeding by accident because we were immediately
fullscreenchange upon requestFullscreen() being called, instead of
following spec and doing the viewport (window) resize in parallel. The
WPT test was actually initially intended to assert that the
fullscreenchange event follows the resize event, but the WPT runner
didn't actually have a different resolution for normal vs fullscreen
viewports, so the resize event doesn't actually fire in their setup. In
our headless mode, the default viewport is 800x600, and the fullscreen
viewport is 1920x1080, so we do fire a resize event when entering
fullscreen. Therefore, that imported test is reverted to assert that
the resize precedes the fullscreenchange.
2026-03-17 18:58:37 -05:00
mikiubo
89f8920c3a LibWeb: Import digest https WPT tests 2026-03-17 21:05:13 +01:00
mikiubo
2a6cfb4f48 LibWeb: Re-Import sha3 and cshake WPT tests 2026-03-17 21:05:13 +01:00