Commit Graph

360 Commits

Author SHA1 Message Date
mikiubo
131014427c LibWebView: Add bookmark import/export to about:bookmarks
Implement bookmark import/export in about:bookmarks using Netscape
bookmark HTML in JavaScript.
Import parsed items into BookmarkStore under an "Imported Bookmarks"
folder, and treat internal WebUI about: pages as potentially
trustworthy so SecureContext APIs are available there.
2026-04-22 08:02:15 -04:00
Timothy Flynn
06796f5f7f LibURL+LibWeb+LibWebView: Convert about:version to a proper WebUI
Passing the browser command line and executable path to every WebContent
process just in case we load about:version always felt a bit weird. We
now use the WebUI framework to load this information on demand.
2026-04-21 06:59:11 -04:00
Andreas Kling
586da4e610 LibWebView: Add a "Search with <engine>" autocomplete row
Synthesize an extra AutocompleteSuggestion at the top of the Search
Suggestions section whenever there is a configured search engine and
the typed query is not URL-shaped.

Use the query as the row's primary text, carry a "Search with <engine>"
subtitle, and render that subtitle in the AppKit and Qt popups so the
explicit search fallback stays visible and readable even when history
fills the list.
2026-04-16 21:01:28 +02:00
Andreas Kling
ed34a4ba8a LibWebView: Ignore duplicate URL change notifications
Some navigations report the same URL more than once through
WebContentClient::did_change_url(). Forwarding those duplicate updates
into the frontend turned an internal no-op into visible UI churn,
including location bar resets and AppKit focus stealing.

Treat repeated URL notifications as a no-op inside LibWebView so
frontends only react to real URL changes.
2026-04-16 21:01:28 +02:00
Andreas Kling
c249f0324b LibWebView: Let Settings clear browsing history
Route the existing Clear Browsing Data dialog through HistoryStore's
time-range deletion path as well. That makes the Settings action
remove visited pages from persisted history and from history-backed
address bar suggestions instead of only touching cache and site data.

Add a history checkbox to the dialog, thread its state through the
Settings WebUI message, and cover remove_entries_accessed_since() for
both transient and persisted stores in TestHistoryStore.
2026-04-16 21:01:28 +02:00
Andreas Kling
66e0035c9e LibWebView: Structure autocomplete suggestions
Replace the frontend-facing Vector<String> flow with structured
AutocompleteSuggestion objects carrying source, section, title,
and favicon metadata.

Build merged history and literal-URL rows in LibWebView, deduplicate
equivalent URL suggestions, move the autocomplete URL helpers out
of URL.h, and update the history and URL tests around the new model.
2026-04-16 21:01:28 +02:00
Andreas Kling
87b6703054 LibWebView: Persist page metadata in history
Record visits as soon as a page produces useful metadata such as a
title or favicon so pages that never finish loading still become
autocomplete candidates.

Store favicons in the history schema from the start instead of
introducing an upgrade path inside this series, and cover persisted
metadata behavior in TestHistoryStore.
2026-04-16 21:01:28 +02:00
Andreas Kling
fe2cab9270 LibWebView: Add history-backed location autocomplete
Teach LibWebView autocomplete to query HistoryStore before falling back
to remote engines and move the wiring out of the AppKit frontend.
Refine matching so scheme and www. boilerplate do not dominate results,
short title and substring queries stay quiet, and history tracing can
explain what the ranking code is doing.
2026-04-16 21:01:28 +02:00
Andreas Kling
54f14609f4 LibWebView: Add a SQL history store
Add a HistoryStore abstraction with transient and persisted backends,
normalize recorded URLs, and skip non-browsable schemes.

Cover lookup and persistence in TestHistoryStore so history-driven
features can share one backend.
2026-04-16 21:01:28 +02:00
Jonathan Gamble
3e4338f339 LibWebView: Replace ProcessManager mutex with thread affinity assertions
Add on_process_added callback so test-web can set up captures
2026-04-15 17:09:50 +02:00
Shannon Booth
de14978046 LibWeb: Implement cross process BroadcastChannel delivery
Route BroadcastChannel messages over IPC so matching channels can
receive them across WebContent and WebWorker processes, rather than only
within a single process.

Each channel now serializes its payload, sends it upward over IPC, and
receiving processes deliver it locally after matching by storage key and
channel name.
2026-04-14 18:43:28 +02:00
Timothy Flynn
79893b9cef LibWeb+LibWebView+WebContent: Add a setting to control autoscrolling 2026-04-13 13:01:45 -04:00
Timothy Flynn
6cf4fa80a7 LibWebView: Use screaming case for settings constants
Matches our coding style guide.
2026-04-13 13:01:45 -04:00
ayeteadoe
ce365e6513 LibWebView: Support process exit handling on Windows
Now that we detect and handle child processes exiting, we should see
less "Trying to post_message during IPC shutdown" VERIFY failures that
crash the UI process.

Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2026-04-12 16:08:07 +02:00
ayeteadoe
433ff624b8 LibWebView: Abstract process exit monitoring into ProcessMonitor
There is no direct equivalent to SIGCHILD on Windows. The closest we
can get is monitoring a specific process, given a known pid. On Unix
there is no single solution to be able to do that in LibCore's
EventLoopImplementationUnix. For Linux there's a SYS_pidfd_open syscall
that can integrate into poll(), but on macOS a kqueue would be needed.
Given macOS uses EventLoopImplementationUnix for the headless view
implementation, we currently can't create a fully cross-platform
abstaction at the Event Loop level to match what Windows needs to do.

ProcessMonitor's purpose is to abstract away the Unix vs Windows
behaviour avoiding more inlined ifdef soup in ProcessManager.
2026-04-12 16:08:07 +02:00
mikiubo
16f5a909dd LibWebView: Add last_modified timestamp to bookmark items
Track the last modification time on every BookmarkItem. The timestamp
is updated when editing a bookmark or folder, moving an item, or
updating a favicon. This aligns with the Netscape bookmark HTML format
used by Chromium and Firefox for bookmark export/import
(LAST_MODIFIED attribute).
2026-04-12 07:34:56 -04:00
mikiubo
ddef466046 LibWebView: Add date_added timestamp to bookmark items
Store a creation timestamp on every BookmarkItem, for both bookmarks
and folders.

This aligns with the Netscape bookmark HTML format used by Chromium
and Firefox for bookmark export/import (ADD_DATE attribute).
2026-04-12 07:34:56 -04:00
Suraj Yadav
11f82ee3b7 LibWebView: Support multiple --debug-process arguments 2026-04-09 11:00:10 -04:00
Tim Ledbetter
9b21701c78 LibWebView: Add a --screenshot-delay option
Previously, `--headless=screenshot` always took a screenshot after 1
second. This option allows the user to specify the number of seconds to
wait before taking the screenshot.
2026-04-09 10:52:10 -04:00
Timothy Flynn
b544e42809 LibWebView+UI: Add an about:bookmarks page to manage bookmarks
This page renders the bookmarks as a tree and hook context menu events
up to the UI's bookmarks bar context menus to allow editing bookmarks.
Users can also drag-and-drop bookmark items around.
2026-04-09 10:08:06 -04:00
Timothy Flynn
8e8cff91f6 LibWebView: Add a method to serialize bookmark items to JSON 2026-04-09 10:08:06 -04:00
Timothy Flynn
efbd60bc21 LibWebView: Add a method to move a bookmark item
This allows moving an item within its own folder or to another folder.
2026-04-09 10:08:06 -04:00
Aliaksandr Kalenik
75af441bff Everywhere: Replace SharedBackingStore with Gfx::SharedImage
Generalize the backing store sharing abstraction into SharedImage, which
represents shared GPU memory independently of Skia and can be used to
share memory between different processes or different GPU contexts.
2026-04-09 01:18:59 +02:00
Timothy Flynn
c4c9ed2bb3 LibWebView: Add bookmark context menu items to open/copy bookmark URLs 2026-04-04 10:23:06 -04:00
Timothy Flynn
2e0a7f54d9 LibWebView: Create a set of default bookmarks
When the bookmark store does not yet exist, let's fill in a few Ladybird
related websites.
2026-04-03 13:48:12 -04:00
Timothy Flynn
ef4ff5d490 LibWebView+UI: Centralize option to treat file:// URLs as non-opaque 2026-04-02 10:21:15 +02:00
Andreas Kling
9d2dd7b95b LibWebView: Don't always close WebContent on cross-site navigation
When a page opens a popup, the child tab shares the parent's
WebContent process via initialize_client_as_child(). Both tabs
register as views on the same WebContentClient.

If the child tab then does a cross-site navigation,
create_new_process_for_cross_site_navigation() would call
unregister_view() (correct) and then unconditionally send
CloseServer (wrong). This killed the WebContent process even
though the parent tab was still using it.

The unconditional async_close_server() predates the shared-process
popup model. It is no longer needed since unregister_view() already
sends CloseServer when the last view is removed.
2026-04-01 20:59:01 +02:00
Timothy Flynn
1b6c4c1db8 LibWebView: Add context menu items to interact with the bookmarks bar
This adds hooks to add, edit, and delete bookmarks and folders.
2026-04-01 04:57:28 +02:00
Timothy Flynn
e18bd9c98d LibWebView: Add more BookmarkStore methods to interact with the store
Add methods to edit items and add folders.
2026-04-01 04:57:28 +02:00
Undefine
a977e04efb Meta: Move compile_ipc calls to the relevant client library CMakeLists 2026-03-29 13:59:11 -06:00
Aliaksandr Kalenik
1d025620e3 Everywhere: Move Mach bootstrap listener into LibIPC
Move MachPortServer from LibWebView into LibIPC as MachBootstrapListener
and move the Mach message structs from MachMessageTypes.h into LibIPC.

These types are IPC infrastructure, not UI or platform concerns.
Consolidating them in LibIPC keeps the Mach bootstrap handshake
self-contained in a single library and removes LibWebView's dependency
on LibThreading.
2026-03-24 19:51:52 +01:00
Aliaksandr Kalenik
e47f4cf90f Everywhere: Simplify Mach bootstrap transport handshake
Previously, the bootstrap handshake used a two-state machine
(WaitingForPorts / WaitingForReplyPort) to handle a race: the parent
registering transport ports and the child sending a bootstrap request
could arrive in either order, so whichever came first stored its half
and the second completed the handshake.

Eliminate the race by holding a mutex across spawn() and
register_child_transport(). Since the child cannot send a bootstrap
request before it exists, and the lock isn't released until its
transport is registered, handle_bootstrap_request() is guaranteed to
find the entry. This reduces the pending map to a simple pid-to-ports
lookup and collapses the two-variant state into two straightforward
branches: known child, or on-demand (non-child) caller like WebDriver.
2026-03-24 19:51:52 +01:00
Timothy Flynn
2b9cce8f62 UI/Qt: Create a bookmarks application menu and toolbar 2026-03-24 12:04:50 -04:00
Timothy Flynn
2025e6e523 LibWebView: Integrate bookmarks into the application menus and settings
This adds application menus and actions to display and manage bookmarks.
These menus will be used by the UIs to generate concrete widgets.
2026-03-24 12:04:50 -04:00
Timothy Flynn
428b7eeffa LibWebView: Implement a persistent bookmark storage interface
This patch adds BookmarkStore to manage bookmarks stored in a JSON file
in the application settings directory. It supports both folders and
bookmarks. It does not yet support arbitrary editing of bookmarks, other
than updating stored favicons.
2026-03-24 12:04:50 -04:00
Timothy Flynn
c9f89d7a33 LibWebView: Move helpers to parse/write JSON files to Utilities.h
These will be re-used for bookmark storage.
2026-03-24 12:04:50 -04:00
Timothy Flynn
ea27692e7b LibWebView: Add an engaged state to application menu actions
This will be used to update the displayed action icon for an upcoming
action to add/remove the current page from a bookmark store.
2026-03-24 12:04:50 -04:00
Timothy Flynn
2ee6d3334f LibWebView: Add option to display an arbitrary PNG for action icon
This supports storing any base64-encoded PNG to display in application
menus. This will be used to render favicons on bookmarks.
2026-03-24 12:04:50 -04:00
Timothy Flynn
afcc0fdbb0 LibWebView+UI: Add option to render an icon for application submenus 2026-03-24 12:04:50 -04:00
Timothy Flynn
abaf255fc5 LibWebView: Allow more application menu actions to store dynamic strings
For example, we will set some of this text to serialized URLs.
2026-03-24 12:04:50 -04:00
Timothy Flynn
58791db818 AK+LibWeb: Move generation of random UUIDs into AK
This will let us use this more outside of LibWeb more easily.

