| Index: Source/core/dom/Document.cpp
|
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
|
| index 69ac933bf334b8c45e8b1a1b1cc96dcf5aafa332..d80c52c0538aa4b1a946befef87b8e4043bfdb14 100644
|
| --- a/Source/core/dom/Document.cpp
|
| +++ b/Source/core/dom/Document.cpp
|
| @@ -453,6 +453,8 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
|
| , m_paginatedForScreen(false)
|
| , m_compatibilityMode(NoQuirksMode)
|
| , m_compatibilityModeLocked(false)
|
| + , m_hasFiredDOMContentLoadedEvent(false)
|
| + , m_dispatchDOMContentLoadedTimer(this, &Document::dispatchDOMContentLoadedTimerFired)
|
| , m_executeScriptsWaitingForResourcesTimer(this, &Document::executeScriptsWaitingForResourcesTimerFired)
|
| , m_hasAutofocused(false)
|
| , m_clearFocusedElementTimer(this, &Document::clearFocusedElementTimerFired)
|
| @@ -4609,17 +4611,33 @@ PassRefPtrWillBeRawPtr<DocumentNameCollection> Document::documentNamedItems(cons
|
| return ensureCachedCollection<DocumentNameCollection>(DocumentNamedItems, name);
|
| }
|
|
|
| -void Document::finishedParsing()
|
| +void Document::dispatchDOMContentLoadedTimerFired(Timer<Document>*)
|
| {
|
| - ASSERT(!scriptableDocumentParser() || !m_parser->isParsing());
|
| - ASSERT(!scriptableDocumentParser() || m_readyState != Loading);
|
| - setParsing(false);
|
| if (!m_documentTiming.domContentLoadedEventStart)
|
| m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTime();
|
| dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded));
|
| if (!m_documentTiming.domContentLoadedEventEnd)
|
| m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime();
|
|
|
| + m_hasFiredDOMContentLoadedEvent = true;
|
| +
|
| + if (RefPtrWillBeRawPtr<LocalFrame> frame = this->frame()) {
|
| + TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "MarkDOMContent", "data", InspectorMarkLoadEvent::data(frame.get()));
|
| + // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeline migrates to tracing.
|
| + InspectorInstrumentation::domContentLoadedEventFired(frame.get());
|
| +
|
| + frame->loader().checkLoadComplete();
|
| + }
|
| +}
|
| +
|
| +// FIXME: Document should be a DocumentParserClient and this should be replaced with its notifyParserStopped() callback
|
| +void Document::finishedParsing()
|
| +{
|
| + ASSERT(!scriptableDocumentParser() || !m_parser->isParsing());
|
| + ASSERT(!scriptableDocumentParser() || m_readyState != Loading);
|
| + setParsing(false);
|
| + m_dispatchDOMContentLoadedTimer.startOneShot(0, FROM_HERE);
|
| +
|
| // The loader's finishedParsing() method may invoke script that causes this object to
|
| // be dereferenced (when this document is in an iframe and the onload causes the iframe's src to change).
|
| // Keep it alive until we are done.
|
| @@ -4642,10 +4660,6 @@ void Document::finishedParsing()
|
| updateRenderTreeIfNeeded();
|
|
|
| frame->loader().finishedParsing();
|
| -
|
| - TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "MarkDOMContent", "data", InspectorMarkLoadEvent::data(frame.get()));
|
| - // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeline migrates to tracing.
|
| - InspectorInstrumentation::domContentLoadedEventFired(frame.get());
|
| }
|
|
|
| // Schedule dropping of the ElementDataCache. We keep it alive for a while after parsing finishes
|
|
|