/* * Copyright (c) 2026, Aliaksandr Kalenik * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include struct RustFfiPreloadScannerEntry; namespace Web::HTML { // https://html.spec.whatwg.org/multipage/parsing.html#speculative-html-parser class SpeculativeHTMLParser final : public JS::Cell { GC_CELL(SpeculativeHTMLParser, JS::Cell); GC_DECLARE_ALLOCATOR(SpeculativeHTMLParser); public: static GC::Ref create(JS::Realm&, GC::Ref, String pending_input, URL::URL base_url); virtual ~SpeculativeHTMLParser() override; void run(); void stop(); private: SpeculativeHTMLParser(GC::Ref, String pending_input, URL::URL base_url); virtual void visit_edges(JS::Cell::Visitor&) override; void process_preload_scanner_entry(RustFfiPreloadScannerEntry const&); GC::Ref m_document; String m_input; URL::URL m_base_url; bool m_stopped { false }; }; }