Bug 1410790 - Add more assertion in CustomElementData::SetCustomElementDefinition and GetCustomElementDefinition;

This is a follow-up patch for bug 1392970. Since we only set CustomElementDefinition on a custom element which is custom, we could add more assertion to ensure that.

Tag UXP Issue #1344
This commit is contained in:
Gaming4JC 2020-01-18 20:35:11 -05:00 committed by Roy Tam
commit 76b1eaa538
3 changed files with 52 additions and 31 deletions

View file

@ -583,19 +583,7 @@ FragmentOrElement::nsDOMSlots::Traverse(nsCycleCollectionTraversalCallback &cb)
cb.NoteXPCOMChild(mExtendedSlots->mXBLInsertionParent.get());
if (mExtendedSlots->mCustomElementData) {
for (uint32_t i = 0;
i < mExtendedSlots->mCustomElementData->mReactionQueue.Length(); i++) {
if (mExtendedSlots->mCustomElementData->mReactionQueue[i]) {
mExtendedSlots->mCustomElementData->mReactionQueue[i]->Traverse(cb);
}
}
if (mExtendedSlots->mCustomElementData->mCustomElementDefinition) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb,
"mExtendedSlots->mCustomElementData->mCustomElementDefinition");
cb.NoteNativeChild(mExtendedSlots->mCustomElementData->mCustomElementDefinition,
NS_CYCLE_COLLECTION_PARTICIPANT(CustomElementDefinition));
}
mExtendedSlots->mCustomElementData->Traverse(cb);
}
for (auto iter = mExtendedSlots->mRegisteredIntersectionObservers.Iter();
@ -633,9 +621,7 @@ FragmentOrElement::nsDOMSlots::Unlink()
MOZ_ASSERT(!(mExtendedSlots->mXBLBinding));
mExtendedSlots->mXBLInsertionParent = nullptr;
if (mExtendedSlots->mCustomElementData) {
if (mExtendedSlots->mCustomElementData->mCustomElementDefinition) {
mExtendedSlots->mCustomElementData->mCustomElementDefinition = nullptr;
}
mExtendedSlots->mCustomElementData->Unlink();
mExtendedSlots->mCustomElementData = nullptr;
}
mExtendedSlots->mRegisteredIntersectionObservers.Clear();