This adds support for WebSocket subprotocols to WebSocket DOM
objects, with some necessary plumbing to LibWebSocket and its
clients.
See the associated pull request for how this was tested.
This allows the WebDriver to take advantage of the common helper process
spawning code when launching ladybird, and to not assume a particular
directory layout.
Use a list of executables to make sure that we don't miss any of the
applications used by Ladybird and its friends like WebDriver, and make
sure to install include all executables and their runtime dependencies.
Use the new get_paths_for_helper_process method in Ladybird to query
Qt for the runtime path of the current executable as well as the build
directory paths.
Previously when there was a very long url that spanned outside of the
address bar, the text shown would be the one starting from the very end
of the url instead of from the beginning, so you would be seeing the
query parameters for example, instead of the domain.
These changes will prevent duplication of code later when there will
also be the possibility to navigate to the homepage url as defined in
the settings on startup.
Don't use _exit() - this is a forceful exit that will bypass all exit
handlers. This includes AddressSanitizer, and will prevent ASan from
exiting the app with a fatal error code.
`Stream` will be qualified as `AK::Stream` until we remove the
`Core::Stream` namespace. `IODevice` now reuses the `SeekMode` that is
defined by `SeekableStream`, since defining its own would require us to
qualify it with `AK::SeekMode` everywhere.
Note that as of this commit, there aren't any such throwers, and the
call site in Heap::allocate will drop exceptions on the floor. This
commit only serves to change the declaration of the overrides, make sure
they return an empty value, and to propagate OOM errors frm their base
initialize invocations.
This will avoid loading starting about:blank page in places when we know
exactly what we want to load.
The opening in background part might be useful for future things like
file drops and right-click open in new tab.
Because TGA images don't have magic bytes as a signature to be detected,
instead assume a sequence of ReadonlyBytes is a possible TGA image only
if we are given a path so we could check the extension of the file and
see if it's a TGA image.
When we know the path of the file being loaded, we will try to first
check its extension, and only if there's no match to a known decoder,
based on simple extension lookup, then we would probe for other formats
as usual with the normal sniffing method.
This starts moving code equally shared between the OOPWV and Ladybird
WebContentView implementations to WebView::ViewImplementation, beginning
with the client state.
On many keyboards, Ctrl++ is actually Ctrl+Shift+=, and Ctrl+= makes
more sense as it's symmetric with Ctrl+-.
Both Firefox and Chrome already support this alternate shortcut,
so let's be nice and support it in Ladybird as well. :^)
This makes vector fonts load on macOS, where /usr/share/fonts doesn't
exist and Ladybird would only load the bitmap fonts from ./res/fonts
in the SerenityOS resource root directory.
Additionally, fonts in {/usr/share/local,~/.local}/fonts are now loaded
on Linux.
This patch also stubs out notify_server_did_get_accessiblity_tree in
ladybird since ViewImplementation now has it. However, this feature
is still immature, so just stubbing out in ladybird for now. Once we
have more robust support in Serenity (namely ARIA properties/state
and accessible names and descriptions) we can port this
functionality over.
This has been broken since the switch to the multiprocess architecture
(and even before then was very limited).
This restores the previous functionally and also implements the ability
to inspect individual elements (by selecting them in the tree view).
The inspector also now correctly updates when navigating between pages.
This allows us to use standard Serenity IPC infrastructure rather than
manually creating FD-passing sockets. This also lets us use Serenity's
WebDriver Session class, removing the copy previously used in Ladybird.
This ensures any changes to Session in the future will be picked up by
Ladybird for free.
Rather than manually launching the SQLServer process, use SQLClient's
new functionality to launch the server just once for all Ladybird
instances. Quit the SQLServer process when it no longer has any
connected clients.
When Ladybird exits, SQLServer can get stuck spinning at 100% CPU after
the socket connection is closed. This changes the client to quit the
event loop when that disconnect happens to ensure that SQLServer is
properly destroyed.
This adds a SQLServer binary for Ladybird to make use of Serenity's SQL
implementation. This has to use the same IPC socket handling that was
used to make WebContent and WebDriver work out-of-process.
Unlike Serenity, Ladybird creates a new SQLServer instance for each
Ladybird instance. In the future, we should try to make sure there is
only one SQLServer instance at a time, and allow multiple Ladybird
instances to communicate with it.
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
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.
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.
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.
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.
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.
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.
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.
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.
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:^)
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:))
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.
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.
- 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.
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.
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.
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. :^)
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.
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
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.
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.
While this adds a fair bit of widget code, we're also increasing code
sharing by using the same bits in WebContentClient for interacting with
the JS console.
That said, we should look for more ways to share code here.
This patch brings over the WebContent process over from SerenityOS
to Ladybird, along with a new WebContentView widget that renders
web content in a separate process.
There's a lot of jank and FIXME material here, notably I had to re-add
manually pumped Core::EventLoop instances on both sides, in order to get
the IPC protocol running. This introduces a lot of latency and we should
work towards replacing those loops with improved abstractions.
The WebContent process is built separately here (not part of Lagom) and
we provide our own main.cpp for it. Like everything, this can be better
architected, it's just a starting point. :^)
This prevents memory leaks detected by both Valgrind and ASAN/LSAN.
Valgrind is still suspicious of the leaked JS::VM from
Web::Bindings::main_thread_vm() but there's other issues with leak
checking all the GC'd objects.
Co-Authored-By: Diego Iastrubni <diegoiast@gmail.com>
For the first cut, the file path is not configurable and the content
filter cannot be toggled on or off. If we fail to apply the content
filters for any reason (e.g. the filter file doesn't exist), we simply
just stop loading the content filters to allow using Ladybird without
content filters.
We use a ModelTranslator to expose a DOMTreeModel from LibWebView :^)
It allows you to select the currently inspected node, which causes
the engine to render a little box model overlay above the web content.
This will allow us to share code with LibWebView from SerenityOS.
(This would otherwise not work, since its "WebView" namespace collides
with our "WebView" class.)
Also, we should eventually move towards a more sophisticated
multi-process WebView like OOPWV.
There are a lot of unsupported mouse click events that the engine
cannot handle. It such event (0) reaches the web engine - it will
assert.
Don't even propagate them - this is the safe way. As of today!
I also added back/forward buttons to the translation.
Should fix#27
This commit changes how we set the back and forward button key bindings
to use platform-specific standard key sequences.
For example, in Mac OS X, the back action will be now triggered via
Cmd+← and Cmd+[, whereas previously the action was mapped to Alt+←,
which is not standard in Mac OS X.
This setup should allow the package maintainers who are looking to
distribute ladybird on their distributions to use CMake to install
ladybird using cmake install rules rather than having to write their own
Reorganize the logic for initializing s_serenity_resource_root.
Now, we initialize it in platform_init(), and move platform_init to the
top of initialize_web_engine.
Add a branch at the end of the function to check
``QApplication::applicationDirPath()`` for the location of the
executable, and base the location of resources on that.
In an installed configuration, this will be /some/path/bin, with the
resource root set to /some/path/share/, looking for files in
/some/path/share/res/resource-type.
This matches up with some upcoming CMake changes to install resources in
CMAKE_INSTALL_DATADIR.
In the future, ladybird should probably use a QOpenGLWidget or similar
platform plugin to use the native GL implementation instead of the one
in serenity.
This allows requests like dumping the DOM tree to be forwarded to the
correct tab. Otherwise, the event would be forwarded to the most
recently created tab.