Skip to content

Truly independent web browser

LibWebView: Add a Feedback tab to Settings with a Never send mode

Andreas Kling1ed580dcb68a
diff --git a/Base/res/ladybird/about-pages/crashes.html b/Base/res/ladybird/about-pages/crashes.html
index 7931e2c5aa6..f734eeea2da 100644
--- a/Base/res/ladybird/about-pages/crashes.html
+++ b/Base/res/ladybird/about-pages/crashes.html
@@ -278,7 +278,7 @@
</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>
+ <a id="settings" href="about:settings#feedback">Crash report settings</a>
<template id="report-template">
<section class="report">
diff --git a/Base/res/ladybird/about-pages/settings.html b/Base/res/ladybird/about-pages/settings.html
index 1da22930d6f..80e3ab533d5 100644
--- a/Base/res/ladybird/about-pages/settings.html
+++ b/Base/res/ladybird/about-pages/settings.html
@@ -362,6 +362,73 @@
overflow-x: auto;
}
+ .crash-modes {
+ margin-top: 10px;
+
+ border-radius: 10px;
+ box-shadow: inset 0 0 0 1px var(--separator);
+ overflow: hidden;
+ }
+
+ .crash-mode {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+
+ min-height: 40px;
+ margin: 0;
+ padding: 8px 14px;
+
+ cursor: pointer;
+ }
+
+ .crash-mode + .crash-mode {
+ border-top: 1px solid var(--separator-soft);
+ }
+
+ .crash-mode:has(input:checked) {
+ background: var(--choice-fill);
+ }
+
+ .crash-mode:has(input:focus-visible) {
+ box-shadow: inset 0 0 0 2px var(--focus-ring);
+ }
+
+ .crash-mode input {
+ position: absolute;
+ opacity: 0;
+ pointer-events: none;
+ }
+
+ .crash-mode-text {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ gap: 1px;
+ }
+
+ .crash-mode .description {
+ margin: 0;
+ font-size: 12px;
+ }
+
+ .crash-mode svg {
+ visibility: hidden;
+ flex: none;
+ width: 14px;
+ height: 14px;
+
+ fill: none;
+ stroke: var(--choice);
+ stroke-width: 1.8;
+ stroke-linecap: round;
+ stroke-linejoin: round;
+ }
+
+ .crash-mode:has(input:checked) svg {
+ visibility: visible;
+ }
+
.tab-button {
background: none;
border: none;
@@ -775,6 +842,7 @@
<button id="tab-button-languages" class="tab-button" data-tab="languages" role="tab">Languages</button>
<button id="tab-button-services" class="tab-button" data-tab="services" role="tab">Services</button>
<button id="tab-button-network" class="tab-button" data-tab="network" role="tab">Network</button>
+ <button id="tab-button-feedback" class="tab-button" data-tab="feedback" role="tab">Feedback</button>
<button id="tab-button-advanced" class="tab-button" data-tab="advanced" role="tab">Advanced</button>
</div>
</nav>
@@ -840,17 +908,6 @@
</div>
</div>
</div>
-
- <h3 class="card-title">Crash reports</h3>
- <div class="card">
- <div class="card-body">
- <div class="inline-container">
- <p>Open the folder containing saved crash reports.</p>
- <button id="open-crash-reports" class="secondary-button">Open folder</button>
- </div>
- <p id="crash-reports-status" class="description" role="status" hidden></p>
- </div>
- </div>
</div>
<div class="tab-panel" id="tab-appearance" data-title="Appearance">
@@ -1259,6 +1316,49 @@
</div>
</div>
+ <div class="tab-panel" id="tab-feedback" data-title="Feedback">
+ <div class="card">
+ <div class="card-body">
+ <div id="show-feedback-button-group" class="card-group inline-container hidden">
+ <label for="show-feedback-button">Show Feedback button in toolbar</label>
+ <input id="show-feedback-button" type="checkbox" switch />
+ </div>
+ <div class="card-group">
+ <span id="crash-reports-title">Crash reports</span>
+ <div class="crash-modes" role="radiogroup" aria-labelledby="crash-reports-title">
+ <label class="crash-mode">
+ <input type="radio" name="crash-report-sending" value="ask" />
+ <span class="crash-mode-text">
+ Ask me
+ <span class="description"
+ >Reports are kept on this computer until you review them</span
+ >
+ </span>
+ <svg aria-hidden="true" viewBox="0 0 16 16"><path d="M3.5 8.5l3 3 6-7" /></svg>
+ </label>
+ <label class="crash-mode">
+ <input type="radio" name="crash-report-sending" value="never" />
+ <span class="crash-mode-text">
+ Never send
+ <span class="description">Nothing is kept</span>
+ </span>
+ <svg aria-hidden="true" viewBox="0 0 16 16"><path d="M3.5 8.5l3 3 6-7" /></svg>
+ </label>
+ </div>
+ </div>
+ <div id="crash-reports-waiting-group" class="card-group inline-container hidden">
+ <span id="crash-reports-waiting" class="description"></span>
+ <button id="review-crash-reports" class="secondary-button">Review reports</button>
+ </div>
+ <div class="card-group inline-container">
+ <p>Open the folder containing saved crash reports.</p>
+ <button id="open-crash-reports" class="secondary-button">Open folder</button>
+ </div>
+ <p id="crash-reports-status" class="description" role="status" hidden></p>
+ </div>
+ </div>
+ </div>
+
<div class="tab-panel" id="tab-advanced" data-title="Advanced">
<div class="search-container">
<svg
@@ -1464,6 +1564,7 @@
<script src="resource://ladybird/about-pages/settings/blocking.js" type="module"></script>
<script src="resource://ladybird/about-pages/settings/browsing-behavior.js" type="module"></script>
<script src="resource://ladybird/about-pages/settings/content.js" type="module"></script>
+ <script src="resource://ladybird/about-pages/settings/feedback.js" type="module"></script>
<script src="resource://ladybird/about-pages/settings/geolocation.js" type="module"></script>
<script src="resource://ladybird/about-pages/settings/languages.js" type="module"></script>
<script src="resource://ladybird/about-pages/settings/network.js" type="module"></script>
diff --git a/Base/res/ladybird/about-pages/settings/advanced.js b/Base/res/ladybird/about-pages/settings/advanced.js
index 7e9649a67dc..e778cc49b8c 100644
--- a/Base/res/ladybird/about-pages/settings/advanced.js
+++ b/Base/res/ladybird/about-pages/settings/advanced.js
@@ -99,6 +99,11 @@ function loadConfigVariables(settings) {
const configVariables = settings.configVariableDefinitions || [];
configVariables.forEach(variable => {
+ // This one has its own switch on the Feedback tab.
+ if (variable.name === "ui.toolbar.show_feedback_button") {
+ return;
+ }
+
const previous = CONFIG_VARIABLES.get(variable.name);
if (previous && JSON.stringify(previous.value) === JSON.stringify(variable.value)) {
return;
@@ -125,15 +130,3 @@ document.addEventListener("WebUIMessage", event => {
loadConfigVariables(event.detail.data);
}
});
-
-const crashReportsStatus = document.querySelector("#crash-reports-status");
-document.querySelector("#open-crash-reports").addEventListener("click", () => {
- crashReportsStatus.hidden = true;
- ladybird.sendMessage("showCrashReports");
-});
-document.addEventListener("WebUIMessage", event => {
- if (event.detail.name === "crashReportsStatus") {
- crashReportsStatus.textContent = event.detail.data;
- crashReportsStatus.hidden = !event.detail.data;
- }
-});
diff --git a/Base/res/ladybird/about-pages/settings/feedback.js b/Base/res/ladybird/about-pages/settings/feedback.js
new file mode 100644
index 00000000000..94a46f6f109
--- /dev/null
+++ b/Base/res/ladybird/about-pages/settings/feedback.js
@@ -0,0 +1,59 @@
+const showFeedbackButtonGroup = document.querySelector("#show-feedback-button-group");
+const showFeedbackButton = document.querySelector("#show-feedback-button");
+const crashModes = [...document.querySelectorAll("input[name=crash-report-sending]")];
+const crashReportsWaitingGroup = document.querySelector("#crash-reports-waiting-group");
+const crashReportsWaiting = document.querySelector("#crash-reports-waiting");
+const crashReportsStatus = document.querySelector("#crash-reports-status");
+
+function loadSettings(settings) {
+ const variable = settings.configVariableDefinitions?.find(
+ candidate => candidate.name === "ui.toolbar.show_feedback_button"
+ );
+ if (variable) {
+ showFeedbackButton.checked = variable.value;
+ showFeedbackButtonGroup.classList.remove("hidden");
+ }
+
+ if (Object.hasOwn(settings, "crashReportSending")) {
+ crashModes.forEach(mode => {
+ mode.checked = mode.value === settings.crashReportSending;
+ });
+ }
+}
+
+showFeedbackButton.addEventListener("change", () => {
+ ladybird.sendMessage("setConfigVariable", {
+ name: "ui.toolbar.show_feedback_button",
+ value: showFeedbackButton.checked,
+ });
+});
+
+crashModes.forEach(mode => {
+ mode.addEventListener("change", () => ladybird.sendMessage("setCrashReportSending", mode.value));
+});
+
+document.querySelector("#review-crash-reports").addEventListener("click", () => {
+ location.href = "about:crashes";
+});
+
+document.querySelector("#open-crash-reports").addEventListener("click", () => {
+ crashReportsStatus.hidden = true;
+ ladybird.sendMessage("showCrashReports");
+});
+
+document.addEventListener("WebUILoaded", () => {
+ ladybird.sendMessage("loadCrashReportsWaiting");
+});
+
+document.addEventListener("WebUIMessage", event => {
+ const { name, data } = event.detail;
+ if (name === "loadSettings") {
+ loadSettings(data);
+ } else if (name === "crashReportsStatus") {
+ crashReportsStatus.textContent = data;
+ crashReportsStatus.hidden = !data;
+ } else if (name === "crashReportsWaiting") {
+ crashReportsWaiting.textContent = `${data} ${data === 1 ? "report" : "reports"} waiting`;
+ crashReportsWaitingGroup.classList.toggle("hidden", data === 0);
+ }
+});
diff --git a/Libraries/LibWebView/Application.cpp b/Libraries/LibWebView/Application.cpp
index 1401762ecc0..2d666ba3efe 100644
--- a/Libraries/LibWebView/Application.cpp
+++ b/Libraries/LibWebView/Application.cpp
@@ -678,6 +678,10 @@ ErrorOr<void> Application::initialize(Main::Arguments const& arguments)
auto platform_languages = m_web_content_options.is_test_mode == IsTestMode::Yes ? Vector<String> {} : platform_preferred_languages();
m_settings = make<Settings>(Settings::create(LexicalPath::join(profile().paths().config, "Settings.json"sv).string(), move(platform_languages)));
+ // A browser that crashed left a report that was recovered before the settings were read.
+ if (m_settings->crash_report_sending() == CrashReportSending::NeverSend)
+ CrashReportOutbox::the().discard_all();
+
m_bookmark_store = make<BookmarkStore>(BookmarkStore::create(LexicalPath::join(profile().paths().config, "Bookmarks.json"sv).string()));
if (m_web_content_options.is_test_mode == IsTestMode::Yes) {
diff --git a/Libraries/LibWebView/CrashReportOutbox.cpp b/Libraries/LibWebView/CrashReportOutbox.cpp
index 61f20e80ad5..900b862126b 100644
--- a/Libraries/LibWebView/CrashReportOutbox.cpp
+++ b/Libraries/LibWebView/CrashReportOutbox.cpp
@@ -98,6 +98,17 @@ void CrashReportOutbox::remove(ReadonlySpan<ByteString> names)
reports_changed();
}
+void CrashReportOutbox::discard_all()
+{
+ m_queue.clear();
+ m_could_not_send.clear();
+ m_review.cancel_sending();
+ m_report_being_sent.clear();
+ if (auto result = m_store.remove_all_reports(); result.is_error())
+ warnln("Could not delete crash reports: {}", result.error());
+ reports_changed();
+}
+
bool CrashReportOutbox::is_sending(ByteString const& name) const
{
return m_report_being_sent == name
diff --git a/Libraries/LibWebView/CrashReportOutbox.h b/Libraries/LibWebView/CrashReportOutbox.h
index cbdcb1ac6c2..e4a9566beec 100644
--- a/Libraries/LibWebView/CrashReportOutbox.h
+++ b/Libraries/LibWebView/CrashReportOutbox.h
@@ -37,6 +37,9 @@ public:
// A report on its way is no longer the user's to delete.
void remove(ReadonlySpan<ByteString> names);
+ // Forgets every report, seen or not, and stops sending them.
+ void discard_all();
+
bool is_sending(ByteString const& name) const;
bool could_not_send(ByteString const& name) const { return m_could_not_send.contains(name); }
diff --git a/Libraries/LibWebView/CrashReportStore.cpp b/Libraries/LibWebView/CrashReportStore.cpp
index 49f8d8494e9..fc4045c0d51 100644
--- a/Libraries/LibWebView/CrashReportStore.cpp
+++ b/Libraries/LibWebView/CrashReportStore.cpp
@@ -266,7 +266,8 @@ ErrorOr<Vector<ByteString>> CrashReportStore::pending_report_names(UnixDateTime
return names;
}
-static void remove_reports_older_than(Core::Directory const& directory, UnixDateTime earliest_time)
+// Without an earliest time, every report goes.
+static void remove_reports_older_than(Core::Directory const& directory, Optional<UnixDateTime> earliest_time)
{
Core::DirIterator iterator(directory.path().string(), Core::DirIterator::SkipDots);
while (iterator.has_next()) {
@@ -276,7 +277,7 @@ static void remove_reports_older_than(Core::Directory const& directory, UnixDate
struct stat status {};
if (!is_owned_regular_file_at(directory, name, status))
continue;
- if (UnixDateTime::from_unix_timespec(modified_time(status)) < earliest_time)
+ if (!earliest_time.has_value() || UnixDateTime::from_unix_timespec(modified_time(status)) < *earliest_time)
(void)unlinkat(directory.fd(), name.characters(), 0);
}
}
@@ -308,6 +309,15 @@ ErrorOr<void> CrashReportStore::mark_seen(ByteString const& name) const
return {};
}
+ErrorOr<void> CrashReportStore::remove_all_reports() const
+{
+ auto directory = TRY(open_report_directory(m_directory));
+ remove_reports_older_than(directory, {});
+ if (auto seen_directory = TRY(open_seen_directory_if_exists(directory)); seen_directory.has_value())
+ remove_reports_older_than(*seen_directory, {});
+ return {};
+}
+
ErrorOr<void> CrashReportStore::remove_report(ByteString const& name) const
{
if (!is_saved_report_name(name))
@@ -484,6 +494,7 @@ ErrorOr<Vector<ByteString>> CrashReportStore::pending_report_names(UnixDateTime)
bool CrashReportStore::has_pending_reports(UnixDateTime) const { return false; }
ErrorOr<void> CrashReportStore::mark_seen(ByteString const&) const { return {}; }
ErrorOr<void> CrashReportStore::remove_report(ByteString const&) const { return {}; }
+ErrorOr<void> CrashReportStore::remove_all_reports() const { return {}; }
ErrorOr<ByteString> CrashReportStore::store_report(ProcessType, StringView, UnixDateTime) const
{
diff --git a/Libraries/LibWebView/CrashReportStore.h b/Libraries/LibWebView/CrashReportStore.h
index 48e10b523ba..23c880a7020 100644
--- a/Libraries/LibWebView/CrashReportStore.h
+++ b/Libraries/LibWebView/CrashReportStore.h
@@ -45,6 +45,7 @@ public:
// Reports that are still unsent 30 days after their crash are deleted, whether they were seen or not.
ErrorOr<void> remove_expired_reports(UnixDateTime now = UnixDateTime::now()) const;
+ ErrorOr<void> remove_all_reports() const;
ErrorOr<ByteString> store_report(ProcessType, StringView text, UnixDateTime crashed_at) const;
diff --git a/Libraries/LibWebView/Process.cpp b/Libraries/LibWebView/Process.cpp
index 53389fb08b3..3d13902e326 100644
--- a/Libraries/LibWebView/Process.cpp
+++ b/Libraries/LibWebView/Process.cpp
@@ -15,6 +15,7 @@
#include <LibCore/StatsLog.h>
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
+#include <LibWebView/Application.h>
#include <LibWebView/Process.h>
#include <LibWebView/ProcessManager.h>
@@ -22,7 +23,6 @@
#if defined(AK_OS_MACOS)
# include <LibIPC/TransportBootstrapMach.h>
-# include <LibWebView/Application.h>
# include <LibWebView/ProcessReaper.h>
# include <LibWebView/Utilities.h>
#endif
@@ -30,7 +30,6 @@
#if defined(AK_OS_WINDOWS)
# include <AK/Windows.h>
# include <LibIPC/HandleBrokerServer.h>
-# include <LibWebView/Application.h>
#endif
namespace WebView {
@@ -61,7 +60,8 @@ void Process::did_register(Badge<ProcessManager>, u64 child_id)
void Process::save_crash_report(Optional<int> exit_status)
{
- if (m_crash_report && exit_status.has_value()) {
+ auto keeps_reports = Application::settings().crash_report_sending() != CrashReportSending::NeverSend;
+ if (m_crash_report && exit_status.has_value() && keeps_reports) {
if (auto result = m_crash_report->save(*exit_status); result.is_error())
warnln("Could not save {} crash report: {}", process_name_from_type(m_type), result.error());
else
diff --git a/Libraries/LibWebView/Settings.cpp b/Libraries/LibWebView/Settings.cpp
index 01e745a3efc..2383e143e69 100644
--- a/Libraries/LibWebView/Settings.cpp
+++ b/Libraries/LibWebView/Settings.cpp
@@ -83,6 +83,7 @@ static constexpr auto DISK_CACHE_KEY = "diskCache"sv;
static constexpr auto DISK_CACHE_MAXIMUM_SIZE_KEY = "maxSize"sv;
static constexpr auto GLOBAL_PRIVACY_CONTROL_KEY = "globalPrivacyControl"sv;
+static constexpr auto CRASH_REPORT_SENDING_KEY = "crashReportSending"sv;
static constexpr auto BACKGROUND_NETWORKING_KEY = "backgroundNetworking"sv;
static constexpr auto BACKGROUND_NETWORKING_ENABLED_KEY = "enabled"sv;
@@ -213,6 +214,24 @@ Optional<ConfigVariableID> config_variable_id_from_name(StringView name)
return {};
}
+CrashReportSending crash_report_sending_from_string(StringView string)
+{
+ if (string == "never"sv)
+ return CrashReportSending::NeverSend;
+ return CrashReportSending::AskMe;
+}
+
+StringView crash_report_sending_to_string(CrashReportSending crash_report_sending)
+{
+ switch (crash_report_sending) {
+ case CrashReportSending::AskMe:
+ return "ask"sv;
+ case CrashReportSending::NeverSend:
+ return "never"sv;
+ }
+ VERIFY_NOT_REACHED();
+}
+
static constexpr StringView show_bookmarks_bar_to_string(ShowBookmarksBar show_bookmarks_bar)
{
switch (show_bookmarks_bar) {
@@ -446,6 +465,9 @@ Settings Settings::create(ByteString settings_path, Vector<String> platform_lang
if (auto global_privacy_control = settings_json.value().get_bool(GLOBAL_PRIVACY_CONTROL_KEY); global_privacy_control.has_value())
settings.m_global_privacy_control = *global_privacy_control ? GlobalPrivacyControl::Yes : GlobalPrivacyControl::No;
+ if (auto crash_report_sending = settings_json.value().get_string(CRASH_REPORT_SENDING_KEY); crash_report_sending.has_value())
+ settings.m_crash_report_sending = crash_report_sending_from_string(*crash_report_sending);
+
if (auto background_networking = settings_json.value().get_object(BACKGROUND_NETWORKING_KEY); background_networking.has_value()) {
if (auto enabled = background_networking->get_bool(BACKGROUND_NETWORKING_ENABLED_KEY); enabled.has_value())
settings.m_background_networking_enabled = *enabled;
@@ -672,6 +694,7 @@ JsonValue Settings::serialize_json() const
settings.set(BROWSING_DATA_KEY, move(browsing_data));
settings.set(GLOBAL_PRIVACY_CONTROL_KEY, m_global_privacy_control == GlobalPrivacyControl::Yes);
+ settings.set(CRASH_REPORT_SENDING_KEY, crash_report_sending_to_string(m_crash_report_sending));
JsonObject background_network_features;
background_network_features.set(CONTENT_BLOCKER_SUBSCRIPTION_UPDATES_KEY, m_filter_list_updates_enabled);
@@ -1214,6 +1237,15 @@ void Settings::set_global_privacy_control(GlobalPrivacyControl global_privacy_co
observer.global_privacy_control_changed();
}
+void Settings::set_crash_report_sending(CrashReportSending crash_report_sending)
+{
+ m_crash_report_sending = crash_report_sending;
+ persist_settings();
+
+ for (auto& observer : m_observers)
+ observer.crash_report_sending_changed();
+}
+
DNSSettings Settings::parse_dns_settings(JsonValue const& dns_settings)
{
if (!dns_settings.is_object())
diff --git a/Libraries/LibWebView/Settings.h b/Libraries/LibWebView/Settings.h
index 1a1a2ec3555..2e4bf4772c2 100644
--- a/Libraries/LibWebView/Settings.h
+++ b/Libraries/LibWebView/Settings.h
@@ -109,6 +109,14 @@ enum class GlobalPrivacyControl {
Yes,
};
+enum class CrashReportSending {
+ AskMe,
+ NeverSend,
+};
+
+WEBVIEW_API CrashReportSending crash_report_sending_from_string(StringView);
+WEBVIEW_API StringView crash_report_sending_to_string(CrashReportSending);
+
struct ContentBlockerList {
String identifier;
String name;
@@ -164,6 +172,7 @@ public:
virtual void autoplay_settings_changed() { }
virtual void browsing_data_settings_changed() { }
virtual void global_privacy_control_changed() { }
+ virtual void crash_report_sending_changed() { }
virtual void dns_settings_changed() { }
virtual void config_variable_changed(ConfigVariableID) { }
virtual void geolocation_settings_changed() { }
@@ -252,6 +261,9 @@ public:
GlobalPrivacyControl global_privacy_control() const { return m_global_privacy_control; }
void set_global_privacy_control(GlobalPrivacyControl);
+ CrashReportSending crash_report_sending() const { return m_crash_report_sending; }
+ void set_crash_report_sending(CrashReportSending);
+
bool background_networking_enabled() const { return m_background_networking_enabled; }
void set_background_networking_enabled(bool);
bool filter_list_updates_enabled() const { return m_filter_list_updates_enabled; }
@@ -323,6 +335,7 @@ private:
BrowsingDataSettings m_browsing_data_settings;
GlobalPrivacyControl m_global_privacy_control { GlobalPrivacyControl::No };
+ CrashReportSending m_crash_report_sending { CrashReportSending::AskMe };
bool m_background_networking_enabled { true };
bool m_filter_list_updates_enabled { false };
diff --git a/Libraries/LibWebView/WebUI/SettingsUI.cpp b/Libraries/LibWebView/WebUI/SettingsUI.cpp
index b4f85e5880e..49dd5eb9b55 100644
--- a/Libraries/LibWebView/WebUI/SettingsUI.cpp
+++ b/Libraries/LibWebView/WebUI/SettingsUI.cpp
@@ -120,6 +120,9 @@ void SettingsUI::register_interfaces()
return;
}
+ register_interface("loadCrashReportsWaiting"sv, [this](auto const&) {
+ crash_reports_changed();
+ });
register_interface("showCrashReports"sv, [this](auto const&) {
if (!CrashReport::is_supported()) {
async_send_message("crashReportsStatus"sv, "Crash reporting is not available on this platform yet."_string);
@@ -195,6 +198,9 @@ void SettingsUI::register_interfaces()
register_interface("setGlobalPrivacyControl"sv, [this](auto const& data) {
set_global_privacy_control(data);
});
+ register_interface("setCrashReportSending"sv, [this](auto const& data) {
+ set_crash_report_sending(data);
+ });
register_interface("setServicesNetworkAccessEnabled"sv, [this](auto const& data) {
set_services_network_access_enabled(data);
@@ -719,6 +725,24 @@ void SettingsUI::set_global_privacy_control(JsonValue const& global_privacy_cont
Application::settings().set_global_privacy_control(global_privacy_control.as_bool() ? GlobalPrivacyControl::Yes : GlobalPrivacyControl::No);
}
+void SettingsUI::crash_reports_changed()
+{
+ if (has_client())
+ async_send_message("crashReportsWaiting"sv, CrashReportOutbox::the().waiting_report_count());
+}
+
+void SettingsUI::set_crash_report_sending(JsonValue const& crash_report_sending)
+{
+ if (!crash_report_sending.is_string())
+ return;
+
+ auto sending = crash_report_sending_from_string(crash_report_sending.as_string());
+ Application::settings().set_crash_report_sending(sending);
+
+ if (sending == CrashReportSending::NeverSend)
+ CrashReportOutbox::the().discard_all();
+}
+
void SettingsUI::set_services_network_access_enabled(JsonValue const& enabled)
{
if (!enabled.is_bool())
diff --git a/Libraries/LibWebView/WebUI/SettingsUI.h b/Libraries/LibWebView/WebUI/SettingsUI.h
index 6752d3560e8..b84cdc99465 100644
--- a/Libraries/LibWebView/WebUI/SettingsUI.h
+++ b/Libraries/LibWebView/WebUI/SettingsUI.h
@@ -7,6 +7,7 @@
#pragma once
#include <AK/JsonObject.h>
+#include <LibWebView/CrashReportOutbox.h>
#include <LibWebView/Forward.h>
#include <LibWebView/PermissionManager.h>
#include <LibWebView/Settings.h>
@@ -33,7 +34,8 @@ private:
class WEBVIEW_API SettingsUI final
: public WebUI
- , public SettingsObserver {
+ , public SettingsObserver
+ , public CrashReportOutboxObserver {
WEB_UI(SettingsUI);
friend class SettingsUISitePermissionsObserver;
@@ -51,6 +53,8 @@ private:
virtual void autoplay_settings_changed() override { broadcast_settings_change(); }
virtual void browsing_data_settings_changed() override { broadcast_settings_change(); }
virtual void global_privacy_control_changed() override { broadcast_settings_change(); }
+ virtual void crash_report_sending_changed() override { broadcast_settings_change(); }
+ virtual void crash_reports_changed() override;
virtual void dns_settings_changed() override { broadcast_settings_change(); }
virtual void config_variable_changed(ConfigVariableID) override { broadcast_settings_change(); }
virtual void geolocation_settings_changed() override { broadcast_settings_change(); }
@@ -95,6 +99,7 @@ private:
void set_browsing_data_settings(JsonValue const&);
void clear_browsing_data(JsonValue const&);
void set_global_privacy_control(JsonValue const&);
+ void set_crash_report_sending(JsonValue const&);
void set_services_network_access_enabled(JsonValue const&);
void set_filter_list_updates_enabled(JsonValue const&);
diff --git a/UI/cmake/ResourceFiles.cmake b/UI/cmake/ResourceFiles.cmake
index b9871debae7..bbe21aa17f5 100644
--- a/UI/cmake/ResourceFiles.cmake
+++ b/UI/cmake/ResourceFiles.cmake
@@ -55,6 +55,7 @@ set(ABOUT_SETTINGS_RESOURCES
browsing-behavior.js
content.js
dialog-deep-link.js
+ feedback.js
geolocation.js
languages.js
network.js