Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(651)

Unified Diff: sky/engine/core/dom/Document.cpp

Issue 841873006: All documents should have a RegistrationContext. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/dom/Document.h ('k') | sky/engine/core/dom/DocumentInit.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/dom/Document.cpp
diff --git a/sky/engine/core/dom/Document.cpp b/sky/engine/core/dom/Document.cpp
index 15ab59747824ff13b598fb6b3a0eb5bab1849aae..0eda95164f0c5367d85174e9aac75495e7b5e698 100644
--- a/sky/engine/core/dom/Document.cpp
+++ b/sky/engine/core/dom/Document.cpp
@@ -267,7 +267,7 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
, m_didSetReferrerPolicy(false)
, m_referrerPolicy(ReferrerPolicyDefault)
, m_directionSetOnDocumentElement(false)
- , m_registrationContext(initializer.registrationContext(this))
+ , m_registrationContext(initializer.registrationContext())
, m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFired)
, m_timeline(AnimationTimeline::create(this))
, m_templateDocumentHost(nullptr)
@@ -276,6 +276,9 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
{
setClient(this);
+ if (!m_registrationContext)
+ m_registrationContext = CustomElementRegistrationContext::create();
+
m_fetcher = ResourceFetcher::create(this);
// We depend on the url getting immediately set in subframes, but we
@@ -450,13 +453,8 @@ ScriptValue Document::registerElement(ScriptState* scriptState, const AtomicStri
ScriptValue Document::registerElement(ScriptState* scriptState, const AtomicString& name, const Dictionary& options, ExceptionState& exceptionState)
{
- if (!registrationContext()) {
- exceptionState.throwDOMException(NotSupportedError, "No element registration context is available.");
- return ScriptValue();
- }
-
CustomElementConstructorBuilder constructorBuilder(scriptState, &options);
- registrationContext()->registerElement(this, &constructorBuilder, name, exceptionState);
+ registrationContext().registerElement(this, &constructorBuilder, name, exceptionState);
return constructorBuilder.bindingsReturnValue();
}
@@ -2559,7 +2557,7 @@ Document& Document::ensureTemplateDocument()
return *m_templateDocument;
if (isHTMLDocument()) {
- DocumentInit init = DocumentInit::fromContext(contextDocument(), blankURL()).withNewRegistrationContext();
+ DocumentInit init = DocumentInit::fromContext(contextDocument(), blankURL());
m_templateDocument = HTMLDocument::create(init);
} else {
m_templateDocument = Document::create(DocumentInit(blankURL()));
« no previous file with comments | « sky/engine/core/dom/Document.h ('k') | sky/engine/core/dom/DocumentInit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698