mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 21:58:12 +00:00
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:
parent
4dbecf0b65
commit
22c582a887
4 changed files with 14 additions and 19 deletions
|
@ -240,7 +240,7 @@ void TestRunner::run()
|
|||
Web::ResourceLoader::the().load_sync(
|
||||
page_to_load,
|
||||
[&](auto data, auto&) {
|
||||
Web::HTML::HTMLDocumentParser parser(data, "utf-8", *m_page_view->document());
|
||||
Web::HTML::HTMLDocumentParser parser(*m_page_view->document(), data, "utf-8");
|
||||
parser.run(page_to_load);
|
||||
},
|
||||
[page_to_load](auto error) {
|
||||
|
@ -350,7 +350,8 @@ JSFileResult TestRunner::run_file_test(const String& test_path)
|
|||
page_to_load,
|
||||
[&](auto data, auto&) {
|
||||
// Create a new parser and immediately get its document to replace the old interpreter.
|
||||
Web::HTML::HTMLDocumentParser parser(data, "utf-8");
|
||||
auto document = Web::DOM::Document::create();
|
||||
Web::HTML::HTMLDocumentParser parser(document, data, "utf-8");
|
||||
auto& new_interpreter = parser.document().interpreter();
|
||||
|
||||
// Setup the test environment and call "__BeforeInitialPageLoad__"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue