summaryrefslogtreecommitdiff
path: root/dom/base/nsContentUtils.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/nsContentUtils.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/nsContentUtils.cpp')
-rw-r--r--dom/base/nsContentUtils.cpp34
1 files changed, 8 insertions, 26 deletions
diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp
index b029f97938..76171dda02 100644
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -9661,48 +9661,30 @@ nsContentUtils::EnqueueUpgradeReaction(Element* aElement,
MOZ_ASSERT(aElement);
nsIDocument* doc = aElement->OwnerDoc();
- nsPIDOMWindowInner* window(doc->GetInnerWindow());
- if (!window) {
- return;
- }
- RefPtr<CustomElementRegistry> registry(window->CustomElements());
- if (!registry) {
+ // No DocGroup means no custom element reactions stack.
+ if (!doc->GetDocGroup()) {
return;
}
CustomElementReactionsStack* stack =
doc->GetDocGroup()->CustomElementReactionsStack();
- stack->EnqueueUpgradeReaction(registry, aElement, aDefinition);
+ stack->EnqueueUpgradeReaction(aElement, aDefinition);
}
/* static */ void
-nsContentUtils::EnqueueLifecycleCallback(nsIDocument* aDoc,
- nsIDocument::ElementCallbackType aType,
+nsContentUtils::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType,
Element* aCustomElement,
LifecycleCallbackArgs* aArgs,
CustomElementDefinition* aDefinition)
{
- MOZ_ASSERT(aDoc);
-
- // To support imported document.
- nsCOMPtr<nsIDocument> doc = aDoc->MasterDocument();
-
- if (!doc->GetDocShell()) {
- return;
- }
-
- nsCOMPtr<nsPIDOMWindowInner> window(doc->GetInnerWindow());
- if (!window) {
- return;
- }
-
- RefPtr<CustomElementRegistry> registry(window->CustomElements());
- if (!registry) {
+ // No DocGroup means no custom element reactions stack.
+ if (!aCustomElement->OwnerDoc()->GetDocGroup()) {
return;
}
- registry->EnqueueLifecycleCallback(aType, aCustomElement, aArgs, aDefinition);
+ CustomElementRegistry::EnqueueLifecycleCallback(aType, aCustomElement, aArgs,
+ aDefinition);
}
/* static */ void