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

Unified Diff: Source/core/dom/Document.cpp

Issue 725593004: Prevent the load event from firing inside DOMContentLoaded (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Done->FinishedParsing Created 6 years, 1 month 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 | « Source/core/dom/Document.h ('k') | Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 5ef85b8c99b269694a820145e9b53603cb2d594f..15e51deb36a65c9ccb46505c25af707ba6b79846 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -463,7 +463,7 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
, m_visitedLinkState(VisitedLinkState::create(*this))
, m_visuallyOrdered(false)
, m_readyState(Complete)
- , m_isParsing(false)
+ , m_parsingState(FinishedParsing)
, m_gotoAnchorNeededAfterStylesheetsLoad(false)
, m_containsValidityStyleRules(false)
, m_updateFocusAppearanceRestoresSelection(false)
@@ -2376,7 +2376,7 @@ PassRefPtrWillBeRawPtr<DocumentParser> Document::implicitOpen()
setCompatibilityMode(NoQuirksMode);
m_parser = createParser();
- setParsing(true);
+ setParsingState(Parsing);
setReadyState(Loading);
return m_parser;
@@ -2670,11 +2670,11 @@ Document::PageDismissalType Document::pageDismissalEventBeingDispatched() const
return NoDismissal;
}
-void Document::setParsing(bool b)
+void Document::setParsingState(ParsingState parsingState)
{
- m_isParsing = b;
+ m_parsingState = parsingState;
- if (m_isParsing && !m_elementDataCache)
+ if (parsing() && !m_elementDataCache)
m_elementDataCache = ElementDataCache::create();
}
@@ -4430,16 +4430,16 @@ void Document::applyXSLTransform(ProcessingInstruction* pi)
String resultMIMEType;
String newSource;
String resultEncoding;
- setParsing(true);
+ setParsingState(Parsing);
if (!processor->transformToString(this, resultMIMEType, newSource, resultEncoding)) {
- setParsing(false);
+ setParsingState(FinishedParsing);
return;
}
// FIXME: If the transform failed we should probably report an error (like Mozilla does).
LocalFrame* ownerFrame = frame();
processor->createDocumentFromSource(newSource, resultEncoding, resultMIMEType, this, ownerFrame);
InspectorInstrumentation::frameDocumentUpdated(ownerFrame);
- setParsing(false);
+ setParsingState(FinishedParsing);
}
void Document::setTransformSource(PassOwnPtr<TransformSource> source)
@@ -4624,12 +4624,13 @@ void Document::finishedParsing()
{
ASSERT(!scriptableDocumentParser() || !m_parser->isParsing());
ASSERT(!scriptableDocumentParser() || m_readyState != Loading);
- setParsing(false);
+ setParsingState(InDOMContentLoaded);
if (!m_documentTiming.domContentLoadedEventStart)
m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTime();
dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded));
if (!m_documentTiming.domContentLoadedEventEnd)
m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime();
+ setParsingState(FinishedParsing);
// 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).
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698