Commit graph

63749 commits

Author SHA1 Message Date
Diego Frias
f7a322b1fb LibWasm: Simplify downcasting in bytecode interpreter
(cherry picked from commit 15510fb42e03b71e39b42d08dfbc7f7a822a0a1e)
2024-11-12 19:58:14 -05:00
Hermes Junior
34ae4521ff LibJS: Correctly return cached value for global var bindings
When the cached value was not an accessor, it was simply ignored.
This is the value we really want, so we can just return it.
Shows up to 5x improvements on some benchmarks,
and 1.4x in general js-benchmarks.

(cherry picked from commit 77a46ab1b8d13f35b11a7bd08459752912dca1bf)
2024-11-12 19:57:55 -05:00
Andreas Kling
7b2568bc9a LibJS: Stop having AsyncFunctionDriverWrapper leak itself
Async functions whose promise is never resolved were leaking, since they
had a strong root JS::Handle on themselves.

This doesn't appear to actually be necessary, since the wrapper will be
kept alive as long as it's reachable (and if it's not reachable, nobody
is going to resolve/reject the promise either).

This fixes the vast majority of leaks on Speedometer, bringing memory
usage at the end of a full run from ~12 GiB to ~3 GiB.

(cherry picked from commit b6a5b7e18626ce0dee11a25bb0d51d2e84d3c057)
2024-11-12 19:57:55 -05:00
Andreas Kling
8486d6e8aa LibJS: Use ConservativeVector when instantiating static class fields
This fixes an issue where a badly-timed garbage collection could swallow
a static field initializer.

Caught by running test262 in GC-on-every-allocation mode.

(cherry picked from commit 10724a7cb346e57b0b97e4bd54c13c5c604dbf9c)
2024-11-12 19:57:55 -05:00
Andreas Kling
1c7e69a5b5 LibJS: Make ConservativeVector<T> visit all possible values
We were miscalculating the length of the buffer in pointer-sized chunks,
which is what the conservative root scan cares about.

This could cause some values to be prematurely garbage-collected.

(cherry picked from commit 2fb3b6c542db3a86cbd1aa7e34d470e34c485372)
2024-11-12 19:57:55 -05:00
justus2510
da16c169ae LibWeb: Handle unpaired surrogates in USVStrings
This should fix (at least) the last two remaining WPT test failures in
FileAPI/unicode.html.

(cherry picked from commit 55f0dc823ff266aeb29fd6f7d47d5e7f89a50ee6)
2024-11-12 19:57:55 -05:00
Gingeh
1a1ccd3a92 LibWeb: Set both start and end in Selection::extend
(cherry picked from commit f41cbfa2a9c1ff21890581d0ae87334ff1e780e6)
2024-11-12 19:57:55 -05:00
Gingeh
1c7ca6d33e LibWeb: Set direction to forwards in addRange
(cherry picked from commit 93927d8243ae61b96fc70e6e7d44f8e0255b0408)
2024-11-12 19:57:55 -05:00
Gingeh
7f930dcdb0 LibWeb: Implement Selection::direction
(cherry picked from commit a7953f5e092429be3d51e3de2f26f666315ec912)
2024-11-12 19:57:55 -05:00
sin-ack
b7dea19a3f LibWeb: Compare navigable active_url with fragments included
This was previously negated due to a misread of
https://url.spec.whatwg.org/#concept-url-equals. This change fixes a
bunch of WPT crashes such as
"/html/browsers/history/the-history-interface/001".

(cherry picked from commit f1cab5de7a071fe76eae10d36603f6cf34fa989e)
2024-11-12 19:57:55 -05:00
Glenn Skrzypczak
34247c4251 LibWeb: Don't crash when encountering a resolution in a calculation
calc() seems to support resolutions by now.

The change allows us to pass this WPT test:
http://wpt.live/css/css-values/round-mod-rem-invalid.html

(cherry picked from commit 3804c4dea1a8e4296327ca570e012264ee2580b3)
2024-11-12 19:57:55 -05:00
Glenn Skrzypczak
70b4d92e50 LibWeb: Support the 'x' resolution unit identifier
The 'x' unit is the same as 'dppx', but was previously not considered
when parsing resolutions.

(cherry picked from commit 7ed08a401f5d3242d8c0354467e0af827bb6b0ce)
2024-11-12 19:57:55 -05:00
Cory Virok
bca960ce36 LibWeb: Added tests for missing xmlns during XHMTL parsing
The main culprit for the following WPT test failure is that we
weren't using the HTML namespace for XHTML docs unless one was
explicitly provided.

(cherry picked from commit 6a5bca1302161a84d95313bef1481d9a8a56702c)
2024-11-12 19:57:55 -05:00
ronak69
9ee02fc952 LibWeb: Frameset should be the body element if it comes before body
Fixes one WPT test: "Frameset followed by body inside the html element"
http://wpt.live/html/dom/documents/dom-tree-accessors/Document.body.html

(cherry picked from commit 5f9a36feacede04cd51c1a286bc5fb87b60fb5e2)
2024-11-12 19:57:55 -05:00
Tim Ledbetter
be7110a3a4 LibWeb: Map dimension attributes for table elements
(cherry picked from commit 140dc95e6769a41542f98abef333d5bc32b86e39)
2024-11-12 19:57:55 -05:00
Tim Ledbetter
ea8914aeac LibWeb: Map embedded content element attributes to dimension properties
(cherry picked from commit 728236f4d20b4dbabfe0936b79a2f63ac80f4da3)
2024-11-12 19:57:55 -05:00
Tim Ledbetter
8dee6b9ebd Libweb: Map marquee attributes to dimension properties
(cherry picked from commit baca0e5e5568b1b9b301cefa7d6cc8312b39be28)
2024-11-12 19:57:55 -05:00
Tim Ledbetter
7e456212c7 LibWeb: Map hr width attribute to the width dimension property
(cherry picked from commit 4c3101e021e323b487e8ab10026a14fdf40fa2f0)
2024-11-12 19:57:55 -05:00
Mohamed amine Bounya
7c91d38332 LibWeb/HTML: Select html input elements with selectable text
only select input elements that select applies to and has a
selectable text.

(cherry picked from commit 6fe43e9f736160f3437958a407ce1554c371f1a5)
2024-11-12 19:57:55 -05:00
Gingeh
3b9064089a LibWeb: Don't move focus when setting input value
(cherry picked from commit 1d9c404b8cb898b351ee3c69840bf943e97d499c)
2024-11-12 19:57:55 -05:00
Tim Ledbetter
bb798071a0 LibWeb: Treat dates and times with repeated separators as invalid
These would previously be treated as valid by the value sanitization
algorithm.

(cherry picked from commit f9282f65d3a4daf7df2c6033b03c70a56130aa72)
2024-11-12 19:57:55 -05:00
Luke Wilde
2c0e59c402 LibJS: Parse dates like "November 19 2024 00:00:00 +0900"
This format is used on https://jojowiki.com/ to show countdowns to new
releases.

(cherry picked from commit 956b279ae1f6ee9f76ff1120a759ab9d86218687)
2024-11-12 19:57:55 -05:00
Sam Atkins
dea1b7700a LibWeb/HTML: Dispatch toggle and beforetoggle events from dialogs
Corresponds to https://github.com/whatwg/html/pull/10091

(cherry picked from commit 36f8dfaed02a967de620a7e2abc8bd254cd7f9a5)
2024-11-12 10:45:53 -05:00
Sam Atkins
0a38d163dd LibWeb/HTML: Update legacy color parsing steps to match spec
(cherry picked from commit f80fca2deeb2b0ea5ffd0af714bcd79b3ad729dd)
2024-11-12 10:45:53 -05:00
Ankush Chatterjee
d5ed665461 LibWeb/CSS: Add math expression support for transform-origin
(cherry picked from commit 85356094b50878e78d40d79c2a9e96ff9aac5a6b)
2024-11-12 10:45:53 -05:00
Ben Wiederhake
ff914bc157 LibWeb: Remove dead write in HKDF/PBKDF importKey operation
This corresponds to a recent change in the spec:
https://github.com/w3c/webcrypto/pull/379

(cherry picked from commit efad0b56769957e81e2420e4ccaef212baf5ea9f)
2024-11-12 10:45:53 -05:00
Ben Wiederhake
f2a71afc09 LibWeb: Remove superfluous step in HKDF deriveBits operation
This corresponds to a recent change in the spec:
https://github.com/w3c/webcrypto/pull/372
Inspired by the following review comment:
https://github.com/LadybirdBrowser/ladybird/pull/1877#discussion_r1807648283

