1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

Ladybird+LibJS: Add CLI option to run browser with LibJS bytecode VM

This required quite a bit of plumbing, but now you can run

    ladybird --use-bytecode
This commit is contained in:
Andreas Kling 2023-06-17 13:16:35 +02:00
parent 7ec7015750
commit 9c568282dc
20 changed files with 91 additions and 38 deletions

View file

@ -70,6 +70,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
StringView webdriver_content_ipc_path;
bool enable_callgrind_profiling = false;
bool enable_sql_database = false;
bool use_javascript_bytecode = false;
Core::ArgsParser args_parser;
args_parser.set_general_help("The Ladybird web browser :^)");
@ -77,6 +78,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
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(enable_sql_database, "Enable SQL database", "enable-sql-database", 0);
args_parser.add_option(use_javascript_bytecode, "Enable JavaScript bytecode VM", "use-bytecode", 0);
args_parser.parse(arguments);
auto get_formatted_url = [&](StringView const& raw_url) -> ErrorOr<URL> {
@ -99,7 +101,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
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);
BrowserWindow window(cookie_jar, webdriver_content_ipc_path, enable_callgrind_profiling ? WebView::EnableCallgrindProfiling::Yes : WebView::EnableCallgrindProfiling::No, use_javascript_bytecode ? WebView::UseJavaScriptBytecode::Yes : WebView::UseJavaScriptBytecode::No);
window.setWindowTitle("Ladybird");
window.resize(800, 600);
window.show();