Skip to content

Truly independent web browser

LibWebView+UI/Qt: Decline waiting crash reports when leaving a review

Jelle Raaijmakersde52825a89ad
diff --git a/Documentation/CrashReports.md b/Documentation/CrashReports.md
index 9f8d11844da..3ef4018ae1b 100644
--- a/Documentation/CrashReports.md
+++ b/Documentation/CrashReports.md
@@ -30,14 +30,15 @@ still awaiting review. While no browser window is active, the popover waits
until one is. Browsers driven by WebDriver never ask. Ladybird automatically
offers each report at most once; leaving the crash screen or the popover without
answering keeps the report on the device without offering it again on a later
-launch. A report of a crash from more than 14 days ago, or from before October
-2, 2026 20:00 UTC, is never offered, but stays in the folder. Reports that have
-been offered move into a `Seen/` subdirectory, where the newest 20 are kept for
-reference. **Settings > Advanced > Crash reports > Open folder** remains
-available even when nothing has crashed. Reload restores the failed page without
-adding a crash-screen history entry; Back and Forward continue to use the
-original session history. The crash screen is native browser UI, so it does not
-depend on a web content process.
+launch. Dismissing the popover, or closing the tab opened for a review, does the
+same for every other report still waiting. A report of a crash from more than 14
+days ago, or from before October 2, 2026 20:00 UTC, is never offered, but stays
+in the folder. Reports that have been offered move into a `Seen/` subdirectory,
+where the newest 20 are kept for reference. **Settings > Advanced > Crash
+reports > Open folder** remains available even when nothing has crashed. Reload
+restores the failed page without adding a crash-screen history entry; Back and
+Forward continue to use the original session history. The crash screen is native
+browser UI, so it does not depend on a web content process.
The review asks what the user was doing and lets them choose whether to send the
report. Report details lists its main fields, such as the failure, signal,
diff --git a/Libraries/LibWebView/CrashReportStore.cpp b/Libraries/LibWebView/CrashReportStore.cpp
index 7be5ce53cf5..4edd0636a96 100644
--- a/Libraries/LibWebView/CrashReportStore.cpp
+++ b/Libraries/LibWebView/CrashReportStore.cpp
@@ -284,6 +284,16 @@ ErrorOr<void> CrashReportStore::mark_seen(ByteString const& name) const
return {};
}
+ErrorOr<void> CrashReportStore::mark_all_seen(UnixDateTime now) const
+{
+ ErrorOr<void> result;
+ for (auto const& name : TRY(pending_report_names(now))) {
+ if (auto marked = mark_seen(name); marked.is_error() && !result.is_error())
+ result = marked.release_error();
+ }
+ return result;
+}
+
ErrorOr<void> CrashReportStore::remove_sent_report(ByteString const& name) const
{
if (!is_saved_report_name(name))
@@ -472,6 +482,7 @@ ErrorOr<CrashReportStore::SavedReport> CrashReportStore::saved_report(ByteString
ErrorOr<Vector<ByteString>> CrashReportStore::pending_report_names(UnixDateTime) const { return Vector<ByteString> {}; }
bool CrashReportStore::has_pending_reports(UnixDateTime) const { return false; }
ErrorOr<void> CrashReportStore::mark_seen(ByteString const&) const { return {}; }
+ErrorOr<void> CrashReportStore::mark_all_seen(UnixDateTime) const { return {}; }
ErrorOr<void> CrashReportStore::remove_sent_report(ByteString const&) const { return {}; }
ErrorOr<ByteString> CrashReportStore::store_report(ProcessType, StringView, UnixDateTime) const
diff --git a/Libraries/LibWebView/CrashReportStore.h b/Libraries/LibWebView/CrashReportStore.h
index 31bcd39e0ac..3fe942261e6 100644
--- a/Libraries/LibWebView/CrashReportStore.h
+++ b/Libraries/LibWebView/CrashReportStore.h
@@ -41,6 +41,7 @@ public:
// Seen reports move into a subdirectory, where the newest of them are kept for reference and never offered again.
ErrorOr<void> mark_seen(ByteString const& name) const;
+ ErrorOr<void> mark_all_seen(UnixDateTime now = UnixDateTime::now()) const;
ErrorOr<void> remove_sent_report(ByteString const& name) const;
ErrorOr<ByteString> store_report(ProcessType, StringView text, UnixDateTime crashed_at) const;
diff --git a/Tests/LibWebView/TestCrashReportStore.cpp b/Tests/LibWebView/TestCrashReportStore.cpp
index d70f91bb577..6e1fcf39972 100644
--- a/Tests/LibWebView/TestCrashReportStore.cpp
+++ b/Tests/LibWebView/TestCrashReportStore.cpp
@@ -154,6 +154,30 @@ TEST_CASE(a_seen_report_is_no_longer_pending)
EXPECT(store.has_pending_reports(now));
}
+TEST_CASE(marking_all_reports_seen_leaves_none_pending)
+{
+ cleanup();
+ ScopeGuard guard = cleanup;
+
+ auto older = report_name("2026-03-04T05-06-07Z"sv);
+ auto newer = report_name("2026-03-05T05-06-07Z"sv);
+ auto stale = report_name("2026-03-03T05-06-07Z"sv);
+ write_file(older, "Older report\n"sv);
+ write_file(newer, "Newer report\n"sv);
+ write_file(stale, "Stale report\n"sv, UnixDateTime::from_unix_time_parts(2026, 10, 1, 0, 0, 0, 0));
+ auto store = test_store();
+
+ MUST(store.mark_all_seen(now));
+ EXPECT(!store.has_pending_reports(now));
+ EXPECT_EQ(directory_entries(), Vector<ByteString> { stale });
+ EXPECT_EQ(directory_entries("Seen"sv).size(), 2u);
+ EXPECT_EQ(MUST(store.saved_report(older)).text, "Older report\n"sv);
+ EXPECT_EQ(MUST(store.saved_report(newer)).text, "Newer report\n"sv);
+
+ MUST(store.mark_all_seen(now));
+ EXPECT_EQ(directory_entries("Seen"sv).size(), 2u);
+}
+
TEST_CASE(a_report_from_before_the_hard_cutoff_date_is_not_pending)
{
cleanup();
diff --git a/UI/Qt/CrashReportNotifier.cpp b/UI/Qt/CrashReportNotifier.cpp
index c1b1edb4aa8..7f500855d8a 100644
--- a/UI/Qt/CrashReportNotifier.cpp
+++ b/UI/Qt/CrashReportNotifier.cpp
@@ -57,8 +57,11 @@ void CrashReportNotifier::show_pending()
return;
// A newer report takes the place of one still on screen, wherever it is, which counts as offered.
- if (m_popover)
+ if (m_popover) {
+ m_is_replacing_popover = true;
m_popover->close();
+ m_is_replacing_popover = false;
+ }
if (m_anchor)
m_anchor->removeEventFilter(this);
m_anchor = anchor;
@@ -71,11 +74,14 @@ void CrashReportNotifier::show_pending()
m_popover->setAttribute(Qt::WA_DeleteOnClose);
// The review marks the report as seen once it opens it. The popover is the report's one automatic prompt, so
- // however else it is left, the report is not offered again.
+ // however else it is left, the report is not offered again. Leaving it also declines the reports still waiting,
+ // except when a newer report takes its place, which is about to be offered itself.
m_popover->on_accept = [report_name] { Application::the().review_crash_report(report_name); };
- m_popover->on_dismiss = [report_name] {
- if (auto result = WebView::CrashReportStore::the().mark_seen(report_name); result.is_error())
- warnln("Could not mark crash report as seen: {}", result.error());
+ m_popover->on_dismiss = [this, report_name] {
+ auto& store = WebView::CrashReportStore::the();
+ auto result = m_is_replacing_popover ? store.mark_seen(report_name) : store.mark_all_seen();
+ if (result.is_error())
+ warnln("Could not mark crash reports as seen: {}", result.error());
};
// The menu button's palette is transparent, so the popover takes its colors from the window instead.
diff --git a/UI/Qt/CrashReportNotifier.h b/UI/Qt/CrashReportNotifier.h
index b34f675dce6..37936fdd84e 100644
--- a/UI/Qt/CrashReportNotifier.h
+++ b/UI/Qt/CrashReportNotifier.h
@@ -29,6 +29,7 @@ private:
virtual bool eventFilter(QObject*, QEvent*) override;
bool m_is_listening_for_activation { false };
+ bool m_is_replacing_popover { false };
Optional<ByteString> m_pending_report_name;
QPointer<MessagePopover> m_popover;
QPointer<QWidget> m_anchor;
diff --git a/UI/Qt/WebContentView.cpp b/UI/Qt/WebContentView.cpp
index 30d90708f05..e8c683bca3f 100644
--- a/UI/Qt/WebContentView.cpp
+++ b/UI/Qt/WebContentView.cpp
@@ -26,6 +26,7 @@
#include <LibWebCommon/UIEvents/MouseButton.h>
#include <LibWebView/Application.h>
#include <LibWebView/CrashReport.h>
+#include <LibWebView/CrashReportStore.h>
#include <LibWebView/PlatformColors.h>
#include <LibWebView/Utilities.h>
#include <LibWebView/WebContentClient.h>
@@ -1386,8 +1387,11 @@ void WebContentView::show_crash_report_review(Optional<ByteString> const& hidden
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 tab was opened only for the review, and a report on its way keeps going without it. Closing it also
+ // declines the reports still waiting, so none of them is offered again.
if (is_hidden_crash) {
+ if (auto result = WebView::CrashReportStore::the().mark_all_seen(); result.is_error())
+ warnln("Could not mark crash reports as seen: {}", result.error());
if (on_close)
on_close();
return;