Bug 1352290 - Add assertion to CustomElementReactionsStack::Enqueue to ensure upgrade reactions aren't scheduled to BackupQueue;

Tag UXP Issue #1344
This commit is contained in:
Gaming4JC 2020-01-05 18:48:51 -05:00 committed by Roy Tam
commit c0e1a6e397
2 changed files with 15 additions and 0 deletions

View file

@ -1045,6 +1045,8 @@ CustomElementReactionsStack::Enqueue(Element* aElement,
// If the custom element reactions stack is empty, then:
// Add element to the backup element queue.
MOZ_ASSERT(!aReaction->IsUpgradeReaction(),
"Upgrade reaction should not be scheduled to backup queue");
mBackupQueue.AppendElement(aElement);
elementData->mReactionQueue.AppendElement(aReaction);

View file

@ -217,6 +217,16 @@ public:
virtual void Traverse(nsCycleCollectionTraversalCallback& aCb) const
{
}
#if DEBUG
bool IsUpgradeReaction()
{
return mIsUpgradeReaction;
}
protected:
bool mIsUpgradeReaction = false;
#endif
};
class CustomElementUpgradeReaction final : public CustomElementReaction
@ -225,6 +235,9 @@ public:
explicit CustomElementUpgradeReaction(CustomElementDefinition* aDefinition)
: mDefinition(aDefinition)
{
#if DEBUG
mIsUpgradeReaction = true;
#endif
}
private: