Commit graph

4324 commits

Author SHA1 Message Date
Lucas CHOLLET
3c60510896 LibWeb/CSS: Correctly serialize the colorspace name of xyz and xyz-d65
This gives us a +40 subtests passes in:
 - css/css-color/parsing/color-valid-color-function.html
2024-12-14 07:43:48 +00:00
devgianlu
9240d38273 LibCrypto+LibTLS+LibWeb: Store EC key size + refactor serialization
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
In order for public/private key serialization to work correctly we must
store the size of the key because P-521 cannot be stored as full words
inside `UnsignedBigInteger` and therefore is exported as the wrong
length (68 instead of 66).

This makes it also possible to refactor some methods and cleanup
constants scattered around.

Gets almost all import/export tests, expect the JWK ones that calculate
the public key on export. The `SECPxxxr1` implementation currently fails
to do calculations for P-521.
2024-12-14 01:52:16 +01:00
devgianlu
70db7772b8 LibWeb: Expose support for P-521 in ECDH and ECDSA
Replace all TODOs and FIXMEs requiring P-521 support with actual code
paths that make use of it. Gets a few tests by simply not failing early.
2024-12-14 01:52:16 +01:00
Sam Atkins
2c3f826162 Tests: Disable crashing css-hover-shadow-dom.html test 2024-12-13 16:11:02 +00:00
Manuel Zahariev
5d85f3a5c8 LibWeb: Test layout of standalone SVG document: edge cases
Tests with different combinations of missing width, height
and viewBox.

All tests confirmed to work on Ladybird:
 - exactly the same as Chromium (131.0.6778.85)
 - almost the same as Firefox (129.0.2)
    - only difference: standalone-w.svg: same size, different alignment
2024-12-13 15:02:49 +00:00
Manuel Zahariev
5d77104c2f LibWeb: Test layout of standalone SVG document: main use case
SVG document with specified width and height attributes is layed out
with this width/height.
2024-12-13 15:02:49 +00:00
Timothy Flynn
458af2d2a9 LibJS: Concatenate all included test262 harness files to a single script
For example, for the following `includes` line in a test262 file:

    includes: [sm/non262-TypedArray-shell.js, sm/non262.js]

We currently parse and execute each file in this list as its own script,
in the order they appear in the list.

Tests have recently been imported test262 from SpiderMonkey which fail
with this behavior. In the above example, if the first script references
some function from the second script, we will currently fail to execute
that harness file.

This patch changes our behavior to concatenate all harness files into a
single script, which satisfies the behavior required by these new tests.
This is how test262.fyi and other test262 runners already behave.
2024-12-13 05:26:39 -08:00
Timothy Flynn
40e7f46ac8 LibJS: Simplify reading test262 harness files
Make use of TRY semantics a bit more. And we don't need to store harness
files as a ByteString - we can store the contents as the ByteBuffer that
we receive from reading the file.
2024-12-13 05:26:39 -08:00
Timothy Flynn
1b4c45b9eb LibJS: Port test262-runner to use Error and TRY a bit more 2024-12-13 05:26:39 -08:00
Gingeh
84150f972f LibWeb: Properly serialize position/edge style values 2024-12-13 11:35:38 +00:00
sideshowbarker
583ca6af89 LibWeb: Implement <input type=checkbox switch> experimentally
In conformance with the requirements of the spec PR at
https://github.com/whatwg/html/pull/9546, this change adds support for
the “switch” attribute for type=checkbox “input” elements — which is
shipping in Safari (since Safari 17.4). This change also implements
support for exposing it to AT users with role=switch.
2024-12-13 11:31:27 +00:00
Ali Mohammad Pur
eee90f4aa2 LibRegex: Treat checks against nonexistent checkpoints as empty
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
Due to optimiser shenanigans in the tree alternative form, some
JumpNonEmpty ops might be moved before their Checkpoint instruction.
It is safe to assume the distance between the nonexistent checkpoint and
the current op is zero, so just do that.
2024-12-13 10:00:16 +01:00
Psychpsyo
4dc65c57a0 LibWeb: Make MouseEvent.offsetX/Y ignore transforms
That is what the spec calls it, at least.
In code, this manifests as making the offset very aware
of the element's transform, because the click position comes
relative to the viewport, not to the transformed element.
2024-12-13 07:18:56 +01:00
Luke Warlow
fcf6cc27f2 LibWeb: Implement popover beforetoggle and toggle events 2024-12-12 15:10:33 -07:00
Nathan van der Kamp
a276cf2d5e LibWeb: Add PopOverInvokerElement and use it in HTMLButtonElement
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
The popoverTargetElement seems to be one of the only cases of a
reflected Element? attribute in the HTML spec, the behaviour of which
is specified in section 2.6.1.

