Index: Source/core/dom/DocumentInit.cpp |
diff --git a/Source/core/dom/DocumentInit.cpp b/Source/core/dom/DocumentInit.cpp |
index 7993f6c55e078a0f1361993f1e1edb2ab731ba05..e3923a7aa414250d103d644c323b6e4444941dc1 100644 |
--- a/Source/core/dom/DocumentInit.cpp |
+++ b/Source/core/dom/DocumentInit.cpp |
@@ -68,6 +68,7 @@ DocumentInit::DocumentInit(const KURL& url, Frame* frame, WeakPtr<Document> cont |
, m_owner(ownerDocument(frame)) |
, m_contextDocument(contextDocument) |
, m_import(import) |
+ , m_createNewRegistrationContext(false) |
{ |
} |
@@ -79,6 +80,7 @@ DocumentInit::DocumentInit(const DocumentInit& other) |
, m_contextDocument(other.m_contextDocument) |
, m_import(other.m_import) |
, m_registrationContext(other.m_registrationContext) |
+ , m_createNewRegistrationContext(other.m_createNewRegistrationContext) |
{ |
} |
@@ -125,11 +127,18 @@ KURL DocumentInit::parentBaseURL() const |
DocumentInit& DocumentInit::withRegistrationContext(CustomElementRegistrationContext* registrationContext) |
{ |
- ASSERT(!m_registrationContext); |
+ ASSERT(!m_createNewRegistrationContext && !m_registrationContext); |
m_registrationContext = registrationContext; |
return *this; |
} |
+DocumentInit& DocumentInit::withNewRegistrationContext() |
+{ |
+ ASSERT(!m_createNewRegistrationContext && !m_registrationContext); |
+ m_createNewRegistrationContext = true; |
+ return *this; |
+} |
+ |
PassRefPtr<CustomElementRegistrationContext> DocumentInit::registrationContext(Document* document) const |
{ |
if (!RuntimeEnabledFeatures::customElementsEnabled() && !RuntimeEnabledFeatures::embedderCustomElementsEnabled()) |
@@ -138,10 +147,10 @@ PassRefPtr<CustomElementRegistrationContext> DocumentInit::registrationContext(D |
if (!document->isHTMLDocument() && !document->isXHTMLDocument()) |
return 0; |
- if (m_registrationContext) |
- return m_registrationContext.get(); |
+ if (m_createNewRegistrationContext) |
+ return CustomElementRegistrationContext::create(); |
- return CustomElementRegistrationContext::create(); |
+ return m_registrationContext.get(); |
} |
WeakPtr<Document> DocumentInit::contextDocument() const |