From 5cf46e2f87f4f6294d02d96c7905b069c9975eee Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Fri, 3 Jan 2020 18:50:56 -0500 Subject: Bug 1341693 - Don't need to check GetDocShell() when creating CustomElementRegistry; Tag UXP Issue #1344 --- dom/base/CustomElementRegistry.cpp | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) (limited to 'dom/base/CustomElementRegistry.cpp') diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp index 20eb59e94..25267f5d3 100644 --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -174,30 +174,6 @@ CustomElementRegistry::IsCustomElementEnabled(JSContext* aCx, JSObject* aObject) Preferences::GetBool("dom.webcomponents.enabled"); } -/* static */ already_AddRefed -CustomElementRegistry::Create(nsPIDOMWindowInner* aWindow) -{ - MOZ_ASSERT(aWindow); - MOZ_ASSERT(aWindow->IsInnerWindow()); - - if (!aWindow->GetDocShell()) { - return nullptr; - } - - if (!IsCustomElementEnabled()) { - return nullptr; - } - - RefPtr customElementRegistry = - new CustomElementRegistry(aWindow); - - if (!customElementRegistry->Init()) { - return nullptr; - } - - return customElementRegistry.forget(); -} - /* static */ void CustomElementRegistry::ProcessTopElementQueue() { @@ -240,6 +216,10 @@ CustomElementRegistry::CustomElementRegistry(nsPIDOMWindowInner* aWindow) , mIsCustomDefinitionRunning(false) , mIsBackupQueueProcessing(false) { + MOZ_ASSERT(aWindow); + MOZ_ASSERT(aWindow->IsInnerWindow()); + MOZ_ALWAYS_TRUE(mConstructors.init()); + mozilla::HoldJSObjects(this); if (!sProcessingStack) { @@ -254,12 +234,6 @@ CustomElementRegistry::~CustomElementRegistry() mozilla::DropJSObjects(this); } -bool -CustomElementRegistry::Init() -{ - return mConstructors.init(); -} - CustomElementDefinition* CustomElementRegistry::LookupCustomElementDefinition(const nsAString& aLocalName, const nsAString* aIs) const -- cgit v1.2.3