Stop handling tiny OOM while we are here.
2026-03-24 12:04:50 -04:00
Tim Ledbetter
997217b78c LibWebView: Remove fontconfig dependency from LibWebView 2026-03-24 15:08:24 +01:00
Aliaksandr Kalenik
3cb644500e Everywhere: Send IOSurface backing stores via main IPC route on macOS
Now that LibIPC uses Mach ports for transport on macOS, IOSurface port
rights can be sent as regular IPC message attachments instead of through
a separate ad-hoc Mach message side-channel. Introduce
Web::SharedBackingStore that wraps either a MachPort (macOS) or
ShareableBitmap (other platforms) with IPC encode/decode support,
unifying backing store allocation into the existing
did_allocate_backing_stores IPC message.
2026-03-23 23:22:38 +01:00
Aliaksandr Kalenik
c6d740ea41 Everywhere: Remove dynamic Mach bootstrap registration on macOS
Registering multiple Mach port names with the bootstrap server at
runtime is not how macOS expects it to be used — the bootstrap server
is meant for static services, and the only reason we used it originally
was so child processes could reach back to the UI process.

Remove bootstrap_transport_over_socket(), which had both sides register
dynamic names with the bootstrap server and exchange them over a socket.
Instead, WebDriver and BrowserProcess connections now go through
MachPortServer instances directly. When a non-child process contacts a
MachPortServer, the server creates a port pair on demand (detected via
sysctl ppid check) and returns the local half immediately. This keeps
bootstrap server usage limited to the one original case: child processes
looking up their parent's MachPortServer.

WebDriver Session now runs its own MachPortServer per session.
--webdriver-content-path becomes --webdriver-mach-server-name on macOS.
Spare WebContent launches are skipped when a WebDriver session is active
to avoid bootstrap races.
2026-03-23 18:50:48 +01:00
Aliaksandr Kalenik
4ea4d63008 Everywhere: Replace Unix socket IPC transport with Mach ports on macOS
On macOS, use Mach port messaging instead of Unix domain sockets for
all IPC transport. This makes the transport capable of carrying Mach
port rights as message attachments, which is a prerequisite for sending
IOSurface handles over the main IPC channel (currently sent via a
separate out-of-band path). It also avoids the need for the FD
acknowledgement protocol that TransportSocket requires, since Mach port
right transfers are atomic in the kernel.

Three connection establishment patterns:

- Spawned helper processes (WebContent, RequestServer, etc.) use the
  existing MachPortServer: the child sends its task port with a reply
  port, and the parent responds with a pre-created port pair.

- Socket-bootstrapped connections (WebDriver, BrowserProcess) exchange
  Mach port names over the socket, then drop the socket.

- Pre-created pairs for IPC tests and in-message transport transfer.

Attachment on macOS now wraps a MachPort instead of a file descriptor,
converting between the two via fileport_makeport()/fileport_makefd().

The LibIPC socket transport tests are disabled on macOS since they are
socket-specific.
2026-03-23 18:50:48 +01:00
Zaggy1024
01224dedde LibWebView: Actually set the fullscreen flag when entering fullscreen
Somehow this disappeared from #8461.
2026-03-20 20:28:32 -05:00
Aliaksandr Kalenik
4ddba48e13 LibIPC+LibWebView: Remove MultiServer
MultiServer was inherited from SerenityOS where it was used in many
places. Now that BrowserProcess is its only consumer, inline the
connection acceptance logic directly into BrowserProcess and remove
the abstraction.
2026-03-20 23:23:28 +01:00
Andreas Kling
30f108ba36 LibJS: Remove C++ lexer, use Rust tokenizer for syntax highlighting
Delete Lexer.cpp/h and Token.cpp, replacing all tokenization with a
new rust_tokenize() FFI function that calls back for each token.

Rewrite SyntaxHighlighter.cpp and js.cpp REPL to use the Rust
tokenizer. The token type and category enums in Token.h now mirror
the Rust definitions in token.rs.

Move is_syntax_character/is_whitespace/is_line_terminator helpers
into RegExpConstructor.cpp as static functions, since they were only
used there.
2026-03-19 21:55:10 -05:00
Zaggy1024
ac69815740 Everywhere: Add an is_fullscreen parameter to set_viewport
This will be used by the UIs to notify WebContent when fullscreen for
content is entered or exited.
2026-03-17 18:58:37 -05:00
Zaggy1024
d0a38bd046 WebContent: Remove the sync result from did_request_fullscreen_window
This was unused.
2026-03-17 18:58:37 -05:00