summaryrefslogtreecommitdiff
path: root/dom/base/Element.cpp
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2020-01-05 15:59:26 -0500
committerGaming4JC <g4jc@hyperbola.info>2020-01-26 15:50:29 -0500
commit3d4c4100912132141881f40e90ddbd3aba8b0737 (patch)
tree92a662145f0243654c42c8cf830cebf5df7aa30f /dom/base/Element.cpp
parent186782301c03f4b27e4edae07b0280e92c4e01d1 (diff)
downloaduxp-3d4c4100912132141881f40e90ddbd3aba8b0737.tar.gz
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
Diffstat (limited to 'dom/base/Element.cpp')
-rw-r--r--dom/base/Element.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp
index 7ab0699ed1..bfa0869c32 100644
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -1684,13 +1684,11 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
SetSubtreeRootPointer(aParent->SubtreeRoot());
}
- nsIDocument* composedDoc = GetComposedDoc();
- if (CustomElementRegistry::IsCustomElementEnabled() && composedDoc) {
+ if (CustomElementRegistry::IsCustomElementEnabled() && IsInComposedDoc()) {
// Connected callback must be enqueued whenever a custom element becomes
// connected.
if (GetCustomElementData()) {
- nsContentUtils::EnqueueLifecycleCallback(
- composedDoc, nsIDocument::eConnected, this);
+ nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eConnected, this);
}
}
@@ -1989,8 +1987,7 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
// the document and this document has a browsing context.
if (GetCustomElementData() && document->GetDocShell()) {
// Enqueue a detached callback for the custom element.
- nsContentUtils::EnqueueLifecycleCallback(
- document, nsIDocument::eDetached, this);
+ nsContentUtils::EnqueueLifecycleCallback(nsIDocument::eDetached, this);
}
}
@@ -2605,7 +2602,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
};
nsContentUtils::EnqueueLifecycleCallback(
- OwnerDoc(), nsIDocument::eAttributeChanged, this, &args, definition);
+ nsIDocument::eAttributeChanged, this, &args, definition);
}
}
}
@@ -2870,7 +2867,7 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
};
nsContentUtils::EnqueueLifecycleCallback(
- OwnerDoc(), nsIDocument::eAttributeChanged, this, &args, definition);
+ nsIDocument::eAttributeChanged, this, &args, definition);
}
}
}