Commit graph

64044 commits

Author SHA1 Message Date
Jamie Mansfield
86e20ea246 LibWeb/UIEvents: Implement CompositionEvent 2024-10-08 11:45:39 +02:00
Jamie Mansfield
9fce70069d LibWeb/UIEvents: Implement InputEvent 2024-10-08 11:45:39 +02:00
Jamie Mansfield
60d9c3929c LibWeb: Correct forward for UIEvents::UIEvent 2024-10-08 11:45:39 +02:00
Andreas Kling
13ba491924 LibWeb: Don't let input element placeholders influence line-height
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, 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
Before this change, we transferred the input element's line-height to
both the editable text *and* the placeholder. This caused some strange
doubling of the effective line-height when the editable text was empty,
pushing down the placeholder.
2024-10-08 08:12:07 +02:00
Tim Ledbetter
e1eeb93cc6 LibWeb: Fire iframe load event on document close
This matches the behavior of other browsers.
2024-10-08 06:55:01 +02:00
Timothy Flynn
00487a7b25 LibWebView+LibWeb: Remove ResourceLoader and WebSocket adapters
These were used to provide a layer of abstraction between ResourceLoader
and the networking backend. Now that we only have RequestServer, we can
remove these adapters to make the code a bit easier to follow.
2024-10-08 06:52:51 +02:00
Timothy Flynn
3de86cf0fa LibRequests: Add a forwarding header 2024-10-08 06:52:51 +02:00
Timothy Flynn
1b324f3ae1 LibWebView+UI: Remove Qt networking infrastructure
Now that we use libcurl, there's no reason to keep Qt networking around.
Further, it doesn't support all features we need anyways, such as non-
buffered request handling for SSE.
2024-10-08 06:52:51 +02:00
Tim Ledbetter
fd8d350b47 LibWeb: Don't discard PostedMessage tasks when closing a worker
The spec expects `postMessage()` to act as if it is invoked
immediately. Since `postMessage()` isn't actually invoked immediately,
keep tasks with source `PostedMessage` in the task queue, so that these
tasks are processed. Fixes a hang when `WorkerGlobalScope.close()` is
called immediately after `postMessage()`.
2024-10-08 06:51:04 +02:00
Noah Bright
d30ae92b82 LibWeb: Define PerformanceEventTiming
https://www.w3.org/TR/event-timing/#sec-performance-event-timing

Add idl, header and stubs for PerformanceEventTiming interface.

Two missing `PerformanceEntry` types that have come up in issues
are the `first-input` and the `event` entryTypes. Those are both
this.

Also, because both of those are this same interface, the static
methods from the parent class are difficult to implement because
of instance-specific details. Might either need subclasses or to
edit the parent and also everything that inherits from it :/
2024-10-08 03:44:55 +02:00
Timothy Flynn
be9071834e LibWeb: Wait for the iframe load before completing the beforeunload test
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, 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
This test caused some flakiness due to the about:blank load it triggers.
It causes headless-browser to receive a load event for about:blank. If
we have moved onto the next test before that event arrived, that test
would ultimately time out, as its own load will have been dropped while
the about:blank load is still ongoing.

This patch makes us wait for that iframe load event before completing
the test.

We may want to consider never sending subframe load events to the UI
process as well. We really only care about top-level page loads in the
receivers of that event.
2024-10-07 16:03:42 -04:00
Tim Ledbetter
d0008ae5e0 LibWeb: Don't print messages from workers to the console twice
Previously, any message logged to the console within a worker with a
log level greater than trace was printed twice.
2024-10-07 21:22:12 +02:00
Timothy Flynn
598fabbdd3 LibWebView: Increase the open file limit in a more central location
We don't create a ChromeProcess in headless-browser, so it is currently
not increasing it's open file limit. This is causing crashes on macOS,
which has a very low default limit.
2024-10-07 14:03:03 -04:00
Ali Mohammad Pur
cb4b2ca681 Meta: Avoid messing with the system python in CI
This uses the setup-python action in the setup action to install python
3.12, and removes the --break-system-packages hack that the system pip
requires.
2024-10-07 11:45:21 -06:00
Aliaksandr Kalenik
97066f09f4 LibWeb: Use PaintableBox::is_scrollable() while dispatching wheel event
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, 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
With this change we use the same function to determine whether to render
scroll thumb and whether box wants to accept scroll UI events.
2024-10-07 18:35:24 +02:00
Aliaksandr Kalenik
a46c2a0887 LibWeb: Forbid scrolling of viewport if overflow=hidden
Before this change viewport was allowed to be scrolled whenever it has a
scrollable overflow, which is not correct when overflow is specified to
be hidden.
2024-10-07 18:35:24 +02:00
Khaled Lakehal
77761e123d LibWeb/CSS: Add support for unicode-bidi property 2024-10-07 14:57:15 +01:00
Gingeh
16f2f6aa42 LibWeb: Make empty media query lists evaluate to true 2024-10-07 14:50:57 +01:00
Shannon Booth
30377e6e35 LibWeb: Do not spin the event loop on processing iframe attributes
Partially reverting a3149c1ce9

Spinning the event loop was causing a crash on:

https://wpt.live/url/percent-encoding.window.html

As it was turning what is meant to be a synchronous operation into an
asynchronous one.

The sequence demonstrated by the reproducing test is as follows:
  * A src attribute is changed for the iframe
  * process_the_iframe_attributes entered with valid content navigable
  * Event loop is spun, allowing the queued iframe removal to execute
  * process_the_iframe_attributes continues with null content navigable
  * 💥
2024-10-07 15:10:41 +02:00
Timothy Flynn
62e732e5ad Revert "WebContent+WebDriver: Inform WebDriver when a window is closed"
This reverts commit 556a0936dd.

This was causing a large slow down in WPT, and a crash on macOS during
session shutdown when running WebDriver manually.
2024-10-07 07:40:22 -04:00
Carwyn Nelson
30f59cfe1a LibWeb: Skip transitions for pseudo elements
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, 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
Transitions are currently not implemented for pseudo elements which
causes the transition to be applied to the "real"/"parent" element. When
a transition adjusts width/height on a pseudo element this causes the
real elements layout to break.

As a quick fix we just skip doing transitions when they are against
pseudo elements.
2024-10-07 09:31:40 +02:00
Andreas Kling
2fdf2b9215 LibWeb: Allow SVG root elements to have visible overflow
We were overly aggressive in clipping SVG roots, which effectively made
them behave as if they always had `overflow: hidden`.

This fixes incorrect clipping of the logo on https://basecamp.com/
2024-10-07 09:31:25 +02:00
Shannon Booth
f2134dc1e9 LibWeb: Throw exception for invalid URL before creating traversable
Which fixes the following WPT test from failing due to issues stemming
from all of the windows which have been opened.

https://wpt.live/url/failure.html

This will give us 1205 new subtests passing in WPT.
2024-10-06 22:54:27 -06:00
Neil Viloria
1e29a3ae13 Documentation: Update command for regenerating test expectations 2024-10-06 22:48:13 -06:00
Timothy Flynn
dfabdb7fed headless-browser: Support running LibWeb tests concurrently
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, 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
We currently create a single WebView and run all 1400+ LibWeb tests in
serial over that WebView. Instead, let's create as many WebViews as
there are processes on the system, and run LibWeb tests concurrently
over those views.

To do this performantly requires that we never block the main thread of
the headless-browser process once the tests are running. Doing so will
effectively pause execution of all other tests. So test execution is now
Promise-based.

On my machine (with a hardware concurrency of 32), this reduces the run
time of LibWeb tests from 31.382s to 3.640s. CPU utilization increases
from 5% to 67%.
2024-10-06 19:24:25 +02:00
Timothy Flynn
49a53a6194 headless-browser: Move completion handlers for dump/ref tests to lambdas
No functional difference here, and this probably seems a bit silly, but
the purpose is to make the diff of a future patch much easier to read.
2024-10-06 19:24:25 +02:00
Timothy Flynn
08426efebc headless-browser: Define the test-related structures earlier
And re-order the Test fields to have the test mode first.

No functional change - this is just to reduce diff noise a bit in an
upcoming patch.
2024-10-06 19:24:25 +02:00
Timothy Flynn
e6975ec76a headless-browser: Make taking screenshots during tests more asynchronous
This will be necessary to run tests concurrently, otherwise taking a
screenshot for one test will block all tests from executing.
2024-10-06 19:24:25 +02:00
Timothy Flynn
642a611418 headless-browser: Do not track the current test path
Instead, just log the view's current URL when the WebView crashes. It
won't make any sense to track the executing test this way once there are
many tests running concurrently.
2024-10-06 19:24:25 +02:00
Timothy Flynn
adfe120d1e headless-browser: Migrate service management to the browser Application
We currently run all tests in a single WebView instance. That instance
owns the process-wide RequestClient / ImageDecoderClient, so if we were
to create a second instance, we'd run into trouble.

This migrates ownership of these services to the Application class, and
makes the Application own the WebView. In the future, this will let the
Application own a list of views.
2024-10-06 19:24:25 +02:00
Timothy Flynn
377d1f22ae headless-browser: Make the browser Application more accessible
We currently pass around the individual fields of the Application class
to a bunch of free functions. This makes adding a new field, and passing
it all the way to e.g. run_dump_test pretty annoying, as we have to go
through about 5 function calls.

This will get much worse in an upcoming patch to run LibWeb tests
concurrently. There, we will have to further pass these flags around as
async lambda value captures.

To make this nicer, just access the flags from Application::the(), which
is how the "real" UIs access their application objects as well.
2024-10-06 19:24:25 +02:00
Timothy Flynn
b1718f5691 LibWeb: Disable remaining Worker tests for now
These time out on macOS CI.
2024-10-06 19:24:25 +02:00
Aliaksandr Kalenik
d0463bf652 LibWeb: Simplify static position calculation for block-level boxes
There is no need to save vertical offset in UsedValues to use later,
when static position could be assigned directly upon encountering
abspos box.
2024-10-06 18:51:16 +02:00
Aliaksandr Kalenik
7225087fa2 LibWeb: Replaced remaining usage and delete Size::resolved() 2024-10-06 18:51:03 +02:00
Timothy Flynn
76152845fd LibWeb: Remove debug spam from Navigator methods
These are logged ~1000 times on fast.com.
2024-10-06 18:50:44 +02:00
Aliaksandr Kalenik
908455ab06 LibWeb: Skip queuing a rendering task if task queue already contains it
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, 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
If, by the time we need to schedule rendering of the next frame, the
previous one is still not processed, we could skip it instead of growing
task queue.

Should help with https://github.com/LadybirdBrowser/ladybird/issues/1647
2024-10-06 16:25:33 +02:00
Shannon Booth
ea971792b5 LibWeb: Throw a SyntaxError on invalid URL for Location href setter
Aligning with a spec update, fixing 195 tests for:

https://wpt.live/url/failure.html
2024-10-06 10:06:26 -04:00
Andreas Kling
59ed823724 LibWeb: Resolve flex item % main size to 0 during min-content sizing
When the flex container is sized under a min-content constraint in the
main axis, any flex items with a percentage main size should collapse
to zero width, not take up their own intrinsic min-content size.

This is not in the spec, but matches how other browsers behave.

Fixes an issue where the cartoons on https://basecamp.com/ were way
too large. :^)
2024-10-06 16:04:00 +02:00
Aliaksandr Kalenik
1a78edb8c9 LibWeb: Define static position calculation separately for each FC
Static position of a box is defined by formatting context type it
belongs to, so let's define this algorithm separately for each FC
instead of assuming FormattingContext::calculate_static_position_rect()
understands how to handle all of them.

Also with this change calculate_static_position_rect() is no longer
virtual function.
2024-10-06 15:45:08 +02:00
Timothy Flynn
6ee1c4c634 CI: Install pyyaml from pip
Homebrew has disabled the pyyaml package for some reason.
2024-10-06 09:42:35 -04:00
Timothy Flynn
5056bda043 LibCore: Ensure shared memory file names on macOS are unique
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, 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
At least on my mac, clock_gettime only provides millisecond resolution.
So if many WebContent processes are opened at once, it is not unlikely
that they will all create their backing stores within the same ms. When
that happens, all but the first will fail (and crash).

To prevent this, generate the shared memory file name based on the PID
and a static counter.
2024-10-06 07:44:06 +02:00
Timothy Flynn
aa1df95b31 LibWeb: Implement window.close and window.closed 2024-10-06 01:42:24 +01:00
Timothy Flynn
ae130822a0 headless-browser: Allow popups for LibWeb testing 2024-10-06 01:42:24 +01:00
Timothy Flynn
ce11a90726 WebContent+WebDriver: Handle when new windows are immediately closed
This happens when window.close() is invoked immediately upon a window
being opened.
2024-10-06 01:42:24 +01:00
Timothy Flynn
556a0936dd WebContent+WebDriver: Inform WebDriver when a window is closed from JS
This hooks into the same PageClient method that closes the UI tab after
an invocation to window.close().
2024-10-06 01:42:24 +01:00
Timothy Flynn
84df1bf585 LibWeb: Mark a BC's navigable as destroyed if it does not exist 2024-10-06 01:42:24 +01:00
Timothy Flynn
5aa50bff8b LibWeb+WebDriver+WebContent: Implement the Element Click endpoint 2024-10-06 01:42:24 +01:00
Timothy Flynn
95bf6c9877 WebContent: Do not wait for navigations on BCs that have no navigable
This avoids a crash seen in WPT when a click event is fired on a BC that
has been removed from the document.
2024-10-06 01:42:24 +01:00
Timothy Flynn
ab3cfd9bbb WebContent: Separately store the WebDriver parent and top-level BCs
We are currently trying to access the current parent and top-level
browsing contexts from the current BC itself. However, if the current BC
is closed, its association to the parent and top-level BCs is lost, and
we are no longer able to handle WebDriver endpoints involving those BCs.

Instead, let's store the parent and top-level BCs separately, and update
them in accordance with the spec.
2024-10-06 01:42:24 +01:00
Timothy Flynn
969361abdb WebDriver: Allow deleting sessions with an invalid window handle
This case was missed in commit b5aa8f65b1.
2024-10-06 01:42:24 +01:00