diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp')
-rw-r--r-- | src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp index fa68151..33af997 100644 --- a/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp +++ b/src/3rdparty/webkit/WebCore/html/HTMLTokenizer.cpp @@ -43,6 +43,7 @@ #include "HTMLParser.h" #include "HTMLScriptElement.h" #include "HTMLViewSourceDocument.h" +#include "ImageLoader.h" #include "InspectorTimelineAgent.h" #include "MappedAttribute.h" #include "Page.h" @@ -441,7 +442,8 @@ HTMLTokenizer::State HTMLTokenizer::scriptHandler(State state) #endif // The parser might have been stopped by for example a window.close call in an earlier script. // If so, we don't want to load scripts. - if (!m_parserStopped && (cs = m_doc->docLoader()->requestScript(m_scriptTagSrcAttrValue, m_scriptTagCharsetAttrValue))) + if (!m_parserStopped && m_scriptNode->dispatchBeforeLoadEvent(m_scriptTagSrcAttrValue) && + (cs = m_doc->docLoader()->requestScript(m_scriptTagSrcAttrValue, m_scriptTagCharsetAttrValue))) m_pendingScripts.append(cs); else m_scriptNode = 0; @@ -560,7 +562,7 @@ HTMLTokenizer::State HTMLTokenizer::scriptExecution(const ScriptSourceCode& sour #endif m_state = state; - m_doc->frame()->loader()->executeScript(sourceCode); + m_doc->frame()->script()->executeScript(sourceCode); state = m_state; state.setAllowYield(true); @@ -1673,7 +1675,7 @@ void HTMLTokenizer::write(const SegmentedString& str, bool appendData) State state = m_state; - while (!m_src.isEmpty() && (!frame || !frame->loader()->isScheduledLocationChangePending())) { + while (!m_src.isEmpty() && (!frame || !frame->redirectScheduler()->locationChangePending())) { if (!continueProcessing(processedCount, startTime, state)) break; @@ -1801,6 +1803,9 @@ void HTMLTokenizer::write(const SegmentedString& str, bool appendData) if (m_noMoreData && !m_inWrite && !state.loadingExtScript() && !m_executingScript && !m_timer.isActive()) end(); // this actually causes us to be deleted + + // After parsing, go ahead and dispatch image beforeload/load events. + ImageLoader::dispatchPendingEvents(); } void HTMLTokenizer::stopParsing() @@ -1981,6 +1986,14 @@ void HTMLTokenizer::enlargeScriptBuffer(int len) CRASH(); int newSize = m_scriptCodeCapacity + delta; + // If we allow fastRealloc(ptr, 0), it will call CRASH(). We run into this + // case if the HTML being parsed begins with "<!--" and there's more data + // coming. + if (!newSize) { + ASSERT(!m_scriptCode); + return; + } + m_scriptCode = static_cast<UChar*>(fastRealloc(m_scriptCode, newSize * sizeof(UChar))); m_scriptCodeCapacity = newSize; } |