Commit graph

63758 commits

Author SHA1 Message Date
mrdcbrush
588d79e36e LibWebView: Add Kagi search engine to menu
LibWebView: Add Kagi search engine to selection menu
(cherry picked from commit b757ee0bc8863b7785fe6f5f15ae6d4d3c82896f)
2024-11-12 22:26:21 -05:00
Andreas Kling
b0d8d9ef4a LibWasm: Make BytecodeInterpreter overrides final
This gives us free devirtualization of some hot calls inside the
bytecode interpreter. Most notably the did_trap() checks.

Modest performance improvement on the https://figma.com/ landing page.

(cherry picked from commit 2f3128333dcd5a781f35272800631d6cf03803ad)
2024-11-12 22:26:21 -05:00
Ali Mohammad Pur
28af9da66f LibWasm: Allow all Value::to<Integral>() calls
This brings back the old behaviour of Value::to<short>() (and other
similar calls), which WASI depends on.
To make sure all similar issues are caught in the future, this commit
also introduces an static assertion in Value::to().

(cherry picked from commit 0d05ab2ad0cc56cc6fe9ee647dfcfda44a92b4f2)
2024-11-12 22:26:21 -05:00
Sebastian-Webster
584e555f33 LibWebView: Add Ecosia search engine
(cherry picked from commit b0e3b289299728583847590209f9ed4b9083bbe3)
2024-11-12 22:26:21 -05:00
Ali Mohammad Pur
7d1b4c9ee0 LibWasm: Use braces to initialize Reference::Foo classes
These have no declared constructor, so apple clang and clang clang seem
to disagree on some versions.

(cherry picked from commit d2ff92077b2a4ead0a1ef65e7131702e1152cbeb)
2024-11-12 22:26:21 -05:00
Diego Frias
a97996351f LibWasm: Remove type information from Value
Gets fib(30) from 380ms to 340ms.

(cherry picked from commit a58704296cd36d3080dbf8f1be49300de2c25ea9;
amended to comment out two dbgln_if()s that no longer compile after
this change if WASM_TRACE_DEBUG is defined to 1 -- see comments on
LadybirdBrowser/ladybird#960. Likewise, one dbgln_if() in Wasi.cpp
got commented out as well)
2024-11-12 19:58:14 -05:00
Diego Frias
dea772ab0f LibWasm: Directly remove from the stack when clearing a label
Theoretically, the previous "pop, then push" method should be faster,
but it's actually faster to just remove from the stack directly.

(cherry picked from commit a2448308fd90ba0aafd42587a091c0da3c037ba9)
2024-11-12 19:58:14 -05:00
Diego Frias
764529cdc1 LibWasm: Inline bytecode interpreter instruction interpretation
Gets fib(30) from 480ms to 380ms.

(cherry picked from commit b73b17aab457bdeb33ada917ae7217aab81a664b)
2024-11-12 19:58:14 -05:00
Diego Frias
6a1d2f990c LibWasm: Split main interpreter stack into three
Instead of one stack to hold frames, labels, and values, there is now
three separate stacks. This speeds up fib(30) from 580ms to 480ms.

(cherry picked from commit a3b077c6415e0f4038b8c8da1e1e9c9cc2df5f0a)
2024-11-12 19:58:14 -05:00
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