Buttons can't actually toggle popovers yet because showing/hiding
popovers is not implemented yet.
2024-12-12 17:11:27 +00:00
sideshowbarker
32dddc8140 Tests: Import some ARIA and HTML-AAM (regression) tests (no code)
We’re passing all the tests in this patch on trunk — so let’s go ahead
and welcome them into our regression-testing garden.
2024-12-12 13:54:47 +00:00
sideshowbarker
50e7e9f58d LibWeb: Assign “dir”, “dd”, “dt” default ARIA roles per-spec
Also, import http://wpt.live/html-aam/dir-role.tentative.html (which
provides test/regression coverage for the “dir” change).
2024-12-12 05:13:45 -08:00
sideshowbarker
ccbc436e85 LibWeb: Support the “image” synonym for the “img” ARIA role
Additionally: For “img” elements with empty “alt” attributes, change the
default role to the newer, preferred “none” synonym for the older
“presentation” role; import https://wpt.fyi/results/html-aam/roles.html
(which provides test/regression coverage for these changes).
2024-12-12 05:13:45 -08:00
sideshowbarker
96540e9f89 LibWeb: Add support for the “suggestion” ARIA role
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-12-12 08:53:20 +00:00
Timothy Flynn
68164aa7ec LibWeb: Run the object representation task when the active state changes
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
Currently, the following JS snippet will hang indefinitely:

    new DOMParser().parseFromString("<object>", "text/html");

Because the document into which the object is inserted is not active. So
the task queued to run the representation steps will never run.

This patch implements the spec steps to rerun the representation steps
when the active state changes, and avoid the hang when the object is
created in an inactive document.
2024-12-11 17:38:31 -07:00
sideshowbarker
e49fe384d1 LibWeb: Align default “th” and “td” roles with HTML-AAM spec and tests
This change aligns the default roles for “th” and “td” elements with the
requirements in the HTML-AAM spec, and with the corresponding WPT tests
at https://wpt.fyi/results/html-aam/table-roles.html, and with the
behavior in other engines.

Otherwise, without this change, the default role values for “th” and
“td” elements in some cases don’t match the behavior in other engines,
and don’t match the expected results for the corresponding WPT tests.
2024-12-11 16:55:07 -07:00
sideshowbarker
2d638485a8 LibWeb: Assign “orphaned” li elements the default ARIA role “none”
This change makes Ladybird conform to the current requirements at
https://w3c.github.io/core-aam/#roleMappingComputedRole in the “Core
Accessibility API Mappings” spec for the case of “orphaned” li elements;
that is, any li element which doesn’t have a role=list ancestor.

The core-aam spec requires that in such cases, the li element must not
be assigned the “listitem” role but instead must be treated as if it had
no role at all.
2024-12-11 16:43:55 -07:00
Feng Yu
824e91ffdb LibWeb: Ensure Headers API can handle non-ascii characters
This patch ensure Headers object's associated header list
is ISO-8859-1 encoded when set using `Infra::isomorphic_encode`,
and correctly decoded using `Infra::isomorphic_decode`.

Follow-up of https://github.com/LadybirdBrowser/ladybird/pull/1893
2024-12-11 16:40:36 -07:00
Lucas CHOLLET
5e62f548db LibWeb/CSS: Serialize CSSColor without relying on RGB
This gives us 140 subtests pass in:
css/css-color/parsing/color-valid-color-function.html
2024-12-11 16:37:22 -07:00
Feng Yu
9c243caac4 LibWeb: Add statusText validation for Response constructor
Implemented validation to ensure `statusText` matches the
`reason-phrase` token production.

This change fixes a WPT subtest which I have imported.
2024-12-11 16:34:10 -07:00
Pavel Shliak
d5cdda0b40 LibWeb: Load external scripts in SVG 2024-12-11 16:29:42 -07:00
Simek
e7ef8da7f3 LibWeb/ARIA: Add missing structure roles 2024-12-11 10:32:40 -08:00
Timothy Flynn
943ec820fc LibWeb: Avoid dereferencing an empty optional URL
Here, "null" means the empty optional. We don't need to also check if
the URL is valid; the url will be null if it was originally invalid.
2024-12-11 09:33:46 -08:00
Shannon Booth
f110edebd1 LibWeb/HTML: Encoding parse a URL when setting a href URL
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
Fixes many WPT encoding regression tests which regressed in
fe891727dc.
2024-12-11 09:48:17 +01:00
Tim Ledbetter
a536ee6f31 Tests: Add vendor-specific testdriver send_keys() function
This uses the `Internals.sendText()` function.
2024-12-10 17:16:29 -08:00
Tim Ledbetter
1bd10a5443 Tests: Add vendor-specific testdriver click() function
This uses `Internals.click()` which doesn't do as much as the
equivalent WebDriver method, but should be enough to satify most tests
that use it.
2024-12-10 17:16:29 -08:00
Tim Ledbetter
1ff556a2bd Tests: Move Ladybird specific testdriver code to testdriver-vendor.js 2024-12-10 17:16:29 -08:00
Shannon Booth
4b069344e0 LibWeb/HTML: Fix crash in window open steps on empty URL string 2024-12-10 17:16:07 -08:00
Timothy Flynn
d835a00bee LibWeb: Use Fetch to retrieve HTMLObjectElement data URLs
This eliminates the use of ResourceLoader in HTMLObjectElement. The spec
steps around fetching have been slightly updated since we've last looked
at this, so those are updated here.

Regarding the text test change: we cannot rely on the data: URL being
fetched synchronously. It will occur on a deferred task now. This does
match the behavior of other browsers, as they also will not have run the
fallback representation steps as of DOMContentLoaded.
2024-12-10 10:37:01 -08:00
Jelle Raaijmakers
495006ddb5 LibWeb: Implement document.execCommand('insertLinebreak') 2024-12-10 19:34:38 +01:00
Tim Ledbetter
ae53059816 Tests: Don't display imported WPT test output if browser is headless
Previously, imported WPT tests didn't display any output if the
internals object was exposed. This change adds the condition that the
browser must also be running headlessly for test output to not be
displayed.
2024-12-10 10:31:47 -08:00
Tim Ledbetter
a44b18236c LibWeb: Add an Internals.headless attribute
This returns true if the browser is running in headless mode.
2024-12-10 10:31:47 -08:00
Luke Wilde
d2acf32aae LibWeb: Register Wasm memory grow hook in constructor of Memory objects
Previously it would only register the hook for JavaScript constructed
Memory objects. This allows Ruffle to load again.
2024-12-10 15:54:20 +01:00
Feng Yu
f2eaf3381f LibWeb: Throw TypeError for new Headers(null)
The WebIDL for the `Headers` constructor specifies that the `init`
parameter is optional and must be of type `HeadersInit`. While the
parameter can be omitted (or explicitly set to `undefined`),
`null` is not a valid value.

This change fixes at least 2 "Create headers with null should throw"
WPT subtests which I have imported in this patch.
2024-12-10 06:46:31 -08:00
Luke Wilde
023c3aa5b0 LibWeb: Respect subarrays in Crypto#getRandomBytes
It is the responsibility of code that deals with TypedArrays to apply
the byte offset and byte length. Not doing this caused Unity Web to
crash, as they call getRandomValues with views into their full main
memory. Previously, it would fill their entire memory of about 33.5 MB
with random bytes.
2024-12-10 06:44:00 -08:00
Jelle Raaijmakers
fd949ee3dd LibWeb: Only set selection focus if an associated DOM node was found
The relation from a paintable to a DOM node is not always set.
2024-12-10 14:54:19 +01:00
Shannon Booth
ac6fe2e211 LibWeb: Implement multiple import map support 2024-12-10 12:01:45 +00:00
Shannon Booth
0a216f9c14 LibWeb/HTML: Use DOM's post connection steps for <script> elements
This aligns our behaviour with WebKit and Chrome.

See: https://github.com/whatwg/html/commit/ddd2d0dd
2024-12-10 10:38:56 +00:00
Pavel Shliak
6f81b80114 Everywhere: Include HashMap only where it's actually used 2024-12-09 12:31:16 +01:00
Lucien Fiorini
3c2bbd45cf Tests: Mark test as passing in XMLSerializer-serializeToString.txt 2024-12-09 09:13:24 +00:00
Lucien Fiorini
7feb8eb5bf Tests: Import WPT test for firstElementChild namespace in xhtml 2024-12-09 09:13:24 +00:00
sideshowbarker
0a2aa87107 LibWeb: Assign ARIA role “switch” to <input type=checkbox switch> 2024-12-09 09:47:36 +01:00
Konstantin Konstantin
b03138cbff LibWeb: Support creation of shared memory in WebAssembly API
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
Add support for shared memory creation in WebAssembly memory API.
This API is needed for WPT tests that use shared array buffers.

Import related WPT tests.
2024-12-08 22:10:45 +01:00
rmg-x
0cd4c26ae8 Tests/LibWeb: Fix type for delay_ms property in HTTP echo server
This was mistakenly changed from int -> str in a previous commit:
08b8c88ac3
2024-12-07 15:49:15 +00:00
Felipe Muñoz Mazur
e27c59047a LibWeb: Handle abort signal in CloseWatcher
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-12-07 12:06:53 +00:00