Truly independent web browser
UI/Qt: Remove the next report button from crash review
Andreas Kling9d29b6c17b06
diff --git a/Libraries/LibWebView/CrashReportReview.cpp b/Libraries/LibWebView/CrashReportReview.cppindex 98e0c2388b7..4a9a3d403a3 100644--- a/Libraries/LibWebView/CrashReportReview.cpp+++ b/Libraries/LibWebView/CrashReportReview.cpp@@ -4,7 +4,6 @@* SPDX-License-Identifier: BSD-2-Clause*/-#include <AK/AnyOf.h>#include <AK/Hex.h>#include <AK/WeakPtr.h>#include <LibCrypto/Hash/SHA2.h>@@ -30,7 +29,7 @@ CrashReportReview::CrashReportReview(CrashReportStore& store)CrashReportReview::~CrashReportReview() = default;-ErrorOr<CrashReportReview::Report> CrashReportReview::open(Optional<ByteString> const& name, MarkAsSeen mark_as_seen)+ErrorOr<CrashReportReview::Report> CrashReportReview::open(ByteString const& report_name, MarkAsSeen mark_as_seen){VERIFY(!m_submission);@@ -40,14 +39,6 @@ ErrorOr<CrashReportReview::Report> CrashReportReview::open(Optional<ByteString>m_prepared_description = {};m_prepared_url = {};- auto report_name = name.value_or({});- if (report_name.is_empty()) {- auto pending = TRY(m_store.pending_report_names());- if (pending.is_empty())- return Error::from_string_literal("There is no crash report to review");- report_name = pending.first();- }-auto saved_report = TRY(m_store.saved_report(report_name));// Without this, a report closed rather than answered would come back on every launch.@@ -101,14 +92,6 @@ ErrorOr<CrashReportReview::Report> CrashReportReview::open(Optional<ByteString>return report;}-bool CrashReportReview::has_next_report() const-{- auto pending = m_store.pending_report_names();- if (pending.is_error())- return false;- return any_of(pending.value(), [&](auto const& name) { return name != m_report_name; });-}-ErrorOr<ByteString> CrashReportReview::report_text() const{VERIFY(!m_report_name.is_empty());diff --git a/Libraries/LibWebView/CrashReportReview.h b/Libraries/LibWebView/CrashReportReview.hindex 155cc3a1cf5..07e90cf8d87 100644--- a/Libraries/LibWebView/CrashReportReview.h+++ b/Libraries/LibWebView/CrashReportReview.h@@ -50,11 +50,10 @@ public:Yes,};- // Opens the named report, or the newest one awaiting review. Being shown as the user's one prompt for a report makes+ // Opens the named report. Being shown as the user's one prompt for a report makes// it count as seen from then on, so declining it needs no further step. A report that goes on waiting whatever// comes of this review is opened without that.- ErrorOr<Report> open(Optional<ByteString> const& name = {}, MarkAsSeen = MarkAsSeen::Yes);- bool has_next_report() const;+ ErrorOr<Report> open(ByteString const& name, MarkAsSeen = MarkAsSeen::Yes);// The open report's text, exactly as it would be attached.ErrorOr<ByteString> report_text() const;diff --git a/Tests/LibWebView/TestCrashReportReview.cpp b/Tests/LibWebView/TestCrashReportReview.cppindex f49c7e15003..e5011648cb6 100644--- a/Tests/LibWebView/TestCrashReportReview.cpp+++ b/Tests/LibWebView/TestCrashReportReview.cpp@@ -145,28 +145,6 @@ TEST_CASE(a_report_that_does_not_say_when_it_crashed_has_no_crash_date)EXPECT(field.label != "Crash date"sv);}-TEST_CASE(an_opened_report_is_no_longer_pending)-{- cleanup();- ScopeGuard guard = cleanup;-- auto older = write_report("2026-10-01T12-00-00Z"sv);- auto newer = write_report("2026-10-01T13-00-00Z"sv);- WebView::CrashReportStore store { test_directory() };- CrashReportReview review { store };-- // Without a name, the newest report waiting for an answer is shown.- EXPECT_EQ(MUST(review.open()).name, newer);- EXPECT(!is_pending(newer));- EXPECT(review.has_next_report());-- EXPECT_EQ(MUST(review.open()).name, older);- EXPECT(!is_pending(older));- EXPECT(!review.has_next_report());-- EXPECT(review.open().is_error());-}-TEST_CASE(a_report_opened_without_marking_it_seen_stays_pending){cleanup();diff --git a/Tests/UI/Qt/TestCrashReportReviewWidget.cpp b/Tests/UI/Qt/TestCrashReportReviewWidget.cppindex 0b4514906c4..f233da9ee65 100644--- a/Tests/UI/Qt/TestCrashReportReviewWidget.cpp+++ b/Tests/UI/Qt/TestCrashReportReviewWidget.cpp@@ -93,7 +93,6 @@ TEST_CASE(a_crash_screen_offers_the_website_without_including_it)child<QPushButton>(widget, "CrashReportDeclineButton").click();EXPECT_EQ(status_title(widget), "Report not sent");- EXPECT(!child<QPushButton>(widget, "CrashReportNextButton").isVisible());}TEST_CASE(the_review_offers_to_exit_before_and_after_answering)@@ -182,38 +181,18 @@ TEST_CASE(a_choice_that_cannot_be_sent_is_explained_in_place)EXPECT(child<QPushButton>(widget, "CrashReportSendButton").isVisible());}-TEST_CASE(the_review_walks_through_every_waiting_report)+TEST_CASE(without_a_website_there_is_nothing_to_include){cleanup();ScopeGuard guard = cleanup;- write_report("2026-10-01T12-00-00Z"sv);- write_report("2026-10-01T13-00-00Z"sv);+ auto name = write_report("2026-10-01T12-00-00Z"sv);WebView::CrashReportStore store { test_directory() };CrashReportReviewWidget widget { QStringLiteral("Continue"), nullptr, store };- auto exited = false;- widget.on_exit = [&] { exited = true; };- MUST(widget.open_report());+ MUST(widget.open_report(name));widget.show();- // Without a website to offer, there is nothing to include.EXPECT(!child<QCheckBox>(widget, "CrashReportIncludeWebsite").isVisible());-- child<QPushButton>(widget, "CrashReportDeclineButton").click();- auto& next = child<QPushButton>(widget, "CrashReportNextButton");- EXPECT(next.isVisible());-- next.click();- EXPECT(child<QPushButton>(widget, "CrashReportSendButton").isVisible());- EXPECT(!store.has_pending_reports());-- child<QPushButton>(widget, "CrashReportDeclineButton").click();- EXPECT(!next.isVisible());- auto& exit_button = child<QPushButton>(widget, "CrashReportExitButton");- EXPECT(exit_button.isVisible());-- exit_button.click();- EXPECT(exited);}TEST_CASE(sending_shows_its_progress_and_outcome)diff --git a/UI/Qt/CrashReportReviewWidget.cpp b/UI/Qt/CrashReportReviewWidget.cppindex 2757d8af6b8..c4e8132630e 100644--- a/UI/Qt/CrashReportReviewWidget.cpp+++ b/UI/Qt/CrashReportReviewWidget.cpp@@ -142,15 +142,12 @@ CrashReportReviewWidget::CrashReportReviewWidget(QString exit_text, QWidget* parm_retry_button->setObjectName("CrashReportRetryButton");m_cancel_button = new QPushButton(tr("Cancel"), m_status_page);m_cancel_button->setObjectName("CrashReportCancelButton");- m_next_button = new QPushButton(tr("Review the next crash report"), m_status_page);- m_next_button->setObjectName("CrashReportNextButton");m_exit_button = new QPushButton(exit_text, m_status_page);m_exit_button->setObjectName("CrashReportExitButton");auto* status_buttons = new QHBoxLayout;status_buttons->setSpacing(button_spacing);status_buttons->addWidget(m_retry_button);status_buttons->addWidget(m_cancel_button);- status_buttons->addWidget(m_next_button);status_buttons->addWidget(m_exit_button);status_buttons->addStretch();status_layout->addLayout(status_buttons);@@ -178,13 +175,6 @@ CrashReportReviewWidget::CrashReportReviewWidget(QString exit_text, QWidget* parshow_page(*m_review_page);m_description_edit->setFocus(Qt::OtherFocusReason);});- QObject::connect(m_next_button, &QPushButton::clicked, this, [this] {- if (auto result = open_report(); result.is_error()) {- warnln("Could not open the next crash report: {}", result.error());- if (on_exit)- on_exit();- }- });for (auto* button : { review_exit_button, m_exit_button }) {QObject::connect(button, &QPushButton::clicked, this, [this] {if (on_exit)@@ -229,7 +219,7 @@ void CrashReportReviewWidget::update_chrome_style()m_is_updating_chrome_style = false;}-ErrorOr<void> CrashReportReviewWidget::open_report(Optional<ByteString> const& name, Optional<String> const& website)+ErrorOr<void> CrashReportReviewWidget::open_report(ByteString const& name, Optional<String> const& website){auto report = TRY(m_review.open(name));@@ -301,7 +291,7 @@ void CrashReportReviewWidget::show_status(QString const& title, QString const& mm_status_title->setText(title);m_status_message->setText(message);show_page(*m_status_page);- QPushButton* all_actions[] = { m_retry_button, m_cancel_button, m_next_button, m_exit_button };+ QPushButton* all_actions[] = { m_retry_button, m_cancel_button, m_exit_button };show_actions(all_actions, actions, primary);}@@ -344,16 +334,12 @@ void CrashReportReviewWidget::show_failure(WebView::ReportSubmission::Failure fashow_outcome(tr("Couldn’t send report"), qstring_from_ak_string(reason));}-// Once the report is answered, the review moves on to the next one waiting, or is left.void CrashReportReviewWidget::show_outcome(QString const& title, QString const& message){if (on_answered)on_answered();- if (m_review.has_next_report())- show_status(title, message, { m_next_button, m_exit_button }, m_next_button);- else- show_status(title, message, { m_exit_button }, m_exit_button);+ show_status(title, message, { m_exit_button }, m_exit_button);}}diff --git a/UI/Qt/CrashReportReviewWidget.h b/UI/Qt/CrashReportReviewWidget.hindex 90eaa75283c..85fd8d2d522 100644--- a/UI/Qt/CrashReportReviewWidget.h+++ b/UI/Qt/CrashReportReviewWidget.h@@ -36,7 +36,7 @@ public:// The exit button leaves the review, for example by reloading the crashed page.CrashReportReviewWidget(QString exit_text, QWidget* parent, WebView::CrashReportStore& = WebView::CrashReportStore::the());- ErrorOr<void> open_report(Optional<ByteString> const& name = {}, Optional<String> const& website = {});+ ErrorOr<void> open_report(ByteString const& name, Optional<String> const& website = {});void show_progress(WebView::ReportSubmission::Stage);void show_retry(String const& reason, u32 retry_number, u32 maximum_retries, u32 delay_seconds);@@ -87,7 +87,6 @@ private:QLabel* m_status_message { nullptr };QPushButton* m_retry_button { nullptr };QPushButton* m_cancel_button { nullptr };- QPushButton* m_next_button { nullptr };QPushButton* m_exit_button { nullptr };bool m_is_updating_chrome_style { false };diff --git a/UI/Qt/WebContentView.cpp b/UI/Qt/WebContentView.cppindex 38ad886e07f..ff18298452c 100644--- a/UI/Qt/WebContentView.cpp+++ b/UI/Qt/WebContentView.cpp@@ -1761,7 +1761,7 @@ void WebContentView::show_crash_report_review()return;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()) {+ 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;