summaryrefslogtreecommitdiffstats
path: root/dom/base
diff options
context:
space:
mode:
Diffstat (limited to 'dom/base')
-rw-r--r--dom/base/CustomElementRegistry.cpp17
-rw-r--r--dom/base/CustomElementRegistry.h7
2 files changed, 24 insertions, 0 deletions
diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp
index 43e4e7e2a..6cd213210 100644
--- a/dom/base/CustomElementRegistry.cpp
+++ b/dom/base/CustomElementRegistry.cpp
@@ -273,6 +273,23 @@ CustomElementRegistry::LookupCustomElementDefinition(const nsAString& aLocalName
return nullptr;
}
+CustomElementDefinition*
+CustomElementRegistry::LookupCustomElementDefinition(JSContext* aCx,
+ JSObject* aConstructor) const
+{
+ JS::Rooted<JSObject*> constructor(aCx, js::CheckedUnwrap(aConstructor));
+
+ const auto& ptr = mConstructors.lookup(constructor);
+ if (!ptr) {
+ return nullptr;
+ }
+
+ CustomElementDefinition* definition = mCustomDefinitions.Get(ptr->value());
+ MOZ_ASSERT(definition, "Definition must be found in mCustomDefinitions");
+
+ return definition;
+}
+
void
CustomElementRegistry::RegisterUnresolvedElement(Element* aElement, nsIAtom* aTypeName)
{
diff --git a/dom/base/CustomElementRegistry.h b/dom/base/CustomElementRegistry.h
index 9034dd7ea..8ef0785af 100644
--- a/dom/base/CustomElementRegistry.h
+++ b/dom/base/CustomElementRegistry.h
@@ -128,6 +128,10 @@ struct CustomElementDefinition
// The document custom element order.
uint32_t mDocOrder;
+
+ bool IsCustomBuiltIn() {
+ return mType != mLocalName;
+ }
};
class CustomElementRegistry final : public nsISupports,
@@ -155,6 +159,9 @@ public:
CustomElementDefinition* LookupCustomElementDefinition(
const nsAString& aLocalName, const nsAString* aIs = nullptr) const;
+ CustomElementDefinition* LookupCustomElementDefinition(
+ JSContext* aCx, JSObject *aConstructor) const;
+
/**
* Enqueue created callback or register upgrade candidate for
* newly created custom elements, possibly extending an existing type.