1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 02:50:44 +00:00

Ladybird: Add a command line flag to disable launching SQLServer

This commit is contained in:
Timothy Flynn 2023-04-20 14:26:06 -04:00 committed by Andreas Kling
parent a01ad58e91
commit 3d0ac399c4

View File

@ -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);