Changeset 143830 in webkit


Ignore:
Timestamp:
Feb 22, 2013 7:28:41 PM (11 years ago)
Author:
tonyg@chromium.org
Message:

Threaded HTML parser fails resources/plain-text-unsafe.dat
https://bugs.webkit.org/show_bug.cgi?id=110538

Reviewed by Eric Seidel.

With this patch, the background HTML parser passes all tests in plain-text-unsafe.dat.

No new tests because covered by existing tests.

  • html/parser/BackgroundHTMLParser.cpp:

(WebCore::tokenExitsSVG):
(WebCore):
(WebCore::tokenExitsMath):
(WebCore::BackgroundHTMLParser::simulateTreeBuilder):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r143828 r143830  
     12013-02-22  Tony Gentilcore  <tonyg@chromium.org>
     2
     3        Threaded HTML parser fails resources/plain-text-unsafe.dat
     4        https://bugs.webkit.org/show_bug.cgi?id=110538
     5
     6        Reviewed by Eric Seidel.
     7
     8        With this patch, the background HTML parser passes all tests in plain-text-unsafe.dat.
     9
     10        No new tests because covered by existing tests.
     11
     12        * html/parser/BackgroundHTMLParser.cpp:
     13        (WebCore::tokenExitsSVG):
     14        (WebCore):
     15        (WebCore::tokenExitsMath):
     16        (WebCore::BackgroundHTMLParser::simulateTreeBuilder):
     17
    1182013-02-22  Tony Gentilcore  <tonyg@chromium.org>
    219
  • trunk/Source/WebCore/html/parser/BackgroundHTMLParser.cpp

    r143661 r143830  
    6262#endif
    6363
    64 static inline bool tokenExitsForeignContent(const CompactHTMLToken& token)
     64static bool tokenExitsForeignContent(const CompactHTMLToken& token)
    6565{
    6666    // FIXME: This is copied from HTMLTreeBuilder::processTokenInForeignContent and changed to use threadSafeMatch.
     
    113113}
    114114
     115static bool tokenExitsSVG(const CompactHTMLToken& token)
     116{
     117    const String& tagName = token.data();
     118    return equalIgnoringCase(tagName, SVGNames::foreignObjectTag.localName());
     119}
     120
     121static bool tokenExitsMath(const CompactHTMLToken& token)
     122{
     123    // FIXME: This is copied from HTMLElementStack::isMathMLTextIntegrationPoint and changed to use threadSafeMatch.
     124    const String& tagName = token.data();
     125    return threadSafeMatch(tagName, MathMLNames::miTag)
     126        || threadSafeMatch(tagName, MathMLNames::moTag)
     127        || threadSafeMatch(tagName, MathMLNames::mnTag)
     128        || threadSafeMatch(tagName, MathMLNames::msTag)
     129        || threadSafeMatch(tagName, MathMLNames::mtextTag);
     130}
     131
    115132static const size_t pendingTokenLimit = 1000;
    116133
     
    180197        if (inForeignContent() && tokenExitsForeignContent(token))
    181198            m_namespaceStack.removeLast();
    182         // FIXME: Support tags that exit MathML.
    183         if (m_namespaceStack.last() == SVG && equalIgnoringCase(tagName, SVGNames::foreignObjectTag.localName()))
     199        if ((m_namespaceStack.last() == SVG && tokenExitsSVG(token))
     200            || (m_namespaceStack.last() == MathML && tokenExitsMath(token)))
    184201            m_namespaceStack.append(HTML);
    185202        if (!inForeignContent()) {
     
    203220    if (token.type() == HTMLToken::EndTag) {
    204221        const String& tagName = token.data();
    205         // FIXME: Support tags that exit MathML.
    206222        if ((m_namespaceStack.last() == SVG && threadSafeMatch(tagName, SVGNames::svgTag))
    207223            || (m_namespaceStack.last() == MathML && threadSafeMatch(tagName, MathMLNames::mathTag))
    208             || (m_namespaceStack.contains(SVG) && m_namespaceStack.last() == HTML && equalIgnoringCase(tagName, SVGNames::foreignObjectTag.localName())))
     224            || (m_namespaceStack.contains(SVG) && m_namespaceStack.last() == HTML && tokenExitsSVG(token))
     225            || (m_namespaceStack.contains(MathML) && m_namespaceStack.last() == HTML && tokenExitsMath(token)))
    209226            m_namespaceStack.removeLast();
    210227        if (threadSafeMatch(tagName, scriptTag)) {
     
    215232    }
    216233
    217     // FIXME: Need to set setForceNullCharacterReplacement based on m_inForeignContent as well.
     234    // FIXME: Also setForceNullCharacterReplacement when in text mode.
     235    m_tokenizer->setForceNullCharacterReplacement(inForeignContent());
    218236    m_tokenizer->setShouldAllowCDATA(inForeignContent());
    219237    return true;
Note: See TracChangeset for help on using the changeset viewer.