Changeset 60814 in webkit


Ignore:
Timestamp:
Jun 7, 2010 7:25:44 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-06-07 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

HTML5 Parser fails script-tests which use document.write
https://bugs.webkit.org/show_bug.cgi?id=40276

We were leaving the TreeBuilder paused when executing the scripts
resulting in document.write() calls being ignored.

I don't see a good way to ASSERT this correct behavior, since
the HTML5ScriptRunner and the HTML5TreeBuilder do not know about
each other. We should never have document.write() called while
the HTML5TreeBuilder is paused, however both document.write and
the network call the same HTML5Tokenizer::write method. It's OK
to be paused when the network writes, but during document.write
(or any other script execution).

Tested by all of fast/url and numerous other tests.

  • html/HTML5Tokenizer.cpp: (WebCore::HTML5Tokenizer::notifyFinished):
    • Unpause the treebuilder before executing scripts.

(WebCore::HTML5Tokenizer::executeScriptsWaitingForStylesheets):

  • Unpause the treebuilder before executing scripts.
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r60813 r60814  
     12010-06-07  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        HTML5 Parser fails script-tests which use document.write
     6        https://bugs.webkit.org/show_bug.cgi?id=40276
     7
     8        We were leaving the TreeBuilder paused when executing the scripts
     9        resulting in document.write() calls being ignored.
     10
     11        I don't see a good way to ASSERT this correct behavior, since
     12        the HTML5ScriptRunner and the HTML5TreeBuilder do not know about
     13        each other.  We should never have document.write() called while
     14        the HTML5TreeBuilder is paused, however both document.write and
     15        the network call the same HTML5Tokenizer::write method.  It's OK
     16        to be paused when the network writes, but during document.write
     17        (or any other script execution).
     18
     19        Tested by all of fast/url and numerous other tests.
     20
     21        * html/HTML5Tokenizer.cpp:
     22        (WebCore::HTML5Tokenizer::notifyFinished):
     23         - Unpause the treebuilder before executing scripts.
     24        (WebCore::HTML5Tokenizer::executeScriptsWaitingForStylesheets):
     25         - Unpause the treebuilder before executing scripts.
     26
    1272010-06-07  Eric Seidel  <eric@webkit.org>
    228
  • trunk/WebCore/html/HTML5Tokenizer.cpp

    r60813 r60814  
    226226    ASSERT(!m_scriptRunner->inScriptExecution());
    227227    ASSERT(m_treeBuilder->isPaused());
     228    // Note: We only ever wait on one script at a time, so we always know this
     229    // is the one we were waiting on and can un-pause the tree builder.
     230    m_treeBuilder->setPaused(false);
    228231    bool shouldContinueParsing = m_scriptRunner->executeScriptsWaitingForLoad(cachedResource);
    229232    m_treeBuilder->setPaused(!shouldContinueParsing);
     
    241244    ASSERT(!m_scriptRunner->inScriptExecution());
    242245    ASSERT(m_treeBuilder->isPaused());
     246    // Note: We only ever wait on one script at a time, so we always know this
     247    // is the one we were waiting on and can un-pause the tree builder.
     248    m_treeBuilder->setPaused(false);
    243249    bool shouldContinueParsing = m_scriptRunner->executeScriptsWaitingForStylesheets();
    244250    m_treeBuilder->setPaused(!shouldContinueParsing);
Note: See TracChangeset for help on using the changeset viewer.