2026-04-25 22:21:39 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2026, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/String.h>
|
|
|
|
|
#include <LibGC/Ptr.h>
|
|
|
|
|
#include <LibJS/Heap/Cell.h>
|
|
|
|
|
#include <LibURL/URL.h>
|
|
|
|
|
#include <LibWeb/Forward.h>
|
2026-05-17 16:19:58 -03:00
|
|
|
|
|
|
|
|
struct RustFfiPreloadScannerEntry;
|
2026-04-25 22:21:39 -03:00
|
|
|
|
|
|
|
|
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<SpeculativeHTMLParser> create(JS::Realm&, GC::Ref<DOM::Document>, String pending_input, URL::URL base_url);
|
|
|
|
|
|
|
|
|
|
virtual ~SpeculativeHTMLParser() override;
|
|
|
|
|
|
|
|
|
|
void run();
|
|
|
|
|
void stop();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
SpeculativeHTMLParser(GC::Ref<DOM::Document>, String pending_input, URL::URL base_url);
|
|
|
|
|
virtual void visit_edges(JS::Cell::Visitor&) override;
|
|
|
|
|
|
2026-05-17 16:19:58 -03:00
|
|
|
void process_preload_scanner_entry(RustFfiPreloadScannerEntry const&);
|
2026-04-25 22:21:39 -03:00
|
|
|
|
|
|
|
|
GC::Ref<DOM::Document> m_document;
|
|
|
|
|
String m_input;
|
|
|
|
|
URL::URL m_base_url;
|
2026-05-17 16:19:58 -03:00
|
|
|
bool m_stopped { false };
|
2026-04-25 22:21:39 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|