Skip to content

Truly independent web browser

LibWebView+UI/Qt: Add about:crashes for reviewing crash reports

Andreas Klingf656e74c0bdb
diff --git a/Base/res/ladybird/about-pages/about.html b/Base/res/ladybird/about-pages/about.html
index 9effc32bbb2..94c6b238fe2 100644
--- a/Base/res/ladybird/about-pages/about.html
+++ b/Base/res/ladybird/about-pages/about.html
@@ -43,6 +43,7 @@
<li><a href="about:about">about:about</a></li>
<li><a href="about:blocking">about:blocking</a></li>
<li><a href="about:bookmarks">about:bookmarks</a></li>
+ <li><a href="about:crashes">about:crashes</a></li>
<li><a href="about:settings">about:settings</a></li>
<li><a href="about:services">about:services</a></li>
<li><a href="about:version">about:version</a></li>
diff --git a/Base/res/ladybird/about-pages/crashes.html b/Base/res/ladybird/about-pages/crashes.html
new file mode 100644
index 00000000000..7931e2c5aa6
--- /dev/null
+++ b/Base/res/ladybird/about-pages/crashes.html
@@ -0,0 +1,499 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <title>Crash Reports</title>
+ <link rel="icon" type="image/png" href="resource://icons/48x48/app-browser.png" />
+ <link rel="stylesheet" type="text/css" href="resource://ladybird/ladybird.css" />
+ <link rel="stylesheet" type="text/css" href="resource://ladybird/about-pages/webui.css" />
+ <style>
+ body {
+ max-width: 728px;
+ padding: 48px 24px;
+ }
+
+ header {
+ align-items: baseline;
+ }
+
+ header h1 {
+ flex: none;
+ }
+
+ #count {
+ flex: 1;
+
+ color: var(--muted);
+ font-size: 13px;
+ font-variant-numeric: tabular-nums;
+ }
+
+ #actions {
+ display: flex;
+ gap: 8px;
+ }
+
+ #actions button {
+ padding: 0 14px;
+ }
+
+ #reports {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ }
+
+ #empty {
+ padding: 36px 12px;
+
+ color: var(--muted);
+ font-size: 13px;
+ text-align: center;
+ }
+
+ #settings {
+ display: inline-block;
+ margin-top: 18px;
+
+ color: var(--link);
+ font-size: 12px;
+ text-decoration: none;
+ }
+
+ #settings:hover {
+ text-decoration: underline;
+ }
+
+ /* Each report is a thing of its own to send or delete, so it never shares a box with another. */
+ .report {
+ background-color: var(--tile);
+ border-radius: var(--card-radius);
+ }
+
+ .report-row {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+
+ min-height: 44px;
+ padding-right: 10px;
+ }
+
+ .report-toggle {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ gap: 10px;
+
+ min-width: 0;
+ min-height: 44px;
+ padding: 0 6px 0 16px;
+
+ border: none;
+ border-radius: var(--card-radius);
+ background: none;
+ color: var(--text);
+
+ font: inherit;
+ font-size: 13px;
+ text-align: left;
+
+ cursor: pointer;
+ }
+
+ .report-chevron {
+ flex: none;
+ width: 12px;
+ height: 12px;
+
+ fill: none;
+ stroke: var(--muted);
+ stroke-width: 1.5;
+ stroke-linecap: round;
+ stroke-linejoin: round;
+ }
+
+ .report.expanded .report-chevron {
+ transform: rotate(90deg);
+ }
+
+ .report-name {
+ font-weight: 500;
+ }
+
+ .report.expanded .report-name {
+ font-weight: 600;
+ }
+
+ .report-when {
+ flex: 1;
+
+ overflow: hidden;
+ color: var(--muted);
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ .report-status {
+ flex: none;
+ padding: 0 8px;
+
+ color: var(--muted);
+ font-size: 12px;
+ }
+
+ .report-status.failed {
+ color: var(--error);
+ }
+
+ .quiet-button {
+ flex: none;
+
+ height: 24px;
+ padding: 0 10px;
+
+ border: none;
+ border-radius: 7px;
+ background: none;
+ color: var(--body);
+
+ font: inherit;
+ font-size: 12px;
+
+ cursor: pointer;
+ }
+
+ .quiet-button:hover {
+ background-color: var(--control-hover);
+ }
+
+ .quiet-button:active {
+ background-color: var(--control-pressed);
+ }
+
+ .quiet-button:disabled {
+ color: var(--muted);
+ background: none;
+ cursor: default;
+ }
+
+ .report.expanded .report-row .quiet-button,
+ .report:not(.expanded) .report-details {
+ display: none;
+ }
+
+ .report-details {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+
+ padding: 0 16px 16px 38px;
+ }
+
+ .report-note {
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+
+ color: var(--muted);
+ font-size: 12px;
+ }
+
+ .report-note textarea {
+ height: 64px;
+ padding: 8px 10px;
+
+ border: none;
+ border-radius: 7px;
+ outline: none;
+ box-shadow: inset 0 0 0 1px var(--separator);
+ background-color: var(--page);
+ color: var(--text);
+
+ font: inherit;
+ font-size: 13px;
+
+ resize: vertical;
+ }
+
+ .report-note textarea:focus {
+ box-shadow: inset 0 0 0 2px var(--link);
+ }
+
+ .report-footer {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ }
+
+ .report-included {
+ flex: 1;
+
+ color: var(--muted);
+ font-size: 12px;
+ }
+
+ .report-show {
+ padding: 0;
+
+ border: none;
+ background: none;
+ color: var(--link);
+
+ font: inherit;
+
+ cursor: pointer;
+ }
+
+ .report-text-note {
+ margin: 0;
+ color: var(--muted);
+ font-size: 12px;
+ }
+
+ .report-text {
+ max-height: 320px;
+ margin: 0;
+ padding: 8px 10px;
+
+ overflow: auto;
+ border-radius: 7px;
+ box-shadow: inset 0 0 0 1px var(--separator);
+ background-color: var(--page);
+ color: var(--body);
+
+ font-family: ui-monospace, monospace;
+ font-size: 11px;
+ white-space: pre-wrap;
+ }
+ </style>
+ </head>
+ <body>
+ <header>
+ <h1>Crash reports</h1>
+ <span id="count"></span>
+ <div id="actions">
+ <button id="delete-all" class="secondary-button">Delete all</button>
+ <button id="send-all" class="primary-button">Send all</button>
+ </div>
+ </header>
+ <div id="reports"></div>
+ <div id="empty" class="hidden">No crash reports waiting</div>
+ <a id="settings" href="about:settings#privacy">Crash report settings</a>
+
+ <template id="report-template">
+ <section class="report">
+ <div class="report-row">
+ <button class="report-toggle">
+ <svg class="report-chevron" viewBox="0 0 12 12" aria-hidden="true">
+ <path d="M4.5 2.5 8 6l-3.5 3.5" />
+ </svg>
+ <span class="report-name"></span>
+ <span class="report-when"></span>
+ </button>
+ <span class="report-status"></span>
+ <button class="quiet-button report-delete">Delete</button>
+ <button class="quiet-button report-send">Send</button>
+ </div>
+ <div class="report-details">
+ <label class="report-note">
+ What were you doing? (optional)
+ <textarea maxlength="4096"></textarea>
+ </label>
+ <p class="report-text-note hidden"></p>
+ <pre class="report-text hidden"></pre>
+ <div class="report-footer">
+ <span class="report-included">
+ Crash details, Ladybird version and platform.
+ <button class="report-show">Show report</button>
+ </span>
+ <button class="quiet-button report-delete">Delete</button>
+ <button class="secondary-button report-send">Send</button>
+ </div>
+ </div>
+ </section>
+ </template>
+
+ <script type="module">
+ const reportsElement = document.querySelector("#reports");
+ const emptyElement = document.querySelector("#empty");
+ const countElement = document.querySelector("#count");
+ const actionsElement = document.querySelector("#actions");
+ const deleteAllButton = document.querySelector("#delete-all");
+ const sendAllButton = document.querySelector("#send-all");
+ const template = document.querySelector("#report-template");
+
+ // The cards outlive each update of the list, so what was typed into one or opened on it stays.
+ const cards = new Map();
+ const collapsedByUser = new Set();
+ let groups = [];
+
+ const minute = 60 * 1000;
+ const hour = 60 * minute;
+ const day = 24 * hour;
+
+ function plural(count, noun) {
+ return `${count} ${noun}${count === 1 ? "" : "s"}`;
+ }
+
+ function startOfDay(date) {
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
+ }
+
+ function describeTime(milliseconds) {
+ if (milliseconds === undefined) return "";
+
+ const now = new Date();
+ const then = new Date(milliseconds);
+ const age = now - then;
+ const daysAgo = Math.round((startOfDay(now) - startOfDay(then)) / day);
+
+ if (age < minute) return "Just now";
+ if (age < hour) return `${plural(Math.floor(age / minute), "minute")} ago`;
+ if (daysAgo === 0) return `${plural(Math.floor(age / hour), "hour")} ago`;
+ if (daysAgo === 1) {
+ const time = then.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hour12: false });
+ return `Yesterday, ${time}`;
+ }
+ return `${daysAgo} days ago`;
+ }
+
+ function describeGroup(group) {
+ const when = describeTime(group.lastCrashedAt);
+ if (group.names.length === 1) return when;
+ if (!when) return `${group.names.length} times`;
+ return `${group.names.length} times · last ${when.charAt(0).toLowerCase()}${when.slice(1)}`;
+ }
+
+ function reportsToSend(group, card) {
+ const description = card.querySelector("textarea").value;
+ return group.names.map(name => ({ name, description }));
+ }
+
+ function createCard(id) {
+ const card = template.content.firstElementChild.cloneNode(true);
+ const toggle = card.querySelector(".report-toggle");
+ const showButton = card.querySelector(".report-show");
+ const reportText = card.querySelector(".report-text");
+
+ const group = () => groups.find(candidate => candidate.id === id);
+
+ toggle.addEventListener("click", () => {
+ if (card.classList.toggle("expanded")) collapsedByUser.delete(id);
+ else collapsedByUser.add(id);
+ toggle.setAttribute("aria-expanded", card.classList.contains("expanded"));
+ });
+ card.querySelectorAll(".report-delete").forEach(button => {
+ button.addEventListener("click", () => ladybird.sendMessage("deleteReports", group().names));
+ });
+ card.querySelectorAll(".report-send").forEach(button => {
+ button.addEventListener("click", () => {
+ ladybird.sendMessage("sendReports", reportsToSend(group(), card));
+ });
+ });
+ showButton.addEventListener("click", () => {
+ if (reportText.classList.contains("hidden")) {
+ ladybird.sendMessage("showReport", group().names[0]);
+ } else {
+ reportText.classList.add("hidden");
+ showButton.textContent = "Show report";
+ updateCard(card, group());
+ }
+ });
+
+ return card;
+ }
+
+ function updateCard(card, group) {
+ card.querySelector(".report-name").textContent = group.process;
+ card.querySelector(".report-when").textContent = describeGroup(group);
+
+ // Only the latest report of a group is shown, so say what stands behind it.
+ const reportTextNote = card.querySelector(".report-text-note");
+ const reportIsHidden = card.querySelector(".report-text").classList.contains("hidden");
+ reportTextNote.textContent = `Showing the latest of ${group.names.length}. The others are the same crash.`;
+ reportTextNote.classList.toggle("hidden", reportIsHidden || group.names.length === 1);
+
+ const status = card.querySelector(".report-status");
+ status.textContent = group.isSending ? "Sending…" : group.couldNotSend ? "Couldn’t send" : "";
+ status.classList.toggle("failed", !group.isSending && group.couldNotSend);
+
+ card.querySelectorAll(".report-delete, .report-send").forEach(button => {
+ button.disabled = group.isSending;
+ });
+ card.querySelector("textarea").disabled = group.isSending;
+
+ const expanded =
+ card.classList.contains("expanded") || (groups.length === 1 && !collapsedByUser.has(group.id));
+ card.classList.toggle("expanded", expanded);
+ card.querySelector(".report-toggle").setAttribute("aria-expanded", expanded);
+ }
+
+ function render() {
+ const ids = new Set(groups.map(group => group.id));
+ for (const [id, card] of cards) {
+ if (ids.has(id)) continue;
+ card.remove();
+ cards.delete(id);
+ }
+
+ // Moving a card takes the focus from its note, so one already in its place stays untouched.
+ groups.forEach((group, index) => {
+ if (!cards.has(group.id)) cards.set(group.id, createCard(group.id));
+ const card = cards.get(group.id);
+ updateCard(card, group);
+ const current = reportsElement.children[index];
+ if (current !== card) reportsElement.insertBefore(card, current ?? null);
+ });
+
+ const reportCount = groups.reduce((count, group) => count + group.names.length, 0);
+ const allSending = groups.every(group => group.isSending);
+ countElement.textContent = reportCount > 0 ? `${reportCount} not sent` : "";
+ actionsElement.classList.toggle("hidden", reportCount === 0);
+ emptyElement.classList.toggle("hidden", reportCount > 0);
+ deleteAllButton.disabled = allSending;
+ sendAllButton.disabled = allSending;
+ }
+
+ deleteAllButton.addEventListener("click", () => {
+ const idle = groups.filter(group => !group.isSending);
+ ladybird.sendMessage(
+ "deleteReports",
+ idle.flatMap(group => group.names)
+ );
+ });
+
+ sendAllButton.addEventListener("click", () => {
+ const idle = groups.filter(group => !group.isSending);
+ ladybird.sendMessage(
+ "sendReports",
+ idle.flatMap(group => reportsToSend(group, cards.get(group.id)))
+ );
+ });
+
+ document.addEventListener("WebUIMessage", event => {
+ if (event.detail.name === "loadReports") {
+ groups = event.detail.data;
+ render();
+ } else if (event.detail.name === "showReport") {
+ const { name, text } = event.detail.data;
+ const group = groups.find(candidate => candidate.names[0] === name);
+ if (!group) return;
+
+ const card = cards.get(group.id);
+ const reportText = card.querySelector(".report-text");
+ reportText.textContent = text;
+ reportText.classList.remove("hidden");
+ card.querySelector(".report-show").textContent = "Hide report";
+ updateCard(card, group);
+ }
+ });
+
+ // The times on the page age, and a report can be answered from a crashed tab's own screen.
+ document.addEventListener("visibilitychange", () => {
+ if (!document.hidden) ladybird.sendMessage("loadReports");
+ });
+
+ document.addEventListener("WebUILoaded", () => ladybird.sendMessage("loadReports"));
+ </script>
+ </body>
+</html>
diff --git a/Base/res/ladybird/ladybird.css b/Base/res/ladybird/ladybird.css
index 7284ebcfdc8..e0922bd063d 100644
--- a/Base/res/ladybird/ladybird.css
+++ b/Base/res/ladybird/ladybird.css
@@ -56,6 +56,7 @@
--control-pressed: rgba(0, 0, 0, 0.09);
--segment: #ffffff;
--surface: #fbfbfc;
+ --tile: #f3f3f5;
--edge: rgba(0, 0, 0, 0.1);
--popover-shadow: 0 14px 36px rgba(0, 0, 0, 0.16);
--dialog-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
@@ -92,6 +93,7 @@
--control-pressed: rgba(255, 255, 255, 0.14);
--segment: #48484e;
--surface: #333336;
+ --tile: #2c2c2f;
--edge: rgba(255, 255, 255, 0.12);
--popover-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
--dialog-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
diff --git a/Libraries/LibWebView/CMakeLists.txt b/Libraries/LibWebView/CMakeLists.txt
index 3faecf02a8b..d57b38c96a2 100644
--- a/Libraries/LibWebView/CMakeLists.txt
+++ b/Libraries/LibWebView/CMakeLists.txt
@@ -95,6 +95,7 @@ set(SOURCES
WebDriverBrowserConnection.cpp
WebUI.cpp
WebUI/BookmarksUI.cpp
+ WebUI/CrashReportsUI.cpp
WebUI/DownloadsUI.cpp
WebUI/HistoryUI.cpp
WebUI/SettingsUI.cpp
diff --git a/Libraries/LibWebView/WebUI.cpp b/Libraries/LibWebView/WebUI.cpp
index 1aa3d88ec2d..8a1d987d7dd 100644
--- a/Libraries/LibWebView/WebUI.cpp
+++ b/Libraries/LibWebView/WebUI.cpp
@@ -10,6 +10,7 @@
#include <LibWebView/WebContentPage.h>
#include <LibWebView/WebUI.h>
#include <LibWebView/WebUI/BookmarksUI.h>
+#include <LibWebView/WebUI/CrashReportsUI.h>
#include <LibWebView/WebUI/DownloadsUI.h>
#include <LibWebView/WebUI/HistoryUI.h>
#include <LibWebView/WebUI/SettingsUI.h>
@@ -21,6 +22,7 @@ static constexpr auto s_pages = to_array<WebUI::Page>({
{ "about"sv, "About URLs"sv, WebUI::PageType::Static },
{ "blocking"sv, "Blocking"sv, WebUI::PageType::Static },
{ "bookmarks"sv, "Bookmarks"sv, WebUI::PageType::Dynamic },
+ { "crashes"sv, "Crash Reports"sv, WebUI::PageType::Dynamic },
{ "downloads"sv, "Downloads"sv, WebUI::PageType::Dynamic },
{ "history"sv, "History"sv, WebUI::PageType::Dynamic },
{ "newtab"sv, "New Tab"sv, WebUI::PageType::Static },
@@ -68,6 +70,8 @@ ErrorOr<RefPtr<WebUI>> WebUI::create(WebContentClient& client, Web::PageId page_
if (page->host == "bookmarks"sv)
web_ui = TRY(create_web_ui<BookmarksUI>(client, page_id, move(host)));
+ else if (page->host == "crashes"sv)
+ web_ui = TRY(create_web_ui<CrashReportsUI>(client, page_id, move(host)));
else if (page->host == "downloads"sv)
web_ui = TRY(create_web_ui<DownloadsUI>(client, page_id, move(host)));
else if (page->host == "history"sv)
diff --git a/Libraries/LibWebView/WebUI/CrashReportsUI.cpp b/Libraries/LibWebView/WebUI/CrashReportsUI.cpp
new file mode 100644
index 00000000000..93c3b4ecf14
--- /dev/null
+++ b/Libraries/LibWebView/WebUI/CrashReportsUI.cpp
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <AK/HashMap.h>
+#include <AK/Hex.h>
+#include <AK/JsonArray.h>
+#include <AK/JsonObject.h>
+#include <LibCrypto/Hash/SHA2.h>
+#include <LibWebView/CrashReportDiagnostics.h>
+#include <LibWebView/CrashReportStore.h>
+#include <LibWebView/WebUI/CrashReportsUI.h>
+
+namespace WebView {
+
+static StringView plain_process_name(StringView process)
+{
+ if (process == "Compositor"sv)
+ return "Graphics process"sv;
+ if (process == "WebContent"sv)
+ return "Page"sv;
+ if (process == "WebWorker"sv)
+ return "Worker"sv;
+ if (process == "RequestServer"sv)
+ return "Network process"sv;
+ if (process == "ImageDecoder"sv)
+ return "Image decoder"sv;
+ if (process == "MediaServer"sv)
+ return "Media process"sv;
+ if (process == "AudioServer"sv)
+ return "Audio process"sv;
+ if (process == "VideoDecoderServer"sv)
+ return "Video decoder"sv;
+ if (process == "WebRTCClient"sv)
+ return "WebRTC process"sv;
+ return "Ladybird"sv;
+}
+
+void CrashReportsUI::register_interfaces()
+{
+ register_interface("loadReports"sv, [this](auto const&) {
+ load_reports();
+ });
+ register_interface("sendReports"sv, [this](auto const& data) {
+ send_reports(data);
+ });
+ register_interface("deleteReports"sv, [this](auto const& data) {
+ delete_reports(data);
+ });
+ register_interface("showReport"sv, [this](auto const& data) {
+ show_report(data);
+ });
+}
+
+void CrashReportsUI::crash_reports_changed()
+{
+ if (has_client())
+ load_reports();
+}
+
+void CrashReportsUI::load_reports()
+{
+ struct Group {
+ ByteString id;
+ StringView process;
+ Optional<UnixDateTime> last_crashed_at;
+ Vector<ByteString> names;
+ };
+
+ auto& store = CrashReportStore::the();
+ auto& outbox = CrashReportOutbox::the();
+
+ Vector<ByteString> names;
+ if (auto pending = store.pending_report_names(); pending.is_error())
+ warnln("Could not list crash reports: {}", pending.error());
+ else
+ names = pending.release_value();
+
+ // The names come newest first, so a group's first report is its last crash.
+ Vector<Group> groups;
+ HashMap<ByteString, size_t> group_indices;
+ for (auto const& name : names) {
+ ByteString signature { "Unreadable"sv };
+ StringView process = "Unreadable report"sv;
+ Optional<UnixDateTime> crashed_at;
+
+ // A report that cannot be read still counts as waiting, so it gets a row of its own to delete it from.
+ if (auto report = store.saved_report(name); report.is_error()) {
+ warnln("Could not read crash report {}: {}", name, report.error());
+ } else {
+ auto diagnostics = CrashReportDiagnostics::parse(report.value().text);
+ signature = diagnostics.signature();
+ process = plain_process_name(diagnostics.header("Process"sv));
+ crashed_at = diagnostics.crashed_at;
+ }
+
+ auto index = group_indices.ensure(signature, [&] {
+ groups.append({
+ .id = encode_hex(Crypto::Hash::SHA256::hash(signature.bytes()).bytes()),
+ .process = process,
+ .last_crashed_at = crashed_at,
+ .names = {},
+ });
+ return groups.size() - 1;
+ });
+ groups[index].names.append(name);
+ }
+
+ JsonArray serialized_groups;
+ serialized_groups.ensure_capacity(groups.size());
+ for (auto const& group : groups) {
+ JsonArray serialized_names;
+ bool is_sending = false;
+ bool could_not_send = false;
+ for (auto const& name : group.names) {
+ serialized_names.must_append(String::from_utf8_with_replacement_character(name));
+ is_sending |= outbox.is_sending(name);
+ could_not_send |= outbox.could_not_send(name);
+ }
+
+ JsonObject serialized_group;
+ serialized_group.set("id"sv, String::from_utf8_with_replacement_character(group.id));
+ serialized_group.set("process"sv, group.process);
+ if (group.last_crashed_at.has_value())
+ serialized_group.set("lastCrashedAt"sv, group.last_crashed_at->milliseconds_since_epoch());
+ serialized_group.set("names"sv, move(serialized_names));
+ serialized_group.set("isSending"sv, is_sending);
+ serialized_group.set("couldNotSend"sv, could_not_send);
+ serialized_groups.must_append(move(serialized_group));
+ }
+
+ async_send_message("loadReports"sv, move(serialized_groups));
+}
+
+void CrashReportsUI::send_reports(JsonValue const& data)
+{
+ if (!data.is_array())
+ return;
+
+ Vector<CrashReportOutbox::Report> reports;
+ data.as_array().for_each([&](JsonValue const& value) {
+ if (!value.is_object())
+ return;
+ auto name = value.as_object().get_string("name"sv);
+ auto description = value.as_object().get_string("description"sv);
+ if (name.has_value())
+ reports.append({ name->to_byte_string(), description.has_value() ? *description : String {} });
+ });
+
+ CrashReportOutbox::the().send(move(reports));
+}
+
+void CrashReportsUI::delete_reports(JsonValue const& data)
+{
+ if (!data.is_array())
+ return;
+
+ Vector<ByteString> names;
+ data.as_array().for_each([&](JsonValue const& value) {
+ if (value.is_string())
+ names.append(value.as_string().to_byte_string());
+ });
+
+ CrashReportOutbox::the().remove(names);
+}
+
+void CrashReportsUI::show_report(JsonValue const& data)
+{
+ if (!data.is_string())
+ return;
+
+ auto name = data.as_string().to_byte_string();
+ auto report = CrashReportStore::the().saved_report(name);
+ if (report.is_error()) {
+ warnln("Could not read crash report {}: {}", name, report.error());
+ return;
+ }
+
+ JsonObject message;
+ message.set("name"sv, String::from_utf8_with_replacement_character(name));
+ message.set("text"sv, String::from_utf8_with_replacement_character(report.value().text));
+ async_send_message("showReport"sv, move(message));
+}
+
+}
diff --git a/Libraries/LibWebView/WebUI/CrashReportsUI.h b/Libraries/LibWebView/WebUI/CrashReportsUI.h
new file mode 100644
index 00000000000..941b855e381
--- /dev/null
+++ b/Libraries/LibWebView/WebUI/CrashReportsUI.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <LibWebView/CrashReportOutbox.h>
+#include <LibWebView/WebUI.h>
+
+namespace WebView {
+
+class CrashReportsUI final
+ : public WebUI
+ , public CrashReportOutboxObserver {
+ WEB_UI(CrashReportsUI);
+
+private:
+ virtual void register_interfaces() override;
+
+ virtual void crash_reports_changed() override;
+
+ void load_reports();
+ void send_reports(JsonValue const&);
+ void delete_reports(JsonValue const&);
+ void show_report(JsonValue const&);
+};
+
+}
diff --git a/Tests/LibWebView/TestOmnibox.cpp b/Tests/LibWebView/TestOmnibox.cpp
index 21996c1a37e..832ad16c375 100644
--- a/Tests/LibWebView/TestOmnibox.cpp
+++ b/Tests/LibWebView/TestOmnibox.cpp
@@ -204,6 +204,7 @@ TEST_CASE(all_web_ui_pages_are_suggested)
"about:about"sv,
"about:blocking"sv,
"about:bookmarks"sv,
+ "about:crashes"sv,
"about:downloads"sv,
"about:history"sv,
"about:newtab"sv,
diff --git a/UI/Qt/Application.cpp b/UI/Qt/Application.cpp
index 074a94d4809..fc9996f1b4f 100644
--- a/UI/Qt/Application.cpp
+++ b/UI/Qt/Application.cpp
@@ -1190,18 +1190,6 @@ void Application::update_feedback_buttons()
}
}
-void Application::review_crash_report(ByteString const& report_name)
-{
- if (!m_active_window)
- return;
-
- // The tab is blank, so no web content runs behind the review, and it closes once the review is left.
- auto* current_tab = m_active_window->current_tab();
- auto& tab = m_active_window->new_tab_from_url(URL::about_blank(), Web::HTML::ActivateTab::Yes, BrowserWindow::TabLocation::after_current_tab());
- tab.view().review_hidden_crash_report(report_name);
- tab.enter_report_review(current_tab);
-}
-
void Application::open_file()
{
if (!m_active_window) {
diff --git a/UI/Qt/Application.h b/UI/Qt/Application.h
index 6c52658c4d4..646b3f8be1d 100644
--- a/UI/Qt/Application.h
+++ b/UI/Qt/Application.h
@@ -83,7 +83,6 @@ public:
bool confirm_stop_active_downloads(QWidget* parent = nullptr);
void update_feedback_buttons();
- void review_crash_report(ByteString const& report_name);
BrowserWindow& active_window() const { return *m_active_window; }
void set_active_window(BrowserWindow& window) { m_active_window = &window; }
diff --git a/UI/Qt/WebContentView.cpp b/UI/Qt/WebContentView.cpp
index 19d8361413b..38ad886e07f 100644
--- a/UI/Qt/WebContentView.cpp
+++ b/UI/Qt/WebContentView.cpp
@@ -1519,14 +1519,6 @@ void WebContentView::set_crash_overlay_visible(bool visible)
schedule_repaint();
}
-void WebContentView::review_hidden_crash_report(ByteString const& report_name)
-{
- set_crash_overlay_visible(true);
- show_crash_report_review(report_name);
- if (!m_crash_report_review)
- set_crash_overlay_visible(false);
-}
-
// A tab opened only for a review lets go of what it showed over its page once the user takes the tab elsewhere.
void WebContentView::leave_report_review()
{
@@ -1759,41 +1751,30 @@ bool WebContentView::is_page_covered_by_overlay() const
return false;
}
-// A report of a crash with no crash screen of its own is reviewed in a blank tab opened for it.
-void WebContentView::show_crash_report_review(Optional<ByteString> const& hidden_crash_report_name)
+void WebContentView::show_crash_report_review()
{
if (!m_crash_report_container || m_crash_report_review)
return;
- auto is_hidden_crash = hidden_crash_report_name.has_value();
- auto report_name = is_hidden_crash ? hidden_crash_report_name : crash_report_name();
+ auto report_name = crash_report_name();
if (!report_name.has_value())
return;
- m_crash_report_review = new CrashReportReviewWidget(is_hidden_crash ? tr("Close tab") : tr("Reload page"), m_crash_report_container);
- if (auto result = m_crash_report_review->open_report(report_name, is_hidden_crash ? Optional<String> {} : crash_report_website()); result.is_error()) {
+ m_crash_report_review = new CrashReportReviewWidget(tr("Reload page"), m_crash_report_container);
+ if (auto result = m_crash_report_review->open_report(report_name, crash_report_website()); result.is_error()) {
warnln("Could not open crash report {}: {}", *report_name, result.error());
delete m_crash_report_review;
m_crash_report_review = nullptr;
return;
}
- m_crash_report_review->on_exit = [this, is_hidden_crash] {
- // The tab was opened only for the review, and a report on its way keeps going without it. The reports still
- // waiting stay behind the feedback button.
- if (is_hidden_crash) {
- Application::the().update_feedback_buttons();
- if (on_close)
- on_close();
- return;
- }
+ m_crash_report_review->on_exit = [this] {
reload();
};
m_crash_report_review->on_report_text_visibility_change = [this](bool visible) {
m_crash_overlay->set_fills_tab(visible);
};
- auto answered_message = is_hidden_crash ? tr("Part of Ladybird stopped unexpectedly.") : crash_screen_message();
- m_crash_report_review->on_answered = [this, answered_message] {
- m_crash_overlay_message->setText(answered_message);
+ m_crash_report_review->on_answered = [this] {
+ m_crash_overlay_message->setText(crash_screen_message());
};
// The review offers reloading among its own actions, and the website among its fields. It takes text, so Return
@@ -1802,9 +1783,7 @@ void WebContentView::show_crash_report_review(Optional<ByteString> const& hidden
auto reload_button_had_focus = m_crash_overlay_reload_button->hasFocus();
m_crash_overlay_reload_button->hide();
m_crash_overlay_url->hide();
- m_crash_overlay_message->setText(is_hidden_crash
- ? tr("Part of Ladybird stopped unexpectedly. You can send us a crash report to help fix it.")
- : tr("This page crashed. You can send us a crash report to help fix it."));
+ m_crash_overlay_message->setText(tr("This page crashed. You can send us a crash report to help fix it."));
m_crash_report_container->layout()->addWidget(m_crash_report_review);
m_crash_report_container->show();
if (reload_button_had_focus)
diff --git a/UI/Qt/WebContentView.h b/UI/Qt/WebContentView.h
index 369a0089c55..4cc910ce63d 100644
--- a/UI/Qt/WebContentView.h
+++ b/UI/Qt/WebContentView.h
@@ -181,7 +181,6 @@ public:
void finish_window_move();
void close_select_dropdown_after_crash();
void cancel_mouse_press();
- void review_hidden_crash_report(ByteString const& report_name);
void leave_report_review();
void review_web_compat_report(WebCompatReportCapture);
void select_web_compat_report_screenshot(Function<void(QImage)> on_selected, Function<void()> on_close = {});
@@ -271,7 +270,7 @@ private:
void watch_screen_geometry(QScreen&);
void set_crash_overlay_visible(bool);
- void show_crash_report_review(Optional<ByteString> const& hidden_crash_report_name = {});
+ void show_crash_report_review();
void start_web_compat_report();
ScreenshotSelectionOverlay& select_screenshot(QImage const& frame, ScreenshotSelectionOverlay::Purpose, Function<void()> on_close = {});
diff --git a/UI/Qt/WindowToolbar.cpp b/UI/Qt/WindowToolbar.cpp
index ddc40ce52d1..81a655ff37b 100644
--- a/UI/Qt/WindowToolbar.cpp
+++ b/UI/Qt/WindowToolbar.cpp
@@ -1489,11 +1489,8 @@ void WindowToolbar::show_feedback_popover()
m_feedback_popover->on_report_bug = [this] {
browser_window().new_tab_from_url(WebView::new_bug_report_url(), Web::HTML::ActivateTab::Yes, BrowserWindow::TabLocation::after_current_tab());
};
- m_feedback_popover->on_review_crash_reports = [] {
- auto names = WebView::CrashReportStore::the().pending_report_names();
- if (!names.is_error() && !names.value().is_empty())
- Application::the().review_crash_report(names.value().first());
- Application::the().update_feedback_buttons();
+ m_feedback_popover->on_review_crash_reports = [this] {
+ browser_window().new_tab_from_url(URL::URL::about("crashes"sv), Web::HTML::ActivateTab::Yes, BrowserWindow::TabLocation::after_current_tab());
};
}
diff --git a/UI/cmake/ResourceFiles.cmake b/UI/cmake/ResourceFiles.cmake
index 46ecf22371b..b9871debae7 100644
--- a/UI/cmake/ResourceFiles.cmake
+++ b/UI/cmake/ResourceFiles.cmake
@@ -34,6 +34,7 @@ set(ABOUT_PAGES
about.html
blocking.html
bookmarks.html
+ crashes.html
downloads.html
history.html
newtab.html