mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 08:48:39 +09:00
Bug 1334043 - Part 2: Make nsContentUtils::EnqueueLifecycleCallback static.
We make nsContentUtils::EnqueueLifecycleCallback static so that it can be called without a window object. To achive this, we also make CustomElementReaction not taking a CustomElementRegistry in the constructor, as it can call Upgrade statically. Tag UXP Issue #1344
This commit is contained in:
parent
207d5a2e3e
commit
befa1027e3
5 changed files with 41 additions and 75 deletions
|
|
@ -47,7 +47,7 @@ CustomElementCallback::Call()
|
|||
ni->LocalName(), ni->NamespaceID(),
|
||||
extType.IsEmpty() ? nullptr : &extType);
|
||||
nsContentUtils::EnqueueLifecycleCallback(
|
||||
document, nsIDocument::eConnected, mThisObject, nullptr, definition);
|
||||
nsIDocument::eConnected, mThisObject, nullptr, definition);
|
||||
}
|
||||
|
||||
static_cast<LifecycleCreatedCallback *>(mCallback.get())->Call(mThisObject, rv);
|
||||
|
|
@ -329,7 +329,7 @@ CustomElementRegistry::SetupCustomElement(Element* aElement,
|
|||
// SyncInvokeReactions(nsIDocument::eCreated, aElement, definition);
|
||||
}
|
||||
|
||||
UniquePtr<CustomElementCallback>
|
||||
/* static */ UniquePtr<CustomElementCallback>
|
||||
CustomElementRegistry::CreateCustomElementCallback(
|
||||
nsIDocument::ElementCallbackType aType, Element* aCustomElement,
|
||||
LifecycleCallbackArgs* aArgs, CustomElementDefinition* aDefinition)
|
||||
|
|
@ -391,7 +391,7 @@ CustomElementRegistry::CreateCustomElementCallback(
|
|||
return Move(callback);
|
||||
}
|
||||
|
||||
void
|
||||
/* static */ void
|
||||
CustomElementRegistry::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
|
||||
Element* aCustomElement,
|
||||
LifecycleCallbackArgs* aArgs,
|
||||
|
|
@ -412,7 +412,7 @@ CustomElementRegistry::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType
|
|||
return;
|
||||
}
|
||||
|
||||
DocGroup* docGroup = mWindow->GetDocGroup();
|
||||
DocGroup* docGroup = aCustomElement->OwnerDoc()->GetDocGroup();
|
||||
if (!docGroup) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -427,7 +427,7 @@ CustomElementRegistry::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType
|
|||
|
||||
CustomElementReactionsStack* reactionsStack =
|
||||
docGroup->CustomElementReactionsStack();
|
||||
reactionsStack->EnqueueCallbackReaction(this, aCustomElement, definition,
|
||||
reactionsStack->EnqueueCallbackReaction(aCustomElement, definition,
|
||||
Move(callback));
|
||||
}
|
||||
|
||||
|
|
@ -467,7 +467,7 @@ CustomElementRegistry::UpgradeCandidates(nsIAtom* aKey,
|
|||
continue;
|
||||
}
|
||||
|
||||
reactionsStack->EnqueueUpgradeReaction(this, elem, aDefinition);
|
||||
reactionsStack->EnqueueUpgradeReaction(elem, aDefinition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -924,8 +924,7 @@ CustomElementRegistry::Upgrade(Element* aElement,
|
|||
(attrValue.IsEmpty() ? NullString() : attrValue),
|
||||
(namespaceURI.IsEmpty() ? NullString() : namespaceURI)
|
||||
};
|
||||
nsContentUtils::EnqueueLifecycleCallback(aElement->OwnerDoc(),
|
||||
nsIDocument::eAttributeChanged,
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eAttributeChanged,
|
||||
aElement,
|
||||
&args, aDefinition);
|
||||
}
|
||||
|
|
@ -934,8 +933,7 @@ CustomElementRegistry::Upgrade(Element* aElement,
|
|||
|
||||
// Step 4.
|
||||
if (aElement->IsInComposedDoc()) {
|
||||
nsContentUtils::EnqueueLifecycleCallback(aElement->OwnerDoc(),
|
||||
nsIDocument::eConnected, aElement,
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eConnected, aElement,
|
||||
nullptr, aDefinition);
|
||||
}
|
||||
|
||||
|
|
@ -959,8 +957,7 @@ CustomElementRegistry::Upgrade(Element* aElement,
|
|||
aElement->SetCustomElementDefinition(aDefinition);
|
||||
|
||||
// This is for old spec.
|
||||
nsContentUtils::EnqueueLifecycleCallback(aElement->OwnerDoc(),
|
||||
nsIDocument::eCreated,
|
||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eCreated,
|
||||
aElement, nullptr, aDefinition);
|
||||
}
|
||||
|
||||
|
|
@ -1004,20 +1001,18 @@ CustomElementReactionsStack::PopAndInvokeElementQueue()
|
|||
}
|
||||
|
||||
void
|
||||
CustomElementReactionsStack::EnqueueUpgradeReaction(CustomElementRegistry* aRegistry,
|
||||
Element* aElement,
|
||||
CustomElementReactionsStack::EnqueueUpgradeReaction(Element* aElement,
|
||||
CustomElementDefinition* aDefinition)
|
||||
{
|
||||
Enqueue(aElement, new CustomElementUpgradeReaction(aRegistry, aDefinition));
|
||||
Enqueue(aElement, new CustomElementUpgradeReaction(aDefinition));
|
||||
}
|
||||
|
||||
void
|
||||
CustomElementReactionsStack::EnqueueCallbackReaction(CustomElementRegistry* aRegistry,
|
||||
Element* aElement,
|
||||
CustomElementReactionsStack::EnqueueCallbackReaction(Element* aElement,
|
||||
CustomElementDefinition* aDefinition,
|
||||
UniquePtr<CustomElementCallback> aCustomElementCallback)
|
||||
{
|
||||
Enqueue(aElement, new CustomElementCallbackReaction(aRegistry, aDefinition,
|
||||
Enqueue(aElement, new CustomElementCallbackReaction(aDefinition,
|
||||
Move(aCustomElementCallback)));
|
||||
}
|
||||
|
||||
|
|
@ -1176,7 +1171,7 @@ CustomElementDefinition::CustomElementDefinition(nsIAtom* aType,
|
|||
/* virtual */ void
|
||||
CustomElementUpgradeReaction::Invoke(Element* aElement, ErrorResult& aRv)
|
||||
{
|
||||
mRegistry->Upgrade(aElement, mDefinition, aRv);
|
||||
CustomElementRegistry::Upgrade(aElement, mDefinition, aRv);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue