Changeset 84899 in webkit


Ignore:
Timestamp:
Apr 26, 2011 2:57:11 AM (13 years ago)
Author:
leo.yang@torchmobile.com.cn
Message:

2011-04-26 Leo Yang <leo.yang@torchmobile.com.cn>

Reviewed by Nikolas Zimmermann.

ASSERT failure in SVGUseElement
https://bugs.webkit.org/show_bug.cgi?id=59313

Test case to verify webkit doesn't crash when a <use> element
is pending on resource and the document is not well-formed.
Test passes if no crash occurs in debug mode.

  • svg/custom/use-crash-in-non-wellformed-document-expected.txt: Added.
  • svg/custom/use-crash-in-non-wellformed-document.svg: Added.

2011-04-26 Leo Yang <leo.yang@torchmobile.com.cn>

Reviewed by Nikolas Zimmermann.

ASSERT failure in SVGUseElement
https://bugs.webkit.org/show_bug.cgi?id=59313

In SVGUseElement::insertedIntoDocument(), ASSERT(!m_isPendingResource)
was wrong because the document may not be well-formed.

This patch asserts the element is not pending on resource or the
document is not well-formed.

Test: svg/custom/use-crash-in-non-wellformed-document.svg

  • svg/SVGUseElement.cpp: (WebCore::isWellFormedDocument): (WebCore::SVGUseElement::insertedIntoDocument):
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r84897 r84899  
     12011-04-26  Leo Yang  <leo.yang@torchmobile.com.cn>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        ASSERT failure in SVGUseElement
     6        https://bugs.webkit.org/show_bug.cgi?id=59313
     7
     8        Test case to verify webkit doesn't crash when a <use> element
     9        is pending on resource and the document is not well-formed.
     10        Test passes if no crash occurs in debug mode.
     11
     12        * svg/custom/use-crash-in-non-wellformed-document-expected.txt: Added.
     13        * svg/custom/use-crash-in-non-wellformed-document.svg: Added.
     14
    1152011-04-26  Chang Shu  <cshu@webkit.org>
    216
  • trunk/Source/WebCore/ChangeLog

    r84898 r84899  
     12011-04-26  Leo Yang  <leo.yang@torchmobile.com.cn>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        ASSERT failure in SVGUseElement
     6        https://bugs.webkit.org/show_bug.cgi?id=59313
     7
     8        In SVGUseElement::insertedIntoDocument(), ASSERT(!m_isPendingResource)
     9        was wrong because the document may not be well-formed.
     10
     11        This patch asserts the element is not pending on resource or the
     12        document is not well-formed.
     13
     14        Test: svg/custom/use-crash-in-non-wellformed-document.svg
     15
     16        * svg/SVGUseElement.cpp:
     17        (WebCore::isWellFormedDocument):
     18        (WebCore::SVGUseElement::insertedIntoDocument):
     19
    1202011-04-26  Mikhail Naganov  <mnaganov@chromium.org>
    221
  • trunk/Source/WebCore/svg/SVGUseElement.cpp

    r84871 r84899  
    128128}
    129129
     130static inline bool isWellFormedDocument(Document* document)
     131{
     132    if (document->isSVGDocument() || document->isXHTMLDocument())
     133        return static_cast<XMLDocumentParser*>(document->parser())->wellFormed();
     134    return true;
     135}
     136
    130137void SVGUseElement::insertedIntoDocument()
    131138{
    132139    // This functions exists to assure assumptions made in the code regarding SVGElementInstance creation/destruction are satisfied.
    133140    SVGStyledTransformableElement::insertedIntoDocument();
    134     ASSERT(!m_targetElementInstance || ((document()->isSVGDocument() || document()->isXHTMLDocument()) && !static_cast<XMLDocumentParser*>(document()->parser())->wellFormed()));
    135     ASSERT(!m_isPendingResource);
     141    ASSERT(!m_targetElementInstance || !isWellFormedDocument(document()));
     142    ASSERT(!m_isPendingResource || !isWellFormedDocument(document()));
    136143}
    137144
Note: See TracChangeset for help on using the changeset viewer.