diff options
author | Andreas Kling <kling@serenityos.org> | 2022-02-21 21:54:21 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-21 22:00:28 +0100 |
commit | 8b2499b11211556cc5998aa4e08501cf580e4c93 (patch) | |
tree | 8be7873b82237c872d42276e2db94bbccf4c5d01 /Tests/LibWeb | |
parent | bb1f26c149f74729f8141a8e09c46db8686dbc50 (diff) | |
download | serenity-8b2499b11211556cc5998aa4e08501cf580e4c93.zip |
LibWeb: Make document.write() work while document is parsing
This necessitated making HTMLParser ref-counted, and having it register
itself with Document when created. That makes it possible for scripts to
add new input at the current parser insertion point.
There is now a reference cycle between Document and HTMLParser. This
cycle is explicitly broken by calling Document::detach_parser() at the
end of HTMLParser::run().
This is a huge progression on ACID3, from 31% to 49%! :^)
Diffstat (limited to 'Tests/LibWeb')
-rw-r--r-- | Tests/LibWeb/test-web.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Tests/LibWeb/test-web.cpp b/Tests/LibWeb/test-web.cpp index 14819e41c1..a7d9913d3d 100644 --- a/Tests/LibWeb/test-web.cpp +++ b/Tests/LibWeb/test-web.cpp @@ -150,10 +150,10 @@ JS_DEFINE_NATIVE_FUNCTION(TestWebGlobalObject::wait_for_page_to_load) loader.load_sync( request, [&](auto data, auto&, auto) { - Web::HTML::HTMLParser parser(document, data, "utf-8"); + auto parser = Web::HTML::HTMLParser::create(document, data, "utf-8"); // Now parse the HTML page. - parser.run(next_page_to_load.value()); - g_page_view->set_document(&parser.document()); + parser->run(next_page_to_load.value()); + g_page_view->set_document(&parser->document()); // Note: Unhandled exceptions are just dropped here. // Run the "after" hooks |