diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-05 15:59:26 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-26 15:50:29 -0500 |
commit | 3d4c4100912132141881f40e90ddbd3aba8b0737 (patch) | |
tree | 92a662145f0243654c42c8cf830cebf5df7aa30f /dom/base/CustomElementRegistry.h | |
parent | 186782301c03f4b27e4edae07b0280e92c4e01d1 (diff) | |
download | uxp-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/CustomElementRegistry.h')
-rw-r--r-- | dom/base/CustomElementRegistry.h | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/dom/base/CustomElementRegistry.h b/dom/base/CustomElementRegistry.h index 89e7543657..f73a8707e5 100644 --- a/dom/base/CustomElementRegistry.h +++ b/dom/base/CustomElementRegistry.h @@ -198,10 +198,8 @@ private: class CustomElementReaction { public: - explicit CustomElementReaction(CustomElementRegistry* aRegistry, - CustomElementDefinition* aDefinition) - : mRegistry(aRegistry) - , mDefinition(aDefinition) + explicit CustomElementReaction(CustomElementDefinition* aDefinition) + : mDefinition(aDefinition) { } @@ -212,16 +210,14 @@ public: } protected: - CustomElementRegistry* mRegistry; CustomElementDefinition* mDefinition; }; class CustomElementUpgradeReaction final : public CustomElementReaction { public: - explicit CustomElementUpgradeReaction(CustomElementRegistry* aRegistry, - CustomElementDefinition* aDefinition) - : CustomElementReaction(aRegistry, aDefinition) + explicit CustomElementUpgradeReaction(CustomElementDefinition* aDefinition) + : CustomElementReaction(aDefinition) { } @@ -232,10 +228,9 @@ private: class CustomElementCallbackReaction final : public CustomElementReaction { public: - CustomElementCallbackReaction(CustomElementRegistry* aRegistry, - CustomElementDefinition* aDefinition, + CustomElementCallbackReaction(CustomElementDefinition* aDefinition, UniquePtr<CustomElementCallback> aCustomElementCallback) - : CustomElementReaction(aRegistry, aDefinition) + : CustomElementReaction(aDefinition) , mCustomElementCallback(Move(aCustomElementCallback)) { } @@ -271,16 +266,14 @@ public: * Enqueue a custom element upgrade reaction * https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-upgrade-reaction */ - void EnqueueUpgradeReaction(CustomElementRegistry* aRegistry, - Element* aElement, + void EnqueueUpgradeReaction(Element* aElement, CustomElementDefinition* aDefinition); /** * Enqueue a custom element callback reaction * https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-callback-reaction */ - void EnqueueCallbackReaction(CustomElementRegistry* aRegistry, - Element* aElement, + void EnqueueCallbackReaction(Element* aElement, CustomElementDefinition* aDefinition, UniquePtr<CustomElementCallback> aCustomElementCallback); @@ -368,10 +361,10 @@ public: */ void SetupCustomElement(Element* aElement, const nsAString* aTypeExtension); - void EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType, - Element* aCustomElement, - LifecycleCallbackArgs* aArgs, - CustomElementDefinition* aDefinition); + static void EnqueueLifecycleCallback(nsIDocument::ElementCallbackType aType, + Element* aCustomElement, + LifecycleCallbackArgs* aArgs, + CustomElementDefinition* aDefinition); void GetCustomPrototype(nsIAtom* aAtom, JS::MutableHandle<JSObject*> aPrototype); @@ -385,7 +378,7 @@ public: private: ~CustomElementRegistry(); - UniquePtr<CustomElementCallback> CreateCustomElementCallback( + static UniquePtr<CustomElementCallback> CreateCustomElementCallback( nsIDocument::ElementCallbackType aType, Element* aCustomElement, LifecycleCallbackArgs* aArgs, CustomElementDefinition* aDefinition); |