(cherry picked from commit ee3b86c3f87d8a44ba92c8aaff75925948ceacfd)
2024-11-12 10:45:53 -05:00
Timothy Flynn
ae6599c07a LibWebView+WebContent+headless-browser: Make the page info IPCs async
The IPCs to request a page's text, layout tree, etc. are currently all
synchronous. This can result in a deadlock when WebContent also makes
a synchronous IPC call, as both ends will be waiting on each other.

This replaces the page info IPCs with a single, asynchronous IPC. This
new IPC is promise-based, much like our screenshot IPC.

(cherry picked from commit 3332230cef8091f94f5c30e1f1984c1038cd4a1d)
2024-11-12 10:45:53 -05:00
Timothy Flynn
69953cb70e UI/Qt: Remove unused WebContentView::dump_layout_tree
(cherry picked from commit b688bbf26c6efb84fec19ec900cd3f1a4cf04a1b)
2024-11-12 10:45:53 -05:00
Nico Weber
163cd81156 LibWebView: Remove unused dump_layout_tree()
This was added in 9d03ea6f74 for LibWeb/DumpLayoutTree/main.cpp.
That utility was moved to LibViewView in #14018 and then deleted
in #18879 after #17836 moved that functionality to headless-browser.

No behavior change.
2024-11-12 10:45:53 -05:00
Tim Ledbetter
c7a699ed73 LibWeb: Make input type state change handling specification compliant
This change ensures that the value sanitization algorithm is run and
the text cursor is set to the correct position when the type attribute
of an input is changed.

(cherry picked from commit 1b74104c17726018788034f2ad66201889ce6225)
2024-11-12 10:45:53 -05:00
Tim Ledbetter
f24a625eb0 LibWeb: Don't crash when normalizing a local datetime with a T separator
(cherry picked from commit 2d7547921b98747153ae9d9dda3d5479d4e9036f)
2024-11-12 10:45:53 -05:00
Tim Ledbetter
6db07d132f LibWeb: Use correct value when parsing datetime-local input type
(cherry picked from commit eb4e40bc49d2ad78335d0e95482a9c702764a8c9)
2024-11-12 10:45:53 -05:00
Tim Ledbetter
22cd5b3263 LibWeb: Ensure value sanitization algorithm trims whitespace if needed
Previously, the value sanitization algorithm would not trim whitespace
for inputs of type URL or email, if they didn't also contain any
newlines.

(cherry picked from commit c4b82318f41ecc0a3e24fe5c8ca0a3f02816c3b1)
2024-11-12 10:45:53 -05:00
Tim Ledbetter
a77b65d46a LibWeb: Don't attempt to set selection if control has no selectable text
(cherry picked from commit 2c8fb4957871bca5694fc9e9f8932c9769967bd1)
2024-11-12 10:45:53 -05:00
Ninad Sachania
a7d5ea0264 Terminal: Set alpha channel to 0xFF
This fixes a bug where VT::Color::Kind::Indexed colors from
index 16 to 255 were not being rendered because their
alpha channel was set to zero.
2024-11-12 09:42:18 -05:00
Ali Mohammad Pur
66ee1a16e8 LibRegex: Don't ignore references that weren't bound in checked blocks
Fixes #2281.

(cherry picked from commit dabd60180f301ae206d6e23e0e0ff17d6c8975af)
2024-11-12 07:14:25 -05:00
Jonne Ransijn
5d6ef182f4 LibJS+LibWeb: Prevent double invocation of [[GetOwnProperty]]
The `[[GetOwnProperty]]` internal method invocation in
`OrdinarySetWithOwnDescriptor` was being invocated again with the same
parameters in the `[[DefineOwnProperty]]` internal method that is also
later called in `OrdinarySetWithOwnDescriptor`.

The `PlatformObject.[[DefineOwnProperty]]` has similair logic.

This change adds an optional parameter to the `[[DefineOwnProperty]]`
internal method so the results of the previous `[[GetOwnProperty]]`
internal method invocation can be re-used.

