diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index b21e9b7c428..79b1934d69a 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -599,6 +600,7 @@ ErrorOr serenity_main(Main::Arguments arguments) bool gc_on_every_allocation = false; bool disable_syntax_highlight = false; bool disable_debug_printing = false; + bool use_test262_global = false; StringView evaluate_script; Vector script_paths; @@ -616,6 +618,7 @@ ErrorOr serenity_main(Main::Arguments arguments) args_parser.add_option(disable_syntax_highlight, "Disable live syntax highlighting", "no-syntax-highlight", 's'); args_parser.add_option(disable_debug_printing, "Disable debug output", "disable-debug-output", {}); args_parser.add_option(evaluate_script, "Evaluate argument as a script", "evaluate", 'c', "script"); + args_parser.add_option(use_test262_global, "Use test262 global ($262)", "use-test262-global", {}); args_parser.add_positional_argument(script_paths, "Path to script files", "scripts", Core::ArgsParser::Required::No); args_parser.parse(arguments); @@ -863,7 +866,12 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(repl(*interpreter)); s_editor->save_history(s_history_path.to_deprecated_string()); } else { - interpreter = JS::Interpreter::create(*g_vm); + if (use_test262_global) { + interpreter = JS::Interpreter::create(*g_vm); + } else { + interpreter = JS::Interpreter::create(*g_vm); + } + auto& console_object = *interpreter->realm().intrinsics().console_object(); ReplConsoleClient console_client(console_object.console()); console_object.console().set_client(console_client);