Commit graph

1108 commits

Author SHA1 Message Date
Sam Atkins
b7efb61fbe Tests/LibWeb: Restructure Ref and Screenshot test dirs to match others
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
Now each test type has the same directories:
- input
- expected
- data

Also, tests can be in subdirectories within ./input.
2024-11-05 14:02:07 +00:00
rmg-x
79046c73da RequestServer: Extract HTTP reason phrase from headers 2024-11-02 21:05:07 +01:00
Shannon Booth
fd32f17c56 headless-browser: Support running XHTML tests 2024-11-01 14:02:14 -04:00
Timothy Flynn
be1d400369 LibWebView: Add a browser flag to collect garbage after each allocation 2024-11-01 00:35:54 +01:00
Shannon Booth
e44702f090 LibWeb: Construct ResourceLoader with a GC Heap
This will allow us to easily make use of HeapFunctions instead of
SafeFunction for all of the callbacks in ResourceLoader.
2024-10-30 20:55:45 +01:00
Timothy Flynn
53d5c7084e UI/AppKit: Extract bare minimum WebView functionality into its own class
When a window containing a WebView becomes visibile, we have to inform
WebContent. This was only implemented for the Tab class (not Inspector
or Task Manaager).

This patch adds LadybirdWebViewWindow to contain the bare minimum needed
to render a LadybirdWebView. All windows containing a WebView inherit
from this class, to ensure their WebContent processes know they became
visible.
2024-10-30 08:51:14 +01:00
Timothy Flynn
8132587b3b headless-browser: Implement WebView callbacks for WebDriver rect changes 2024-10-29 11:03:20 +00:00
Timothy Flynn
3ca2ee9c72 LibWeb+WebContent+WebDriver+UI: Make window min/maximize asynchronous
This follows suit of previous changes to never block the WebContent
process in WebDriver endpoints.
2024-10-29 11:03:20 +00:00
Timothy Flynn
bc67bdb160 LibWeb+UI: Initialize the system visibility state to 'hidden'
Not only does this match the spec, but otherwise when the UI process
sends us the initial visibility update, we would ignore the message as
we believed we were already visible (thus the update would not reach the
document).
2024-10-29 11:03:20 +00:00
Timothy Flynn
fa83cc722c LibWeb+WebContent+WebDriver+UI: Make window rect updates asynchronous
It's currently possible for window size/position updates to hang, as the
underlying IPCs are synchronous. This updates the WebDriver endpoint to
be async, to unblock the WebContent process while the update is ongoing.
The UI process is now responsible for informing WebContent when the
update is complete.
2024-10-29 11:03:20 +00:00
Timothy Flynn
e4f0e745a4 UI/Qt: Send the rect of the window itself to WebContent
This ensures that the live values we return to WPT match the requested
values.
2024-10-29 11:03:20 +00:00
Timothy Flynn
54f6db01af UI/Qt: Do not multiply window position/size by the device pixel ratio
On macOS, this is resulting in values of window.screenX, window.screenY,
window.outerWidth and window.outerHeight that are 2x larger than Safari,
Firefox, and our AppKit UI.
2024-10-29 11:03:20 +00:00
Timothy Flynn
00a486d072 UI/AppKit: Convert window origins sent from WebDriver to AppKit's origin
Window origins in AppKit are the bottom-left position of the NSWindow,
relative to the bottom-left of the screen. So we must do some alignment
of the top-left position received from WebDriver.
2024-10-29 11:03:20 +00:00
Timothy Flynn
102a125ea5 UI/AppKit: Inform WebContent of the UI window position/size
This is required for APIs like window.screenX, as well as for WebDriver
and WPT.
2024-10-29 11:03:20 +00:00
Timothy Flynn
777eec095b headless-browser: Implement dialog-related WebView callbacks
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 allows us to headlessly run WPT tests which involve dialogs.
2024-10-28 23:27:55 +01:00
Timothy Flynn
6590b8a1a7 headless-browser: Send a dummy screen rect to WebContent
The window.open spec assumes the User Agent knows its screen size. Send
a fake screen from headless-browser to WebContent.
2024-10-28 23:27:55 +01:00
Andreas Kling
be03002780 Headless: Allow overriding the test timeout with a CLI parameter
Also bump the test timeout when running ctest to 120 seconds,
to accommodate the slow GCC CI.
2024-10-27 12:10:28 +01:00
Andreas Kling
ec0838b84e LibWeb: Implement HTMLElement.innerText closer to spec
And here's the wild part: instead of cloning WPT tests, import the
relevant WPT tests that this fixes into our own test suite.

This works by adding a small Ladybird-specific callback in
resources/testharnessreport.js (which is what that file is meant for!)

Note that these run as text tests, and so they must signal the runner
when they are done. Tests using the "usual" WPT harness should just
work, but tests that do something more freestyle will need manual
signaling if they are to be imported.

I've also increased the test timeout here from 30 to 60 seconds,
to accommodate the larger WPT-style tests.
2024-10-27 12:10:28 +01:00
Kostya Farber
3e7faae647 Qt: Add box icon to line box debug menu action 2024-10-26 17:41:16 +02:00
Timothy Flynn
ea9abe26e1 UI/Qt: Execute dialogs opened from the page asynchronously
Invoking exec() entirely blocks the UI application's main thread. Qt
explicitly recommends against this. In practice, it seems prevents some
IPC messages from being handled by the UI until the dialog is closed by
the user.

Instead, use open() (which is non-blocking) and set up a signal handler
to deal with the result.
2024-10-26 11:25:42 +02:00
Timothy Flynn
9d12ec7cb9 headless-browser: Force-enable font config via code rather than CMake
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
It is easy to forget to set this flag on macOS, where doing so causes
many tests to fail. So let's just set it via code along with other
options to make it a bit more foolproof.
2024-10-24 20:41:30 -04:00
Timothy Flynn
d2d861ca8a UI/AppKit: Only check the NSEvent isARepeat flag in key down/up events
We call ns_event_to_key_event for the NSFlagsChanged event as well. By
retrieving the isARepeat flag on those events, we are guaranteed to
throw an exception.

See:
https://developer.apple.com/documentation/appkit/nsevent/1528049-arepeat?language=objc

    Raises an NSInternalInconsistencyException if sent to an
    NSFlagsChanged event or other non-key event.
2024-10-24 08:52:56 -04:00
Andrew Kaster
7372b2af48 LibIPC+Everywhere: Introduce an IPC Transport abstraction
This abstraction will help us to support multiple IPC transport
mechanisms going forward. For now, we only have a TransportSocket that
implements the same behavior we previously had, using Unix Sockets for
IPC.
2024-10-23 12:29:01 -06:00
Andrew Kaster
9a6eccc590 LibWebView+LibCore: Move IPCProcess into WebView::Process
Ladybird's HelperProcess.cpp was the only user of the IPCProcess class.
Moving the helper class from LibCore allows for some more interesting
LibIPC changes in the upcoming commits.
2024-10-23 12:29:01 -06:00
Jelle Raaijmakers
9309cc9df3 UI+LibWeb+WebContent: Implement KeyEvent repeat property
When a platform key press or release event is repeated, we now pass
along a `repeat` flag to indicate that auto-repeating is happening. This
flag eventually ends up in `KeyboardEvent.repeat`.
2024-10-22 11:20:35 -04:00
Jelle Raaijmakers
cf315d54ec UI+LibWeb: Remove unused includes 2024-10-22 11:20:35 -04:00
Timothy Flynn
b24a7079f1 LibWeb+WebDriver: Add a flag to default WebDriver to headless mode
We previously only supported enabling headless mode on a per-session
basis via the capabilities record. We don't have the ability to mutate
this record from WPT, so this adds a flag to set the default mode.
2024-10-22 04:24:31 +01:00
Timothy Flynn
a67018b2fc WebDriver: Use the same command line arguments for all browser chromes
In other words, pass the same flags to headless-browser.
2024-10-22 04:24:31 +01:00
Timothy Flynn
b73f9fef5a headless-browser: Support creating child web views
This is used when a page calls window.open, and is relied upon heavily
by WPT.
2024-10-22 04:24:31 +01:00
Timothy Flynn
34b8784dd9 headless-browser: Do not immediately exit when running under WebDriver
We need to spin the Application's event loop.
2024-10-22 04:24:31 +01:00
Gabriel Tassinari
07400b515c Qt: Fix -Werror=deprecated-declarations when using Qt > 6.7
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
2024-10-20 21:35:42 -06:00
Timothy Flynn
1aab7b51ea LibWebView: Generate hyperlinks for attributes that represent links
On the view-source page, generate anchor tags for any 'href' or 'src'
attribute value we come across. This handles both when the attribute
contains an absolute URL and a URL relative to the page.

This requires sending the document's base URL over IPC to resolve
relative URLs.
2024-10-20 08:50:01 +02:00
Andrew Kaster
36a8ad9157 LibGfx: Move FontDatabase internals to SystemFontProvider interface
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 will be the first step is making better use of system libraries
like fontconfig and CoreText to load system fonts for use by the UI
process and the CSS style computer.
2024-10-15 15:09:16 -06:00
Galvin
e8ff9b6eb4 UI/AppKit: Fix tab title icon and text layout
Make the tab title icon and text vertical center
2024-10-15 11:44:26 -04:00
Sam Atkins
6114e69a53 headless-browser: Early-out with an error if no tests are found
Previously this would just hang - I assume because the
`all_tests_complete` promise could never get resolved without any tests
running.
2024-10-14 11:55:44 -04:00
Timothy Flynn
7bb9d0131c headless-browser: Add a flag to log the slowest 10 LibWeb tests
Useful for finding tests that take a long time to execute.

