Truly independent web browser
LibWebView: Reduce knowledge of default settings values
Timothy Flynneefe7a9f190d
diff --git a/Libraries/LibWebView/Settings.cpp b/Libraries/LibWebView/Settings.cppindex 84028e2644a..b2a6948fb7a 100644--- a/Libraries/LibWebView/Settings.cpp+++ b/Libraries/LibWebView/Settings.cpp@@ -79,6 +79,7 @@ static constexpr auto BACKGROUND_NETWORKING_ENABLED_KEY = "enabled"sv;static constexpr auto BACKGROUND_NETWORKING_FEATURES_KEY = "features"sv;static constexpr auto CONTENT_BLOCKERS_KEY = "contentBlockers"sv;+static constexpr auto CONTENT_BLOCKER_SUBSCRIPTION_UPDATES_KEY = "contentBlockerSubscriptionUpdates"sv;static constexpr auto CONTENT_BLOCKER_SHOW_BLOCKED_COUNT_KEY = "showBlockedCount"sv;static constexpr auto CONTENT_BLOCKER_DISABLED_SITES_KEY = "disabledSites"sv;static constexpr auto CONTENT_BLOCKER_BUILT_IN_LISTS_KEY = "builtInLists"sv;@@ -372,13 +373,17 @@ Settings Settings::create(ByteString settings_path)if (auto enabled = background_networking->get_bool(BACKGROUND_NETWORKING_ENABLED_KEY); enabled.has_value())settings.m_background_networking_enabled = *enabled;- if (auto features = background_networking->get_object(BACKGROUND_NETWORKING_FEATURES_KEY); features.has_value())- settings.m_filter_list_updates_enabled = features->get_bool("contentBlockerSubscriptionUpdates"sv).value_or(false);+ if (auto features = background_networking->get_object(BACKGROUND_NETWORKING_FEATURES_KEY); features.has_value()) {+ if (auto filter_list_updates_enabled = features->get_bool(CONTENT_BLOCKER_SUBSCRIPTION_UPDATES_KEY); filter_list_updates_enabled.has_value())+ settings.m_filter_list_updates_enabled = *filter_list_updates_enabled;+ }}if (auto content_blockers = settings_json.value().get_object(CONTENT_BLOCKERS_KEY); content_blockers.has_value()) {- settings.m_content_blocker_enabled = content_blockers->get_bool(CONTENT_BLOCKER_ENABLED_KEY).value_or(false);- settings.m_show_content_blocker_count = content_blockers->get_bool(CONTENT_BLOCKER_SHOW_BLOCKED_COUNT_KEY).value_or(true);+ if (auto content_blocker_enabled = content_blockers->get_bool(CONTENT_BLOCKER_ENABLED_KEY); content_blocker_enabled.has_value())+ settings.m_content_blocker_enabled = *content_blocker_enabled;+ if (auto show_content_blocker_count = content_blockers->get_bool(CONTENT_BLOCKER_SHOW_BLOCKED_COUNT_KEY); show_content_blocker_count.has_value())+ settings.m_show_content_blocker_count = *show_content_blocker_count;if (auto sites = content_blockers->get_array(CONTENT_BLOCKER_DISABLED_SITES_KEY); sites.has_value()) {sites->for_each([&](JsonValue const& entry) {@@ -575,7 +580,7 @@ JsonValue Settings::serialize_json() constsettings.set(NAVIGATOR_COMPATIBILITY_MODE_KEY, navigator_compatibility_mode_to_string(m_navigator_compatibility_mode));JsonObject background_network_features;- background_network_features.set("contentBlockerSubscriptionUpdates"sv, m_filter_list_updates_enabled);+ background_network_features.set(CONTENT_BLOCKER_SUBSCRIPTION_UPDATES_KEY, m_filter_list_updates_enabled);JsonObject background_networking;background_networking.set(BACKGROUND_NETWORKING_ENABLED_KEY, m_background_networking_enabled);