summaryrefslogtreecommitdiffstats
path: root/dom/base/CustomElementRegistry.cpp
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2020-01-05 12:15:22 -0500
committerGaming4JC <g4jc@hyperbola.info>2020-01-26 15:50:26 -0500
commit49f597e7fb83dc96bfcf66073fe5bfbf994d71ba (patch)
tree49e9ceb75843222109b9a7e2c557f9a4d36576ff /dom/base/CustomElementRegistry.cpp
parentbf004bb63bcc9e2ea5f9417461ecb3042b27a2fa (diff)
downloadUXP-49f597e7fb83dc96bfcf66073fe5bfbf994d71ba.tar
UXP-49f597e7fb83dc96bfcf66073fe5bfbf994d71ba.tar.gz
UXP-49f597e7fb83dc96bfcf66073fe5bfbf994d71ba.tar.lz
UXP-49f597e7fb83dc96bfcf66073fe5bfbf994d71ba.tar.xz
UXP-49f597e7fb83dc96bfcf66073fe5bfbf994d71ba.zip
Bug 1332233 - prevent resource leak in CustomElementRegistry::Define.
Tag UXP Issue #1344
Diffstat (limited to 'dom/base/CustomElementRegistry.cpp')
-rw-r--r--dom/base/CustomElementRegistry.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp
index 34ad9549d..897f7df12 100644
--- a/dom/base/CustomElementRegistry.cpp
+++ b/dom/base/CustomElementRegistry.cpp
@@ -817,14 +817,6 @@ CustomElementRegistry::Define(const nsAString& aName,
// Associate the definition with the custom element.
nsCOMPtr<nsIAtom> localNameAtom(NS_Atomize(localName));
LifecycleCallbacks* callbacks = callbacksHolder.forget();
- CustomElementDefinition* definition =
- new CustomElementDefinition(nameAtom,
- localNameAtom,
- &aFunctionConstructor,
- Move(observedAttributes),
- constructorPrototype,
- callbacks,
- 0 /* TODO dependent on HTML imports. Bug 877072 */);
/**
* 12. Add definition to this CustomElementRegistry.
@@ -834,6 +826,15 @@ CustomElementRegistry::Define(const nsAString& aName,
return;
}
+ CustomElementDefinition* definition =
+ new CustomElementDefinition(nameAtom,
+ localNameAtom,
+ &aFunctionConstructor,
+ Move(observedAttributes),
+ constructorPrototype,
+ callbacks,
+ 0 /* TODO dependent on HTML imports. Bug 877072 */);
+
mCustomDefinitions.Put(nameAtom, definition);
MOZ_ASSERT(mCustomDefinitions.Count() == mConstructors.count(),