mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:37:36 +00:00
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%! :^)
This commit is contained in:
parent
bb1f26c149
commit
8b2499b112
7 changed files with 67 additions and 38 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue