mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-25 16:47:29 +09:00
Bug 1406325 - Part 1: Make sure custom element state is custom before sending callback.
Tag UXP Issue #1344
This commit is contained in:
parent
5d26d32825
commit
cce9b3379a
1 changed files with 14 additions and 5 deletions
|
|
@ -1687,7 +1687,8 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||||
if (CustomElementRegistry::IsCustomElementEnabled() && IsInComposedDoc()) {
|
if (CustomElementRegistry::IsCustomElementEnabled() && IsInComposedDoc()) {
|
||||||
// Connected callback must be enqueued whenever a custom element becomes
|
// Connected callback must be enqueued whenever a custom element becomes
|
||||||
// connected.
|
// connected.
|
||||||
if (GetCustomElementData()) {
|
CustomElementData* data = GetCustomElementData();
|
||||||
|
if (data && data->mState == CustomElementData::State::eCustom) {
|
||||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eConnected, this);
|
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eConnected, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1985,10 +1986,12 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||||
|
|
||||||
// Disconnected must be enqueued whenever a connected custom element becomes
|
// Disconnected must be enqueued whenever a connected custom element becomes
|
||||||
// disconnected.
|
// disconnected.
|
||||||
if (CustomElementRegistry::IsCustomElementEnabled() &&
|
if (CustomElementRegistry::IsCustomElementEnabled()) {
|
||||||
GetCustomElementData()) {
|
CustomElementData* data = GetCustomElementData();
|
||||||
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eDisconnected,
|
if (data && data->mState == CustomElementData::State::eCustom) {
|
||||||
this);
|
nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eDisconnected,
|
||||||
|
this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2589,6 +2592,9 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
|
||||||
nsContentUtils::GetElementDefinitionIfObservingAttr(this,
|
nsContentUtils::GetElementDefinitionIfObservingAttr(this,
|
||||||
data->mType,
|
data->mType,
|
||||||
aName)) {
|
aName)) {
|
||||||
|
MOZ_ASSERT(data->mState == CustomElementData::State::eCustom,
|
||||||
|
"AttributeChanged callback should fire only if "
|
||||||
|
"custom element state is custom");
|
||||||
nsCOMPtr<nsIAtom> oldValueAtom = oldValue->GetAsAtom();
|
nsCOMPtr<nsIAtom> oldValueAtom = oldValue->GetAsAtom();
|
||||||
nsCOMPtr<nsIAtom> newValueAtom = valueForAfterSetAttr.GetAsAtom();
|
nsCOMPtr<nsIAtom> newValueAtom = valueForAfterSetAttr.GetAsAtom();
|
||||||
nsAutoString ns;
|
nsAutoString ns;
|
||||||
|
|
@ -2856,6 +2862,9 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||||
nsContentUtils::GetElementDefinitionIfObservingAttr(this,
|
nsContentUtils::GetElementDefinitionIfObservingAttr(this,
|
||||||
data->mType,
|
data->mType,
|
||||||
aName)) {
|
aName)) {
|
||||||
|
MOZ_ASSERT(data->mState == CustomElementData::State::eCustom,
|
||||||
|
"AttributeChanged callback should fire only if "
|
||||||
|
"custom element state is custom");
|
||||||
nsAutoString ns;
|
nsAutoString ns;
|
||||||
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNameSpaceID, ns);
|
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNameSpaceID, ns);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue