Commit graph

44941 commits

Author SHA1 Message Date
MacDue 4709f5961b Ladybird: Pass Gfx::IntSize by value 2022-12-25 07:58:58 -07:00
Aliaksandr Kalenik 88667ce9f0 Ladybird: Fix build with JS::MarkupGenerator's new string type usage
Fix to build after JS::MarkupGenerator got converted to use
new string type:
112b3f7342
2022-12-25 07:58:58 -07:00
Linus Groh 5a5c4f079b Ladybird: Update for AK::{String => DeprecatedString} rename 2022-12-25 07:58:58 -07:00
Baitinq 97dd5a085f Ladybird: Replace history entry if loading URL because of a redirect
We now replace the current history entry if the page-load has been
caused because of a redirect. This makes it able to traverse the
history if one of the entries redirects you, which previously
caused an infinite history traversion loop.

Depends on https://github.com/SerenityOS/serenity/pull/16004
2022-12-25 07:58:58 -07:00
Sam Atkins ec55b13e96 Ladybird: Add stub for notify_server_did_finish_handling_input_event
This doesn't need to do anything yet, but will do once we start passing
events to web content *before* they're passed to our GUI.
2022-12-25 07:58:58 -07:00
Timothy Flynn a1e380cc38 Ladybird/WebDriver: Support running headless WebDriver sessions
This adds a dependency from WebDriver to Lagom's headless-browser to be
used if the client's required capabilities indicate to do so.
2022-12-25 07:58:58 -07:00
Timothy Flynn 69cd0d6599 Ladybird: Update stored URL when a page starts/finishes loading
Similar to https://github.com/SerenityOS/serenity/commit/9782660. Unlike
Serenity's browser, this doesn't affect reloading the page, as Ladybird
refers to the History object for reloading (which is updated already on
page load). However, this URL is used for e.g. crash reporting, so let's
update it here as well.
2022-12-25 07:58:58 -07:00
Timothy Flynn 9a5f9c101c Ladybird: Implement updated alert/confirm/prompt IPC methods
WebContent now needs to interact with these dialogs asynchronously. This
updates WebContentView to hold a pointer to whatever dialog is open, and
implements the methods to interact with that dialog.
2022-12-25 07:58:58 -07:00
Idan Horowitz fad3fbfe26 Ladybird: Add block pop-ups checkbox to debug menu 2022-12-25 07:58:58 -07:00
Timothy Flynn 948c4ba102 Ladybird/WebDriver: Implement the cookie endpoints for Ladybird 2022-12-25 07:58:58 -07:00
Timothy Flynn 9e0db602ca Ladybird: Implement WebDriver for Ladybird :^)
This adds a WebDriver binary for Ladybird to make use of Serenity's
WebDriver implementation. This has to use the same IPC socket handling
that was used to make WebContent work out-of-process. Besides that, we
are able to reuse almost everything from Serenity.
2022-12-25 07:58:58 -07:00
Timothy Flynn 54321f49ad Ladybird: Implement WebDriver's navigation and window control endpoints 2022-12-25 07:58:58 -07:00
Timothy Flynn 4031630b49 Ladybird: Construct a WebDriverConnection when instructed to do so
The WebDriver will pass the --webdriver-fd-passing-socket command line
option when it launches Ladybird. Forward this flag onto the WebContent
process, where it will create the WebDriverConnection for IPC.
2022-12-25 07:58:58 -07:00
Timothy Flynn 7021d30288 Ladybird: Foward the WebContent passing socket FD by command line
Rather than needing to set another environment variable for WebDriver's
passing socket, let's forward these FDs by command line. This also moves
the creation of the WebContent connection to a helper function so that
the WebDriver connection can re-use it.
2022-12-25 07:58:58 -07:00
Timothy Flynn 39954f9e7f Ladybird: Give the WebContent socket a descriptive name
WebContent's main() will soon take over multiple sockets. Give the
existing WebContent socket a descriptive name to avoid confusion.
2022-12-25 07:58:58 -07:00
Baitinq e74dff7697 Ladybird/Misc: Add ladybird.nix for nix-shell support 2022-12-25 07:58:58 -07:00
Marco Cutecchia 5a9b891268 Ladybird: Stub out notify_server_did_request_fullscreen_window 2022-12-25 07:58:58 -07:00
Timothy Flynn e592c7691e Ladybird: Stub out history navigation WebView::ViewImplementation APIs
These were added for WebDriver, which doesn't have a Ladybird
implementation yet.
2022-12-25 07:58:58 -07:00
Timothy Flynn fcc0530e26 Ladybird: Stub out new cookie WebView::ViewImplementation APIs
These were added for WebDriver, which doesn't have a Ladybird
implementation yet.
2022-12-25 07:58:58 -07:00
Baitinq e80147afba Ladybird: Fix reloading functionality
Previously, reloading went back to the first page loaded by
WebView::load() or WebView::load_html(), as they are the only methods
that modify m_url, which is what the reload loaded. Now we handle
reloads in Tab.cpp by simply loading the last entry in the m_history.
2022-12-25 07:58:58 -07:00
Timothy Flynn 0b15fd4a12 Ladybird: Stub out new WebView::ViewImplementation APIs
These were added for WebDriver, which doesn't have a Ladybird
implementation yet.
2022-12-25 07:58:58 -07:00
Baitinq 15e4d151c3 Ladybird: Don't add initial about:blank load to history
The hackish initial loading of about:blank was previously added to the
history, so you could go back to it (which wasn't very ergonomic). Now
we set the m_is_history_navigation flag before loading it so it doesn't
get added to the history.
2022-12-25 07:58:58 -07:00
Timothy Flynn 5d0ab45ff4 Ladybird: Add new WebContent source file for WebDriver endpoints 2022-12-25 07:58:58 -07:00
Andreas Kling 385c12c8b6 Ladybird: Add subclass of WebSocket::WebSocketImpl using Qt networking 2022-12-25 07:58:58 -07:00
Gunnar Beutner acd70f44c2 Ladybird: Don't change window icons when background tabs change icons 2022-12-25 07:58:58 -07:00
Gunnar Beutner 5f3b82dcba Ladybird: Don't update window titles when background tabs change titles
Steps to reproduce:
1. Open the Cookie Clicker game in a tab.
2. Open another website in another tab and make that the current tab.
3. Observe how the window's title mentions Cookie Clicker.
2022-12-25 07:58:58 -07:00
Baitinq eaff4a1d65 Ladybird: Don't push to history when loading through history navigation
Previously we were always pushing to history on the on_load_start
callback. Now we only do that if we are NOT navigating through the
history navigation (loading pages by going back/forward). This is what
the SerenityOS browser does:^)
2022-12-25 07:58:58 -07:00
Baitinq 982174706b Ladybird: Handle forward and backward mouse buttons
We now emit a new signal for backward mouse button's mouseup and forward
mouse button's mouseup which is handled by going back and forward in the
history respectively:))
2022-12-25 07:58:58 -07:00
Andreas Kling ef553a4b76 Ladybird: Don't burn 100% CPU in EventLoopPluginQt::spin_until()
There's no point in busy-waiting for the condition to come true.
By passing the `WaitForMoreEvents` flag to `processEvents()`, we allow
Qt to block until it has something for us to react to.

This was extremely noticeable when waiting for large resources to
finish loading.
2022-12-25 07:58:58 -07:00
Andreas Kling bc6a6190d8 Ladybird: Disable HTTP2 as it's significantly slower
The slowdown is sometimes 5x, possibly more.

This is trivially confirmed by adding a large JS file to a page and
comparing the load time with a simple wget.
2022-12-25 07:58:58 -07:00
Linus Groh 216192143e Ladybird: Clean up linked libraries
- Add Qt::Core, Qt::Gui, LibGfx, LibIPC, and LibJS to the ladybird
  target, remove LibGL, LibSoftGPU, and LibWebSocket
- Add LibJS to the WebContent target, remove LibWebView
- Order them properly :^)

Regressed in https://github.com/SerenityOS/serenity/pull/15746.
Fixes #108.
2022-12-25 07:58:58 -07:00
Linus Groh 66c69654a6 Ladybird/Documentation: Bump GCC requirement to >= 12
See https://github.com/SerenityOS/serenity/pull/15797
2022-12-25 07:58:58 -07:00
Gunnar Beutner dd20b34acb Ladybird: Ignore SIGINT when we're being debugged
Let's ignore SIGINT if we're being debugged because GDB incorrectly
forwards the signal to us even when it's set to "nopass". See
https://sourceware.org/bugzilla/show_bug.cgi?id=9425 for details.
2022-12-25 07:58:58 -07:00
Linus Groh 11b730fccb Ladybird: Use Browser's History.{cpp,h}
There are no custom changes for Ladybird in the current copies of those
files, so we just need to ensure to keep Ladybird up to date for any
changes made upstream.
2022-12-25 07:58:58 -07:00
Linus Groh c91978baa6 Ladybird: Use Browser's CookieJar.{cpp,h}
There are no custom changes for Ladybird in the current copies of those
files, so we just need to ensure to keep Ladybird up to date for any
changes made upstream.

This fixes a build issue introduced by https://github.com/SerenityOS/serenity/pull/15736.
2022-12-25 07:58:58 -07:00
networkException fb71dc5141 Ladybird/CMake: Launch gdb with follow fork mode to debug WebContent 2022-12-25 07:58:58 -07:00
networkException d1b2c2977e Ladybird/CMake: Add options for enabling {A,M,UB}SAN
This patch adds convenient flags for enabling ASAN, MSAN and UBSAN.
2022-12-25 07:58:58 -07:00
Andreas Kling 8b593c9884 Ladybird: Add Ctrl+Shift+G shortcut to force a garbage collection 2022-12-25 07:58:58 -07:00
Andrew Kaster ccf95631ba Ladybird: Add Userland/ subdirs of Lagom binary dir to include path
Recent Serenity changes put generated files for libraries in
_deps/lagom-build/Userland/Libraries rather than lagom-build/Libraries.
2022-12-25 07:58:58 -07:00
Andreas Kling 6d1db6801c Ladybird/RequestManagerQt: Unwrap multiple cookies masquerading as one
Qt can wrap any number of cookies into a single Set-Cookie header in the
network responses it gives us. We now use the QNetworkReply::header()
API to get a "cooked" list of the cookies, and then rewrap them in a
format suitable for LibWeb.

Sites that send multiple Set-Cookie headers in one response now work
a lot better. :^)
2022-12-25 07:58:58 -07:00
Andreas Kling 195cdb33de Ladybird/WebContentView: Make Tab and Shift+Tab work
These didn't work, for two reasons:

1. Qt swallows all Tab key presses by default. We have to override
   the event() function in order to receive them.

2. Qt transforms Shift+Tab into a fake "Backtab" key. We have to
   undo this transformation and send Shift+Tab to WebContent.
2022-12-25 07:58:58 -07:00
Andreas Kling c154d94964 Ladybird/WebContentView: Accept focus and notify WebContent on change 2022-12-25 07:58:58 -07:00
Andreas Kling 71dadabfaa Ladybird: Hook up the CookieJar again after WebContent introduction 2022-12-25 07:58:58 -07:00
Idan Horowitz 775332e179 Ladybird: Accept file paths, domains, and URLs as an argument
This makes opening test files much more ergonomic :^)
2022-12-25 07:58:58 -07:00
Andreas Kling 52a7282c64 Ladybird: Close the other side's file descriptors after forking
When spawning a WebContent process, we have to close the file
descriptors belonging to the "other side" in both processes, or they
will not get naturally "cleaned up" when one of the processes exits.

Fixes #93
2022-12-25 07:58:58 -07:00
Andreas Kling 7362755f30 Ladybird: Implement EventLoopPluginQt::quit()
This breaks out of the main Qt event loop.
2022-12-25 07:58:58 -07:00
Andrew Kaster 6fff03713c Ladybird: Ensure that installed ladybird can launch WebContent process
Always call platform_init after there's a QApplication, because in the
installed configuration that's how we find the resources.

Try QCoreApplication::applicationDirPath() after looking in ./WebContent
for the WebContent process. In an installed configuration, ladybird and
WebContent will both be in $PREFIX/bin.

Add install rules for WebContent and its linked libraries, for if they
ever differ from ladybird's.
2022-12-25 07:58:58 -07:00
Andreas Kling bbb08c1912 Ladybird: Remove some unnecessary includes in main.cpp 2022-12-25 07:58:58 -07:00
Andreas Kling 0a8c86a9d9 Ladybird: Load about:blank in new tabs
This makes the JS console usable in new tabs, without having to load
something first.
2022-12-25 07:58:58 -07:00
Luke Wilde e9135583bd Ladybird: Make ladybird depend on WebContent
This causes CMake to output a WebContent build, without this it would
not build WebContent and Ladybird would be unusable since it couldn't
find the WebContent executable.
2022-12-25 07:58:58 -07:00