As of this commit, on macOS, we have:

Text/input/cookie.html: 1228ms
Text/input/css/transition-basics.html: 1060ms
Text/input/HTML/DedicatedWorkerGlobalScope-instanceof.html: 182ms
Text/input/WebAnimations/misc/animation-events-basic.html: 148ms
Text/input/Crypto/SubtleCrypto-deriveBits.html: 130ms
Text/input/IntersectionObserver/observe-box-inside-container-with-scrollable-overflow.html: 117ms
Text/input/navigation/attempt-navigating-object-without-a-document.html: 109ms
Text/input/css/getComputedStyle-print-all.html: 71ms
Text/input/WebAnimations/misc/animation-single-iteration-no-repeat.html: 61ms
Text/input/WebAnimations/animation-methods/updatePlaybackRate.html: 55ms

And on Linux:

Text/input/cookie.html: 1326ms
Text/input/css/transition-basics.html: 1155ms
Screenshot/text-shadow.html: 772ms
Screenshot/css-background-repeat.html: 622ms
Screenshot/object-fit-position.html: 541ms
Screenshot/css-background-position.html: 456ms
Screenshot/css-gradients.html: 451ms
Screenshot/border-radius.html: 400ms
Screenshot/svg-radialGradient.html: 398ms
Text/input/css/getComputedStyle-print-all.html: 325ms
2024-10-14 08:25:41 +02:00
thislooksfun
ef65694ac0 CMake: Fix codesigning error on Intel macOS
Some checks are pending
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
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
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
Without this fix trying to build a Debug build on x86_64 macOS failed
with "Build/ladybird-debug/bin/Ladybird.app: code object is not signed
at all"
2024-10-12 17:01:14 -06:00
Timothy Flynn
567a6cc02d UI: Separate headless-browser into multiple files
The main goal here is to improve maintainability of headless-browser.
2024-10-11 09:09:40 +02:00
Timothy Flynn
79365c9519 UI: Migrate headless-browser to be alongside other Ladybird chromes
The headless-browser source is getting a bit unwieldy. The ordering of
class and method definitions is fragile; e.g. the application and web
view classes each require full definitions of each other. So it has
reached the point where it makes sense to give headless-browser some
better file structure.

To prepare for that, this patch simply moves its source to live along-
side the other browser chromes. This location is a bit better prepared
for creating more files, as the Utilities folder doesn't even have its
own CMakeLists.txt.
2024-10-11 09:09:40 +02:00
Timothy Flynn
4fcaeabe1a LibWeb+UI: Detect and handle left vs. right modifier keys
Some checks are pending
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
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
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
Our handling of left vs. right modifiers keys (shift, ctrl, etc.) was
largely not to spec. This patch adds explicit UIEvents::KeyCode values
for these keys, and updates the UI to match native key events to these
keys (as best as we are able).
2024-10-09 19:10:02 +02:00
Timothy Flynn
eabd5b0f22 UI/AppKit: Send keyboard events for modifier-only key presses/releases
If the user only presses the shift key, for example, we are required to
still send that event to WebContent and generate the corresponding JS
events. Unfortunately, NSApp does not inform us of these events via the
keyDown/keyUp methods. We have to implement the flagsChanged interface,
and track for ourselves what modifier keys were pressed or released.
2024-10-09 19:10:02 +02:00
Timothy Flynn
15e7aaee1a Meta: Remove the WPT test target from CMake
The run script it refers to no longer exists.
2024-10-08 07:41:07 -04:00
Timothy Flynn
8b3a5d0b96 UI/Qt: Remove Qt networking linkage from WebContent/WebWorker
Missed in commit 1b324f3ae1.

Note that the UI process still links Qt::Network, as it uses that infra
for autocomplete queries currently.
2024-10-08 07:41:07 -04: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
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
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
Andreas Kling
cc4b3cbacc Meta: Update my e-mail address everywhere
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
2024-10-04 13:19:50 +02:00
rmg-x
1f365ba44a UI/Qt: Simplify link context menu and update keyboard shortcuts
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
Removes the unnecessary separator, redundant open action, and changes
shortcuts to match other browsers.
2024-10-04 07:40:18 +01:00
Andrew Kaster
3ecf6de652 LibMedia+Ladybird: Use pkg_check_modules to find pulseaudio
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
2024-10-02 20:23:03 -04:00
Timothy Flynn
3393a74771 UI/Qt: Do not create signal notifiers until after an event loop exists
We are currently creating a signal socket and socket notifier before the
Qt event loop itself has been created. Thus, when we receive a signal,
we are not actually notified when we write that signal number to the
signal socket.

This was also the source of the following error message being displayed
on every launch of the browser:

    QSocketNotifier: Can only be used with threads started with QThread
2024-10-01 12:23:35 -04:00