mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 05:27:45 +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
|
@ -313,6 +313,9 @@ public:
|
|||
|
||||
bool has_focus() const;
|
||||
|
||||
void set_parser(Badge<HTML::HTMLParser>, HTML::HTMLParser&);
|
||||
void detach_parser(Badge<HTML::HTMLParser>);
|
||||
|
||||
private:
|
||||
explicit Document(const AK::URL&);
|
||||
|
||||
|
@ -358,7 +361,7 @@ private:
|
|||
RefPtr<Core::Timer> m_style_update_timer;
|
||||
RefPtr<Core::Timer> m_layout_update_timer;
|
||||
|
||||
OwnPtr<HTML::HTMLParser> m_parser;
|
||||
RefPtr<HTML::HTMLParser> m_parser;
|
||||
bool m_active_parser_was_aborted { false };
|
||||
|
||||
String m_source;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue