mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-01 12:57:31 +09:00
Bug 1315885 - Part 3: Transfer the ownership of ReactionQueue's entry due to re-enter CustomElementReactionsStack::InvokeReactions.
Tag UXP Issue #1344
This commit is contained in:
parent
b94fadac97
commit
931b14f847
1 changed files with 8 additions and 3 deletions
|
|
@ -974,6 +974,7 @@ CustomElementReactionsStack::InvokeBackupQueue()
|
||||||
void
|
void
|
||||||
CustomElementReactionsStack::InvokeReactions(ElementQueue& aElementQueue)
|
CustomElementReactionsStack::InvokeReactions(ElementQueue& aElementQueue)
|
||||||
{
|
{
|
||||||
|
// Note: It's possible to re-enter this method.
|
||||||
for (uint32_t i = 0; i < aElementQueue.Length(); ++i) {
|
for (uint32_t i = 0; i < aElementQueue.Length(); ++i) {
|
||||||
nsCOMPtr<Element> element = do_QueryReferent(aElementQueue[i]);
|
nsCOMPtr<Element> element = do_QueryReferent(aElementQueue[i]);
|
||||||
|
|
||||||
|
|
@ -984,10 +985,14 @@ CustomElementReactionsStack::InvokeReactions(ElementQueue& aElementQueue)
|
||||||
RefPtr<CustomElementData> elementData = element->GetCustomElementData();
|
RefPtr<CustomElementData> elementData = element->GetCustomElementData();
|
||||||
MOZ_ASSERT(elementData, "CustomElementData should exist");
|
MOZ_ASSERT(elementData, "CustomElementData should exist");
|
||||||
|
|
||||||
nsTArray<nsAutoPtr<CustomElementReaction>>& reactions =
|
auto& reactions = elementData->mReactionQueue;
|
||||||
elementData->mReactionQueue;
|
|
||||||
for (uint32_t j = 0; j < reactions.Length(); ++j) {
|
for (uint32_t j = 0; j < reactions.Length(); ++j) {
|
||||||
reactions.ElementAt(j)->Invoke(element);
|
// Transfer the ownership of the entry due to reentrant invocation of
|
||||||
|
// this funciton. The entry will be removed when bug 1379573 is landed.
|
||||||
|
auto reaction(Move(reactions.ElementAt(j)));
|
||||||
|
if (reaction) {
|
||||||
|
reaction->Invoke(element);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
reactions.Clear();
|
reactions.Clear();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue