Stop calling Element::ensureShadowRoot() if it is used in construction phase.
[WebKit-https.git] / Source / WebCore / html / HTMLProgressElement.cpp
index ba4a883..1b2461c 100644 (file)
@@ -153,11 +153,14 @@ void HTMLProgressElement::didElementStateChange()
 
 void HTMLProgressElement::createShadowSubtree()
 {
+    ASSERT(!shadowRoot());
+
     RefPtr<ProgressBarElement> bar = ProgressBarElement::create(document());
     m_value = ProgressValueElement::create(document());
-    ExceptionCode ec = 0;
-    bar->appendChild(m_value, ec);
-    ensureShadowRoot()->appendChild(bar, ec);
+    bar->appendChild(m_value, ASSERT_NO_EXCEPTION);
+
+    RefPtr<ShadowRoot> root = ShadowRoot::create(this, ASSERT_NO_EXCEPTION);
+    root->appendChild(bar, ASSERT_NO_EXCEPTION);
 }
 
 } // namespace