LibWeb: Make HTMLDocumentParser take an existing document

We shouldn't really be creating the document objects inside the parser,
since that makes it hard to hook up e.g JavaScript bindings early on.
This commit is contained in:
Andreas Kling 2020-12-13 16:59:22 +01:00
commit 22c582a887
Notes: sideshowbarker 2024-07-19 00:53:37 +09:00
4 changed files with 14 additions and 19 deletions

View file

@ -214,7 +214,8 @@ bool FrameLoader::load(const URL& url, Type type)
void FrameLoader::load_html(const StringView& html, const URL& url)
{
HTML::HTMLDocumentParser parser(html, "utf-8");
auto document = DOM::Document::create(url);
HTML::HTMLDocumentParser parser(document, html, "utf-8");
parser.run(url);
frame().set_document(&parser.document());
}