Changeset 142200 in webkit


Ignore:
Timestamp:
Feb 7, 2013 4:24:31 PM (11 years ago)
Author:
abarth@webkit.org
Message:

fast/parser/document-write-noscript.html fails for threaded HTML parser
https://bugs.webkit.org/show_bug.cgi?id=109237

Reviewed by Eric Seidel.

Source/WebCore:

If there are multiple calls to document.write in an external script, we
need to wait for them all to complete before invalidating the
speculative tokens. Instead of doing this when we unwind the
document.write call stack, we do this when we're about to resume
parsing after script execution.

Test: fast/parser/document-write-basic.html

  • html/parser/HTMLDocumentParser.cpp:

(WebCore::HTMLDocumentParser::processParsedChunkFromBackgroundParser):
(WebCore::HTMLDocumentParser::insert):
(WebCore::HTMLDocumentParser::resumeParsingAfterScriptExecution):

LayoutTests:

This tests basic document.write functionality. There doesn't appear to
be another fast/parser test that covers this basic case (although it's
convered in some more complicated test cases incidentally.)

  • fast/parser/document-write-basic-expected.txt: Added.
  • fast/parser/document-write-basic.html: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r142198 r142200  
     12013-02-07  Adam Barth  <abarth@webkit.org>
     2
     3        fast/parser/document-write-noscript.html fails for threaded HTML parser
     4        https://bugs.webkit.org/show_bug.cgi?id=109237
     5
     6        Reviewed by Eric Seidel.
     7
     8        This tests basic document.write functionality.  There doesn't appear to
     9        be another fast/parser test that covers this basic case (although it's
     10        convered in some more complicated test cases incidentally.)
     11
     12        * fast/parser/document-write-basic-expected.txt: Added.
     13        * fast/parser/document-write-basic.html: Added.
     14
    1152013-02-07  Keishi Hattori  <keishi@webkit.org>
    216
  • trunk/Source/WebCore/ChangeLog

    r142199 r142200  
     12013-02-07  Adam Barth  <abarth@webkit.org>
     2
     3        fast/parser/document-write-noscript.html fails for threaded HTML parser
     4        https://bugs.webkit.org/show_bug.cgi?id=109237
     5
     6        Reviewed by Eric Seidel.
     7
     8        If there are multiple calls to document.write in an external script, we
     9        need to wait for them all to complete before invalidating the
     10        speculative tokens. Instead of doing this when we unwind the
     11        document.write call stack, we do this when we're about to resume
     12        parsing after script execution.
     13
     14        Test: fast/parser/document-write-basic.html
     15
     16        * html/parser/HTMLDocumentParser.cpp:
     17        (WebCore::HTMLDocumentParser::processParsedChunkFromBackgroundParser):
     18        (WebCore::HTMLDocumentParser::insert):
     19        (WebCore::HTMLDocumentParser::resumeParsingAfterScriptExecution):
     20
    1212013-02-07  Lamarque V. Souza  <Lamarque.Souza@basyskom.com>
    222
  • trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp

    r142099 r142200  
    288288}
    289289
     290void HTMLDocumentParser::checkForSpeculationFailure()
     291{
     292    if (!m_tokenizer)
     293        return;
     294    // FIXME: If the tokenizer is in the same state as when we started this function,
     295    // then we haven't necessarily failed our speculation.
     296    didFailSpeculation(m_token.release(), m_tokenizer.release());
     297}
     298
    290299void HTMLDocumentParser::didFailSpeculation(PassOwnPtr<HTMLToken> token, PassOwnPtr<HTMLTokenizer> tokenizer)
    291300{
     
    306315    RefPtr<HTMLDocumentParser> protect(this);
    307316
    308     ASSERT(!m_currentChunk);
    309317    m_currentChunk = chunk;
    310318    OwnPtr<CompactHTMLTokenStream> tokens = m_currentChunk->tokens.release();
     
    342350    }
    343351
    344     m_currentChunk.clear();
     352    checkForSpeculationFailure();
     353
    345354    InspectorInstrumentation::didWriteHTML(cookie, lineNumber().zeroBasedInt());
    346355}
     
    484493    pumpTokenizerIfPossible(ForceSynchronous);
    485494
    486 #if ENABLE(THREADED_HTML_PARSER)
    487     if (!inPumpSession() && m_haveBackgroundParser) {
    488         // FIXME: If the tokenizer is in the same state as when we started this function,
    489         // then we haven't necessarily failed our speculation.
    490         didFailSpeculation(m_token.release(), m_tokenizer.release());
    491         return;
    492     }
    493 #endif
    494 
    495495    if (isWaitingForScripts()) {
    496496        // Check the document.write() output with a separate preload scanner as
     
    715715
    716716#if ENABLE(THREADED_HTML_PARSER)
    717     if (shouldUseThreading()) {
     717    if (m_haveBackgroundParser) {
     718        checkForSpeculationFailure();
     719
    718720        while (!m_speculations.isEmpty()) {
    719721            processParsedChunkFromBackgroundParser(m_speculations.takeFirst());
  • trunk/Source/WebCore/html/parser/HTMLDocumentParser.h

    r141897 r142200  
    130130    void startBackgroundParser();
    131131    void stopBackgroundParser();
     132    void checkForSpeculationFailure();
    132133    void didFailSpeculation(PassOwnPtr<HTMLToken>, PassOwnPtr<HTMLTokenizer>);
    133134    void processParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>);
Note: See TracChangeset for help on using the changeset viewer.