Bug 1439016: Assert that there's no stale servo data in shadow roots either. r=bholley

Just expanding the assertion to cover shadow trees.

MozReview-Commit-ID: FLE0noGzaIF

--HG--
extra : rebase_source : fa68f04b8095bd48eab598415e1700620ecce092
This commit is contained in:
Emilio Cobos Álvarez 2018-02-19 15:00:37 +01:00
Родитель 006627baa9
Коммит 1e890af15e
1 изменённых файлов: 18 добавлений и 9 удалений

Просмотреть файл

@ -3985,6 +3985,23 @@ nsIDocument::ShouldThrottleFrameRequests()
return false;
}
static inline void
AssertNoStaleServoDataIn(const nsINode& aSubtreeRoot)
{
#ifdef DEBUG
for (const nsINode* node = aSubtreeRoot.GetFirstChild();
node;
node = node->GetNextNode()) {
if (node->IsElement()) {
MOZ_ASSERT(!node->AsElement()->HasServoData());
if (auto* shadow = node->AsElement()->GetShadowRoot()) {
AssertNoStaleServoDataIn(*shadow);
}
}
}
#endif
}
void
nsDocument::DeleteShell()
{
@ -4011,15 +4028,7 @@ nsDocument::DeleteShell()
if (IsStyledByServo()) {
ClearStaleServoData();
#ifdef DEBUG
for (nsINode* node = static_cast<nsINode*>(this)->GetFirstChild();
node;
node = node->GetNextNode(this)) {
if (node->IsElement()) {
MOZ_ASSERT(!node->AsElement()->HasServoData());
}
}
#endif
AssertNoStaleServoDataIn(static_cast<nsINode&>(*this));
}
}