diff options
-rw-r--r-- | Meta/Lagom/Fuzzers/FuzzCSSParser.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
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 <LibCore/EventLoop.h> +#include <LibWeb/Bindings/MainThreadVM.h> #include <LibWeb/CSS/Parser/Parser.h> -#include <LibWeb/DOM/Document.h> -#include <LibWeb/HTML/Window.h> +#include <LibWeb/Platform/EventLoopPluginSerenity.h> + +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; } |