Bug 1332233 - prevent resource leak in CustomElementRegistry::Define. r=baku

MozReview-Commit-ID: AzXgls3lKCA

--HG--
extra : rebase_source : 89c5c54e0c149aa01dd576fa66402eff1ac76173
This commit is contained in:
Andi-Bogdan Postelnicu 2017-01-19 14:31:33 +02:00
Родитель 1305bbb18d
Коммит a3efd41d68
1 изменённых файлов: 8 добавлений и 7 удалений

Просмотреть файл

@ -772,13 +772,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,
constructor,
constructorPrototype,
callbacks,
0 /* TODO dependent on HTML imports. Bug 877072 */);
/**
* 12. Add definition to this CustomElementRegistry.
@ -788,6 +781,14 @@ CustomElementRegistry::Define(const nsAString& aName,
return;
}
CustomElementDefinition* definition =
new CustomElementDefinition(nameAtom,
localNameAtom,
constructor,
constructorPrototype,
callbacks,
0 /* TODO dependent on HTML imports. Bug 877072 */);
mCustomDefinitions.Put(nameAtom, definition);
MOZ_ASSERT(mCustomDefinitions.Count() == mConstructors.count(),