Truly independent web browser
LibWebView: Only group crash reports that have a native stack
Andreas Kling1099ff38b037
diff --git a/Libraries/LibWebView/CrashReportDiagnostics.h b/Libraries/LibWebView/CrashReportDiagnostics.hindex d0f2e3352ed..aa3f620f7d0 100644--- a/Libraries/LibWebView/CrashReportDiagnostics.h+++ b/Libraries/LibWebView/CrashReportDiagnostics.h@@ -37,6 +37,9 @@ struct WEBVIEW_API CrashReportDiagnostics {// What the crash has in common with every other crash of the same bug: the process, how it failed and where.ByteString signature() const;+ // Whether the report has frames with addresses, which are what can tell one crash from another.+ bool has_native_stack() const { return stack.contains(" 0x"sv); }+Vector<Header> headers;ByteString stack;diff --git a/Libraries/LibWebView/WebUI/CrashReportsUI.cpp b/Libraries/LibWebView/WebUI/CrashReportsUI.cppindex 3dbae4b7138..29606973d3e 100644--- a/Libraries/LibWebView/WebUI/CrashReportsUI.cpp+++ b/Libraries/LibWebView/WebUI/CrashReportsUI.cpp@@ -94,16 +94,18 @@ void CrashReportsUI::load_reports()Vector<Group> groups;HashMap<ByteString, size_t> group_indices;for (auto const& name : names) {- ByteString signature { "Unreadable"sv };+ // Only a stack can show that two reports are the same crash, so every other report gets a row of its own.+ auto signature = name;String process = "Unreadable report"_string;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.+ // A report that cannot be read still counts as waiting, so it gets a row 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();+ if (diagnostics.has_native_stack())+ signature = diagnostics.signature();process = MUST(String::from_utf8(plain_process_name(diagnostics.header("Process"sv))));crashed_at = diagnostics.crashed_at;}diff --git a/Tests/LibWebView/TestCrashReportDiagnostics.cpp b/Tests/LibWebView/TestCrashReportDiagnostics.cppindex d042b839921..204850d864e 100644--- a/Tests/LibWebView/TestCrashReportDiagnostics.cpp+++ b/Tests/LibWebView/TestCrashReportDiagnostics.cpp@@ -158,3 +158,11 @@ TEST_CASE(an_empty_report_parses_to_nothing)EXPECT(diagnostics.stack.is_empty());EXPECT_EQ(diagnostics.signal.name, ""sv);}++TEST_CASE(only_frames_with_addresses_count_as_a_native_stack)+{+ EXPECT(CrashReportDiagnostics::parse("Native stack (binary build ID, object address):\n#0 abcdef 0x1234\n"sv).has_native_stack());+ EXPECT(!CrashReportDiagnostics::parse("Native stack (binary build ID, object address):\n#0 unavailable\n"sv).has_native_stack());+ EXPECT(!CrashReportDiagnostics::parse("Native stack (binary build ID, object address):\nUnavailable: the process exited without a captured native stack.\n"sv).has_native_stack());+ EXPECT(!CrashReportDiagnostics::parse("Process: WebContent\n"sv).has_native_stack());+}