1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:37:46 +00:00

LibWeb: Implement all "childList" mutation records for MutationObserver

This commit is contained in:
Luke Wilde 2022-07-11 16:39:14 +01:00 committed by Andreas Kling
parent c9ba5531e0
commit 56cfd5ced8
3 changed files with 135 additions and 22 deletions

View file

@ -132,8 +132,11 @@ void Document::removed_last_ref()
for (auto& node : descendants) {
VERIFY(&node.document() == this);
VERIFY(!node.is_document());
if (node.parent())
node.remove();
if (node.parent()) {
// We need to suppress mutation observers so that they don't try and queue a microtask for this Document which is in the process of dying,
// which will cause an `!m_in_removed_last_ref` assertion failure when it tries to ref this Document.
node.remove(true);
}
}
}