1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 17:44:56 +09:00
Commit graph

69225 commits

Author SHA1 Message Date
ayeteadoe
744fd91d0b LibTest: Support death tests without child process cloning
A challenge for getting LibTest working on Windows has always
been CrashTest. It implements death tests similar to Google Test
where a child process is cloned to invoke the expression that
should abort/terminate the program. Then the exit code of the
child is used by the parent test process to verify if the
application correctly aborted/terminated due to invoking
the expression.

The problem was that finding an equivalent way to port Crash::run()
to Windows was not looking very likely as publicly exposed Win32/
Native APIs have no equivalent to fork(); however, Windows actually
does have native support for process cloning via undocumented NT
APIs that clever people reverse engineered and published, see
`NtCreateUserProcess()`.

All that being said, this `EXPECT_DEATH()` implementation avoids
needing to use a child process in general, allowing us to remove
CrashTest in favour of a single cross-platform solution for death
tests.
2025-05-16 13:23:32 -06:00
ayeteadoe
dc707e6ed8 AK: Expose ak_assertion_handler weak symbol for custom death handling
When a `VERIFY()` assertion fails `ak_verification_failed` is invoked
which means the program will invoke `__builtin_trap` and immediately
quit. But with this change we have now allowed for an optional hook
into `ak_*_failed` that lets us perform some custom
action before program exits. This foundation is what we will
(ab)use to implement death tests without the process cloning
CrashTest infrastructure.
2025-05-16 13:23:32 -06:00
ayeteadoe
d35486cb74 LibTest: Explicitly export symbols 2025-05-16 13:23:32 -06:00
Andreas Kling
2194cbde4b LibWeb: Stub out SVGGraphicsElement.getCTM()
We already did this for getScreenCTM().
2025-05-16 20:36:07 +02:00
Andreas Kling
1dc6425ede LibWeb: Implement SVGElement.viewportElement 2025-05-16 20:36:07 +02:00
Andreas Kling
879cba762b LibWeb: Implement Document.rootElement (SVG2 extension to Document) 2025-05-16 20:36:07 +02:00
Andreas Kling
e6f75801b1 LibWeb: Import WPT test for checking all the basic SVG interfaces exist 2025-05-16 20:36:07 +02:00
Jelle Raaijmakers
170e599bd9 LibWeb: Always set the Y offset of the current block in BFC
Originally part of a fix in 15103d172c, it
appears that this is no longer necessary and received a better fix in a
more recent commit. Resolves a visual regression with the ACID3 test.
2025-05-16 20:33:27 +02:00
Sam Atkins
c9484e279f LibWeb/CSS: Implement CSSPageRule.setSelectorText()
Gets us 12 WPT subtest passes.
2025-05-16 16:42:10 +01:00
Sam Atkins
d852ae17e8 LibWeb/CSS: Make @page selector parsing accessible
Mostly minor changes - the code has moved, and has to support Token or
ComponentValue TokenStreams, but otherwise it's the same.
2025-05-16 16:42:10 +01:00
Sam Atkins
107b47f884 LibWeb/CSS: Move PageSelector into its own files
The main motivation here is that the CSS Parser needs to know about
PageSelectorList so that we can parse one in
`CSSPageRule::set_selector_text()`. Including all of `CSSPageRule.h`
there would pull in a lot of other headers that aren't needed.
2025-05-16 16:42:10 +01:00
Sam Atkins
869abe0b21 LibWeb/CSS: Match *-namespace selectors against all attributes
Previously we only matched against the first attribute with a given
local name. What we actually want to do is look at each attribute with
that local name in turn and only return false if none of them match.

Also remove a hack for HTML elements in HTML documents, where we would
refuse to match any namespaced attributes. This doesn't seem to be
based on the spec, but we had regressions without it, until now. :^)

Gets us 21 more WPT subtest passes.
2025-05-16 16:41:57 +01:00
Sam Atkins
ecdfb96a0a LibWeb/CSS: Limit case-insensitive default comparison to HTML attributes
The HTML spec gives us a list of HTML attributes that must have their
values compared case-insensitively by default (when the attribute
selector does not specify a case-sensitiveness). However, ifwe have a
namespace, then we are not looking for an HTML attribute, so this
should not apply.

Gets us 8 more WPT subtest passes.
2025-05-16 16:41:57 +01:00
Sam Atkins
d9113e45f0 LibWeb/CSS: Discard trailing whitespace inside attribute selectors
This gets us 84 more subtests, so everything in this syntax test passes.
2025-05-16 16:41:57 +01:00
Sam Atkins
3914bf05fb LibWeb/CSS: Serialize * namespace in attribute selectors
Gets us 13 WPT subtest passes.
2025-05-16 16:41:57 +01:00
Sam Atkins
a56ce0f6fa Tests: Import attribute-selector case-sensitivity tests 2025-05-16 16:41:57 +01:00
aplefull
68ddc7006d LibMedia: Implement conversion of BT601 primaries 2025-05-16 12:13:13 +01:00
stelar7
9e7fb5efbc LibWeb/IDB: Update spec step wording 2025-05-16 12:10:16 +01:00
stelar7
c1d63b5b28 LibWeb/IDB: Implement queue_a_database_task 2025-05-16 12:10:16 +01:00
Jelle Raaijmakers
29f1648bc5 LibWeb: Do not override whitespace handling for editable elements
This condition no longer seems to be necessary for anything, and it
caused newlines to not render correctly in editable nodes.
2025-05-16 12:08:29 +01:00
Jelle Raaijmakers
a48e693ea1 LibWeb: Add tests for styleWithCSS and useCSS editing commands 2025-05-16 12:07:35 +01:00
Sam Atkins
870f24f181 LibWeb/CSS: Add basic implementation of CSSMarginRule
This is a bit under-specced, specifically there's no definition of
CSSMarginDescriptors so I've gone with CSSStyleProperties for now. Gets
us 17 WPT subtests.
2025-05-16 11:01:39 +01:00
Sam Atkins
aa9fa88428 LibWeb/CSS: Treat at-rule names insensitively to determine context type
`@MeDiA` is entirely valid.
2025-05-16 11:01:39 +01:00
Sam Atkins
101f6b1d7e Tests: Import CSSMarginRule tests 2025-05-16 11:01:39 +01:00
Tim Ledbetter
2903defcfc Revert "LibJS+LibWeb: Return Vector<PropertyKey> from…
internal_own_property_keys"

This reverts commit 5ee810f772.
2025-05-16 06:33:09 +01:00
Tim Ledbetter
8cd9275416 Revert "LibJS: Ensure keys vector capacity in…
Object::internal_own_property_keys"

This reverts commit 27ba216e3f.
2025-05-16 06:33:09 +01:00
Sam Atkins
3f18331594 LibWeb/HTML: Do not allow named window targeting with noopener
Corresponds to dfdafb4b29

We fail the test for this, but we actually do create the separate popup
windows correctly (when popups aren't blocked!) but the test checks
`window.name` which we incorrectly return the empty string for.
https://wpt.live/html/browsers/windows/auxiliary-browsing-contexts/named-lookup-noopener.html
2025-05-16 10:21:09 +12:00
Sam Atkins
08419a6d8f LibWeb/HTML: Correct show_popover() invocations
Corresponds to 47f854c66e
2025-05-16 10:21:09 +12:00
Sam Atkins
2efad4c941 LibWeb/HTML: Fire load event for non-string javascript: URLs
Corresponds to 8abe559982

The relevant test doesn't pass, so we're probably missing some other
part of this mechanism:
https://wpt.live/html/semantics/embedded-content/the-embed-element/embed-javascript-url.html
2025-05-16 10:21:09 +12:00
Aliaksandr Kalenik
27ba216e3f LibJS: Ensure keys vector capacity in Object::internal_own_property_keys
12% improvement on MicroBench/object-keys.js
2025-05-15 14:12:18 -04:00
Aliaksandr Kalenik
5ee810f772 LibJS+LibWeb: Return Vector<PropertyKey> from internal_own_property_keys
By doing that we avoid lots of `PropertyKey` -> `Value` -> `PropertyKey`
transforms, which are quite expensive because of underlying
`FlyString` -> `PrimitiveString` -> `FlyString` conversions.

10% improvement on MicroBench/object-keys.js
2025-05-15 14:12:18 -04:00
Timothy Flynn
47569c1714 CI: Do not install clang in the JS benchmarks workflow
It's not needed. This is primarily to reduce the number of places needed
to be updated on the next clang rollout.
2025-05-15 18:53:49 +02:00
Sam Atkins
1fe29ac642 LibWeb/CSS: Bring :lang() matching closer to spec
With this, we pass the 8 ref tests in css/selectors/selectors-4/ which
previously failed. This is not technically a full implementation, as we
are supposed to first canonicalize the language range and tag, but that
will require downloading and processing the IANA language subtag
registry:

https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry

That's significantly more work, and WPT doesn't seem to test any cases
that require that, so we can leave it for now.
2025-05-15 16:40:44 +01:00
Ben Eidson
e0e513e9fc LibWeb/MimeSniff: Add WebM signature sniffing and VINT parsing
Adds `matches_webm_signature()` and `parse_vint()` helpers per WPT
spec. Uses these helpers to resolve the WebM FIXME that was in
`match_an_audio_or_video_type_pattern()`.
2025-05-15 09:39:19 -06:00
R-Goc
20662f0dc9 AK: Add windows support in AK/Random
This commit adds support in AK/Random for a high quality RNG on windows.
This requires moving the code into a cpp file not to spread windows
headers around.
2025-05-15 07:41:02 -06:00
R-Goc
d60543c2cb LibJS/LibCrypto: Cleanup JS Math random() RNG
This commit adds a convenience method to secure random for initializing
single types. It changes the random number generator in JS math random()
to use newer constants by the author as well as initializes it with a
higher quality seed.
2025-05-15 07:41:02 -06:00
Andrew Kaster
a01d6ba246 CMake: Clear CMAKE_REQUIRED_LIBRARIES after blocks and arc tests
This is better CMake hygiene to avoid leaking our try_compile specific
library requirements into the rest of the build.
2025-05-15 07:20:20 -06:00
Jelle Raaijmakers
9f044cb547 CI: Only add LLVM repository if it is missing
For our js-benchmarks and libjs-test262 workflow runs, we already know
that they're provisioned with these repositories and can skip adding the
key and repo altogether.
2025-05-15 15:13:55 +02:00
Jelle Raaijmakers
44db17f273 CI: Switch from wget to curl
We were using both wget and curl arbitrarily; use curl exclusively since
that is installed by default on our machines and containers. Fixes the
js-benchmarks workflow.
2025-05-15 14:22:38 +02:00
Tim Ledbetter
1c5881c44a LibCore: Remove LADYBIRD_GIT_VERSION environment variable usage
This was previously used by the WPT runner to determine the git hash
of a particular WPT run. This mechanism is no longer used, since it
doesn't work with chunked WPT runs.
2025-05-15 14:02:48 +02:00
Tim Ledbetter
7f4916b806 Meta: Ensure wptreport browser_version field is always populated
This was previously done by passing the `LADYBIRD_GIT_VERSION`
environment variable to `wpt`, but this doesn't work in chunked mode.
2025-05-15 14:02:48 +02:00
Jelle Raaijmakers
cac1d49d21 LibWeb: Ensure we're not creating invalid ranges
Our Ranges should maintain the invariant that their offsets are always
within range of 0..length (inclusive) of their respective containers.

Note that we cannot maintain this in AbstractRange, which is the base
for StaticRange and can still have invalid offsets.
2025-05-15 11:44:32 +01:00
Jelle Raaijmakers
c3a5e8e266 LibWeb: Invalidate viewport's text blocks cache on layout update
156c1083e9 introduced a text blocks cache
for better performance when searching through text on a page, but when
we partially recreate the layout tree, this cache does not get
invalidated. We now rebuild the entire text blocks cache after a layout
update.
2025-05-15 11:44:32 +01:00
Jelle Raaijmakers
0d83426a49 LibWeb: Modify range start & end directly where applicable
We were calling into `Range::set_start_or_end()` indirectly through
`::set_start()` and `::set_end()`, but that algorithm only calls for an
invocation whenever the start or end of a range needs to be set to a
boundary point. If an algorithm step calls for setting the node or
offset, we should directly modify the range.

The problem with calling into `::set_start_or_end()` is that this
algorithm potentially modifies _both_ the start and end of the range,
but algorithms trying to update a range's start or end often have
explicit steps to take both the start and end into account and end up
overcompensating for the start or end offset resulting in an invalid
range (e.g. with an end offset beyond a node's length).

This makes updating a range's start/end a bit more efficient and removes
a piece of ad-hoc code in CharacterData needed to make it work before.
2025-05-15 11:44:32 +01:00
Tim Ledbetter
e2db9790b0 Meta: Use human readable timestamp in WPT run folder name
This makes it easier to figure out when a given run started.
2025-05-15 12:11:20 +02:00
Sam Atkins
3a235e9050 LibWeb/CSS: Parse @page bleed, marks, page-orientation descriptors
These don't have WPT tests so I've added some myself.
2025-05-15 09:53:29 +01:00
Sam Atkins
9415bffd9b LibWeb/CSS: Parse @page size descriptor 2025-05-15 09:53:29 +01:00
Sam Atkins
d8c6b872a3 LibWeb/CSS: Allow descriptors to be shorthands
I was wrong when I added those notes before about this being impossible,
it's *very* possible, for example with the `@page margin` descriptor.
However, until we have a large number of these shorthands and not just a
single example, we can get away with hard-coding support for it.
2025-05-15 09:53:29 +01:00
Sam Atkins
1aa5631610 LibWeb/CSS: Parse @page selectors
Ideally we'd be able to share the code between page selectors and style
ones, but given how simple page selectors are, some code duplication is
the simpler option.
2025-05-15 09:53:29 +01:00
Sam Atkins
aaf07ae30d LibWeb: Add basic implementation of @page
This doesn't support selectors, and the only descriptors for now are for
margins.
2025-05-15 09:53:29 +01:00