Bug 1334043 - Part 1: Replace attached callback (v0) with connected callback (v1).

Tag UXP Issue #1344
This commit is contained in:
Gaming4JC 2020-01-05 15:46:37 -05:00 committed by Roy Tam
commit 207d5a2e3e
4 changed files with 27 additions and 25 deletions

View file

@ -1685,13 +1685,12 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
}
nsIDocument* composedDoc = GetComposedDoc();
if (composedDoc) {
// Attached callback must be enqueued whenever custom element is inserted into a
// document and this document has a browsing context.
if (GetCustomElementData() && composedDoc->GetDocShell()) {
// Enqueue an attached callback for the custom element.
if (CustomElementRegistry::IsCustomElementEnabled() && composedDoc) {
// Connected callback must be enqueued whenever a custom element becomes
// connected.
if (GetCustomElementData()) {
nsContentUtils::EnqueueLifecycleCallback(
composedDoc, nsIDocument::eAttached, this);
composedDoc, nsIDocument::eConnected, this);
}
}
@ -2586,7 +2585,7 @@ Element::SetAttrAndNotify(int32_t aNamespaceID,
UpdateState(aNotify);
if (nsContentUtils::IsWebComponentsEnabled()) {
if (CustomElementRegistry::IsCustomElementEnabled()) {
if (CustomElementData* data = GetCustomElementData()) {
if (CustomElementDefinition* definition =
nsContentUtils::GetElementDefinitionIfObservingAttr(this,
@ -2853,7 +2852,7 @@ Element::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
UpdateState(aNotify);
if (nsContentUtils::IsWebComponentsEnabled()) {
if (CustomElementRegistry::IsCustomElementEnabled()) {
if (CustomElementData* data = GetCustomElementData()) {
if (CustomElementDefinition* definition =
nsContentUtils::GetElementDefinitionIfObservingAttr(this,