| Index: Source/core/html/imports/HTMLImportChild.cpp
|
| diff --git a/Source/core/html/imports/HTMLImportChild.cpp b/Source/core/html/imports/HTMLImportChild.cpp
|
| index 4309e071e08606f285a5ed65c40f950a1ef3f899..33bf0097961d01b6977ecaa406871d989ad9de76 100644
|
| --- a/Source/core/html/imports/HTMLImportChild.cpp
|
| +++ b/Source/core/html/imports/HTMLImportChild.cpp
|
| @@ -62,11 +62,8 @@ HTMLImportChild::~HTMLImportChild()
|
| // importDestroyed() should be called before the destruction.
|
| ASSERT(!m_loader);
|
|
|
| - if (m_customElementMicrotaskStep) {
|
| - // if Custom Elements were blocked, must unblock them before death
|
| - m_customElementMicrotaskStep->importDidFinish();
|
| - m_customElementMicrotaskStep = 0;
|
| - }
|
| + if (m_customElementMicrotaskStep)
|
| + m_customElementMicrotaskStep->importWasDestroyed();
|
|
|
| if (m_client)
|
| m_client->importChildWasDestroyed(this);
|
| @@ -99,18 +96,25 @@ void HTMLImportChild::didFinish()
|
| if (m_client)
|
| m_client->didFinish();
|
|
|
| - if (m_customElementMicrotaskStep) {
|
| - m_customElementMicrotaskStep->importDidFinish();
|
| - m_customElementMicrotaskStep = 0;
|
| - }
|
| + ASSERT(!m_customElementMicrotaskStep);
|
| }
|
|
|
| void HTMLImportChild::didFinishLoading()
|
| {
|
| + // This triggers closing handshake between CustomElementMicrotaskImportStep.
|
| + // It eventually tells back through didFinishMicrotask(), then this import becomes "done".
|
| + if (m_customElementMicrotaskStep)
|
| + m_customElementMicrotaskStep->importDidLoad(this);
|
| clearResource();
|
| stateWillChange();
|
| }
|
|
|
| +void HTMLImportChild::didFinishMicrotask()
|
| +{
|
| + m_customElementMicrotaskStep = 0;
|
| + stateWillChange();
|
| +}
|
| +
|
| Document* HTMLImportChild::importedDocument() const
|
| {
|
| if (!m_loader)
|
| @@ -157,7 +161,7 @@ void HTMLImportChild::ensureLoader()
|
| else
|
| createLoader();
|
|
|
| - if (isSync() && !isDone()) {
|
| + if (!isDone() && !formsCycle()) {
|
| ASSERT(!m_customElementMicrotaskStep);
|
| m_customElementMicrotaskStep = CustomElement::didCreateImport(this);
|
| }
|
| @@ -181,7 +185,7 @@ void HTMLImportChild::shareLoader(HTMLImportChild* loader)
|
|
|
| bool HTMLImportChild::isDone() const
|
| {
|
| - return m_loader && m_loader->isDone();
|
| + return m_loader && m_loader->isDone() && !m_customElementMicrotaskStep;
|
| }
|
|
|
| bool HTMLImportChild::loaderHasError() const
|
|
|