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
commit87c189fd9235452823b86e20abafcd589ddc27dd (patch)
tree49e9ceb75843222109b9a7e2c557f9a4d36576ff /dom
parentc6aacaca6d66e9855fc386222dda6e0bb44fb4d3 (diff)
downloaduxp-87c189fd9235452823b86e20abafcd589ddc27dd.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 34ad9549d0..897f7df129 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(),