summaryrefslogtreecommitdiff
path: root/dom
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
commit055bbe09d066d44fc4bed244094c87880b80b04d (patch)
tree49e9ceb75843222109b9a7e2c557f9a4d36576ff /dom
parent3dcd73434f4405a389f783cf6e56172b34e3187f (diff)
downloadaura-central-055bbe09d066d44fc4bed244094c87880b80b04d.tar.gz
Bug 1332233 - prevent resource leak in CustomElementRegistry::Define.
Tag UXP Issue mcp-graveyard/UXP%1344
Diffstat (limited to 'dom')
-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(),