diff options
Diffstat (limited to 'dom/base/CustomElementRegistry.h')
-rw-r--r-- | dom/base/CustomElementRegistry.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/dom/base/CustomElementRegistry.h b/dom/base/CustomElementRegistry.h index b731a1858..89e754365 100644 --- a/dom/base/CustomElementRegistry.h +++ b/dom/base/CustomElementRegistry.h @@ -13,7 +13,9 @@ #include "mozilla/ErrorResult.h" #include "mozilla/dom/BindingDeclarations.h" #include "mozilla/dom/FunctionBinding.h" +#include "mozilla/dom/WebComponentsBinding.h" #include "nsCycleCollectionParticipant.h" +#include "nsGenericHTMLElement.h" #include "nsWrapperCache.h" class nsDocument; @@ -23,7 +25,6 @@ namespace dom { struct CustomElementData; struct ElementDefinitionOptions; -struct LifecycleCallbacks; class CallbackFunction; class CustomElementReaction; class Function; @@ -115,6 +116,22 @@ struct CustomElementData // e.g., create an element, insert a node. AutoTArray<UniquePtr<CustomElementReaction>, 3> mReactionQueue; + RefPtr<CustomElementDefinition> mCustomElementDefinition; + + void + SetCustomElementDefinition(CustomElementDefinition* aDefinition) + { + MOZ_ASSERT(!mCustomElementDefinition); + + mCustomElementDefinition = aDefinition; + } + + CustomElementDefinition* + GetCustomElementDefinition() + { + return mCustomElementDefinition; + } + private: virtual ~CustomElementData() {} }; @@ -125,6 +142,9 @@ private: // https://html.spec.whatwg.org/multipage/scripting.html#custom-element-definition struct CustomElementDefinition { + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CustomElementDefinition) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CustomElementDefinition) + CustomElementDefinition(nsIAtom* aType, nsIAtom* aLocalName, Function* aConstructor, @@ -170,6 +190,9 @@ struct CustomElementDefinition return mObservedAttributes.Contains(aName); } + +private: + ~CustomElementDefinition() {} }; class CustomElementReaction @@ -381,7 +404,7 @@ private: CustomElementDefinition* aDefinition, ErrorResult& aRv); - typedef nsClassHashtable<nsISupportsHashKey, CustomElementDefinition> + typedef nsRefPtrHashtable<nsISupportsHashKey, CustomElementDefinition> DefinitionMap; typedef nsClassHashtable<nsISupportsHashKey, nsTArray<nsWeakPtr>> CandidateMap; |