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):
2011-04-25 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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84864
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-04-25 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-25 Mihai Parparita <mihaip@chromium.org>
Reviewed by Tony Chang.
--- /dev/null
+This page contains the following errors:
+
+error on line 8 at column 6: Opening and ending tag mismatch.
+Below is a rendering of the page up to the first error.
+
+
--- /dev/null
+<?xml version="1.0" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="400" height="400">
+ <script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+ </script>
+ <use xlink:href="#undefined">
+</svg>
+2011-04-25 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):
+
2011-04-25 Igor Oliveira <igor.oliveira@openbossa.org>
Reviewed by Tony Chang.
}
}
+static inline bool isWellFormedDocument(Document* document)
+{
+ if (document->isSVGDocument() || document->isXHTMLDocument())
+ return static_cast<XMLDocumentParser*>(document->parser())->wellFormed();
+ return true;
+}
+
void SVGUseElement::insertedIntoDocument()
{
// This functions exists to assure assumptions made in the code regarding SVGElementInstance creation/destruction are satisfied.
SVGStyledTransformableElement::insertedIntoDocument();
- ASSERT(!m_targetElementInstance || ((document()->isSVGDocument() || document()->isXHTMLDocument()) && !static_cast<XMLDocumentParser*>(document()->parser())->wellFormed()));
- ASSERT(!m_isPendingResource);
+ ASSERT(!m_targetElementInstance || !isWellFormedDocument(document()));
+ ASSERT(!m_isPendingResource || !isWellFormedDocument(document()));
}
void SVGUseElement::removedFromDocument()