diff --git a/Meta/Lagom/Fuzzers/FuzzCSSParser.cpp b/Meta/Lagom/Fuzzers/FuzzCSSParser.cpp index 68c81bb512..e31f44a5fe 100644 --- a/Meta/Lagom/Fuzzers/FuzzCSSParser.cpp +++ b/Meta/Lagom/Fuzzers/FuzzCSSParser.cpp @@ -4,18 +4,21 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include -#include -#include +#include + +namespace { +struct Globals { + Globals(); +} globals; +Globals::Globals() { Web::Platform::EventLoopPlugin::install(*new Web::Platform::EventLoopPluginSerenity); } +} extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) { - Core::EventLoop loop; - auto vm = JS::VM::create(); - auto realm = JS::Realm::create(*vm); - auto window = Web::HTML::Window::create(*realm); - auto document = Web::DOM::Document::create(*window); - (void)Web::parse_css_stylesheet(Web::CSS::Parser::ParsingContext(document), { data, size }); + // FIXME: There's got to be a better way to do this "correctly" + auto& vm = Web::Bindings::main_thread_vm(); + (void)Web::parse_css_stylesheet(Web::CSS::Parser::ParsingContext(*vm.current_realm()), { data, size }); return 0; }