(cherry picked from commit 69f96122b6150c22d1e8dc848c097cead2d2ae3f)
2024-11-12 07:14:25 -05:00
Sam Atkins
b7d8202814 LibWeb: Update spec comments using "Type(Foo)" -> "is a Foo"
(cherry picked from commit f31c18756bfdc6449f01a144e1ef2dfbf8acab22)
2024-11-12 07:14:25 -05:00
Sam Atkins
e20a2718fc LibWeb/HTML: Guard showModal() with fully active check
This corresponds to this spec change:
https://github.com/whatwg/html/pull/10705

(We don't implement showPopover() yet.)

(cherry picked from commit 00e613c7df7ac26ba28e11d172207c045d35a542)
2024-11-12 07:14:25 -05:00
Jelle Raaijmakers
957ee8276a LibWeb: Use right interface for custom SVG and MathML elements
The DOM spec gets overridden by both the SVG2 and MathML core specs in
that unknown elements should not inherit DOM::Element, but
SVG::SVGElement and MathML::MathMLElement respectively.

(cherry picked from commit 76e638b4ca10a91983877d6f6e7f037c1a720965)
2024-11-12 07:14:25 -05:00
Florian Cramer
950c5f823f LibXML: Set the doctype when parsing via Parser::parse_with_listener
This fixes at least one WPT test under /domparsing

(cherry picked from commit df7cac539e11315b0acae42cb4dbdf6ea39adcc8)
2024-11-12 07:14:25 -05:00
Ben Wiederhake
1a8ad7c7ed LibWeb: Refuse to fill float array with random values
This passes an additional test in WPT:
WebCryptoAPI/getRandomValues.any

(cherry picked from commit 4a6ce210b0c50b0efd2f0308f087e9fcf3ffd1db)
2024-11-12 07:14:25 -05:00
Jonne Ransijn
095c076941 LibCore: Respect system hard limit in set_resource_limits
This avoids an "Invalid argument (errno=22)" error
on systems with lower hard limits.

(cherry picked from commit c97af00355159b0dac9019b885af7c6016e75dc7)
2024-11-12 07:14:25 -05:00
Jonne Ransijn
de1ecc17ce AK: Add ASCII fast path for Utf8View::contains
This also makes `Utf8View::trim` significantly faster, since most
strings start and end with ASCII.

(cherry picked from commit 7f3269fb025051c3eb2794b15e785b85b0ce37f3)
2024-11-12 07:14:25 -05:00
Jonne Ransijn
8011896224 LibWeb/Fetch: Do not clone stored responses
Reading the RFC9111 spec makes it clear that the stored response was
not intended to be cloned. This is because there is a "clone response"
operation that is used in other places, but never for stored responses.

(cherry picked from commit afe74afa9e61569d35797d6ada5d54f0c22da412)
2024-11-12 07:14:25 -05:00
Jonne Ransijn
cd866a31e0 LibWeb/Fetch: Update cached responses when revalidating
Responses returned from `http_network_or_cache_fetch` were copied
directly from the cache, which is incorrect, since revalidation may
later modify the response, or even invalidate it, such as when the
`Access-Control-Allow-Origin` header is changed.

This fixes WPT test [wpt/cors/304.htm](http://wpt.live/cors/304.htm)

(cherry picked from commit c7a51ed297ebd0dcb200d8dc1ba3918880c56a55)
2024-11-12 07:14:25 -05:00
Magnus Johansson
099f907420 LibWeb: Fallback to auto when aspect ratio is degenerate as per spec
When aspect-ratio is degenerate (e.g. 0/1 or 1/0) we should
fallback to the same behaviour as `aspect-ratio: auto` according to spec
This commit explicitly handles this case and fixes five WPT test in
css/css-sizing/aspect-ratio (zero-or-infinity-[006-010])

(cherry picked from commit c6f77f4818a03411c14d9e60b743a7541a8280f6)
2024-11-12 07:14:25 -05:00
Chase Knowlden
5be3121822 LibWeb/HTML: Start implementing the download attribute
(cherry picked from commit 20376adbc3040104d0f80a0147c373b83a401a23)
2024-11-12 07:14:25 -05:00
Simek
88637f6ed3 LibWeb: Correct default ARIA Roles for few tags
(cherry picked from commit c9c67a6f24682512b88d41b3663aea8e4e97065d)
2024-11-12 07:14:25 -05:00