summaryrefslogtreecommitdiff
path: root/Ladybird/main.cpp
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-04-20 14:26:06 -0400
committerAndreas Kling <kling@serenityos.org>2023-04-21 07:56:14 +0200
commit3d0ac399c4378ba12b485a2b6f9136966ae29936 (patch)
tree6d4abb13ebf64d397e188ba2ff310ae625f54f62 /Ladybird/main.cpp
parenta01ad58e91dfdd11e521940ac58b0e2932094ba4 (diff)
downloadserenity-3d0ac399c4378ba12b485a2b6f9136966ae29936.zip
Ladybird: Add a command line flag to disable launching SQLServer
Diffstat (limited to 'Ladybird/main.cpp')
-rw-r--r--Ladybird/main.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/Ladybird/main.cpp b/Ladybird/main.cpp
index 2eb14608a7..968a4aa768 100644
--- a/Ladybird/main.cpp
+++ b/Ladybird/main.cpp
@@ -68,12 +68,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
StringView raw_url;
StringView webdriver_content_ipc_path;
bool enable_callgrind_profiling = false;
+ bool disable_sql_database = false;
Core::ArgsParser args_parser;
args_parser.set_general_help("The Ladybird web browser :^)");
args_parser.add_positional_argument(raw_url, "URL to open", "url", Core::ArgsParser::Required::No);
args_parser.add_option(webdriver_content_ipc_path, "Path to WebDriver IPC for WebContent", "webdriver-content-path", 0, "path");
args_parser.add_option(enable_callgrind_profiling, "Enable Callgrind profiling", "enable-callgrind-profiling", 'P');
+ args_parser.add_option(disable_sql_database, "Disable SQL database", "disable-sql-database", 0);
args_parser.parse(arguments);
auto get_formatted_url = [&](StringView const& raw_url) -> ErrorOr<URL> {
@@ -85,11 +87,15 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return url;
};
- auto sql_server_paths = TRY(get_paths_for_helper_process("SQLServer"sv));
- auto sql_client = TRY(SQL::SQLClient::launch_server_and_create_client(move(sql_server_paths)));
- auto database = TRY(Browser::Database::create(move(sql_client)));
+ RefPtr<Browser::Database> database;
- auto cookie_jar = TRY(Browser::CookieJar::create(*database));
+ if (!disable_sql_database) {
+ auto sql_server_paths = TRY(get_paths_for_helper_process("SQLServer"sv));
+ auto sql_client = TRY(SQL::SQLClient::launch_server_and_create_client(move(sql_server_paths)));
+ database = TRY(Browser::Database::create(move(sql_client)));
+ }
+
+ auto cookie_jar = database ? TRY(Browser::CookieJar::create(*database)) : Browser::CookieJar::create();
s_settings = adopt_own_if_nonnull(new Browser::Settings());
BrowserWindow window(cookie_jar, webdriver_content_ipc_path, enable_callgrind_profiling ? WebView::EnableCallgrindProfiling::Yes : WebView::EnableCallgrindProfiling::No);