Changeset 112023 in webkit
- Timestamp:
- Mar 24, 2012, 9:24:36 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/css/stylesheet-candidate-nodes-crash-expected.txt (modified) (1 diff)
-
LayoutTests/fast/css/stylesheet-candidate-nodes-crash.xhtml (modified) (1 diff)
-
LayoutTests/fast/dom/xml-parser-error-message-crash-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/xml/XMLErrors.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r112022 r112023 1 2012-03-24 Jeffrey Pfau <jpfau@apple.com> 2 3 XML error document creation should not fire mutation events 4 https://bugs.webkit.org/show_bug.cgi?id=80765 5 6 Reviewed by Adam Barth. 7 8 Fixed tests that relied on old behavior. 9 10 * fast/css/stylesheet-candidate-nodes-crash-expected.txt: 11 * fast/css/stylesheet-candidate-nodes-crash.xhtml: 12 * fast/dom/xml-parser-error-message-crash-expected.txt: 13 1 14 2012-03-24 Florin Malita <fmalita@google.com> 2 15 -
trunk/LayoutTests/fast/css/stylesheet-candidate-nodes-crash-expected.txt
r77262 r112023 1 This page contains the following errors:2 3 error on line 29 at column 9: Comment not terminated4 error on line 32 at column 1: Comment not terminated5 Below is a rendering of the page up to the first error.6 7 1 PASS -
trunk/LayoutTests/fast/css/stylesheet-candidate-nodes-crash.xhtml
r77262 r112023 8 8 layoutTestController.waitUntilDone(); 9 9 } 10 10 11 11 function runTest() 12 12 { 13 13 document.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'style')[0]; 14 if (document.body) 14 if (document.body) { 15 15 document.body.innerHTML = "PASS"; 16 17 if (window.layoutTestController)18 layoutTestController.notifyDone();16 if (window.layoutTestController) 17 layoutTestController.notifyDone(); 18 } 19 19 } 20 20 </script> 21 21 <svg:style> 22 22 <xht:caption> 23 <xht:iframe onload="runTest();"></xht:iframe> 23 <xht:iframe onload="runTest();"></xht:iframe> 24 24 <style></style> 25 25 </xht:caption> -
trunk/LayoutTests/fast/dom/xml-parser-error-message-crash-expected.txt
r87737 r112023 1 PASS 1 This page contains the following errors: 2 3 error on line 14 at column 1: Extra content at the end of the document 4 Below is a rendering of the page up to the first error. 5 6 -
trunk/Source/WebCore/ChangeLog
r112022 r112023 1 2012-03-24 Jeffrey Pfau <jpfau@apple.com> 2 3 XML error document creation should not fire mutation events 4 https://bugs.webkit.org/show_bug.cgi?id=80765 5 6 Reviewed by Adam Barth. 7 8 Broke two tests that expected the old behavior, which have now been updated. 9 10 * xml/XMLErrors.cpp: 11 (WebCore::createXHTMLParserErrorHeader): 12 (WebCore::XMLErrors::insertErrorMessageBlock): 13 1 14 2012-03-24 Florin Malita <fmalita@google.com> 2 15 -
trunk/Source/WebCore/xml/XMLErrors.cpp
r95901 r112023 88 88 } 89 89 90 static inline RefPtr<Element> createXHTMLParserErrorHeader(Document* doc, const String& errorMessages)90 static inline PassRefPtr<Element> createXHTMLParserErrorHeader(Document* doc, const String& errorMessages) 91 91 { 92 RefPtr<Element> reportElement = doc->createElement(QualifiedName(nullAtom, "parsererror", xhtmlNamespaceURI), false); 93 reportElement->setAttribute(styleAttr, "display: block; white-space: pre; border: 2px solid #c77; padding: 0 1em 0 1em; margin: 1em; background-color: #fdd; color: black"); 92 RefPtr<Element> reportElement = doc->createElement(QualifiedName(nullAtom, "parsererror", xhtmlNamespaceURI), true); 94 93 95 ExceptionCode ec = 0; 96 RefPtr<Element> h3 = doc->createElement(h3Tag, false); 97 reportElement->appendChild(h3.get(), ec); 98 h3->appendChild(doc->createTextNode("This page contains the following errors:"), ec); 94 OwnPtr<AttributeVector> reportAttributes = AttributeVector::create(); 95 reportAttributes->append(Attribute::create(styleAttr, "display: block; white-space: pre; border: 2px solid #c77; padding: 0 1em 0 1em; margin: 1em; background-color: #fdd; color: black")); 96 reportElement->parserSetAttributes(reportAttributes.release(), FragmentScriptingNotAllowed); 99 97 100 RefPtr<Element> fixed = doc->createElement(divTag, false); 101 reportElement->appendChild(fixed.get(), ec); 102 fixed->setAttribute(styleAttr, "font-family:monospace;font-size:12px"); 103 fixed->appendChild(doc->createTextNode(errorMessages), ec); 98 RefPtr<Element> h3 = doc->createElement(h3Tag, true); 99 reportElement->parserAddChild(h3.get()); 100 h3->parserAddChild(doc->createTextNode("This page contains the following errors:")); 104 101 105 h3 = doc->createElement(h3Tag, false); 106 reportElement->appendChild(h3.get(), ec); 107 h3->appendChild(doc->createTextNode("Below is a rendering of the page up to the first error."), ec); 102 RefPtr<Element> fixed = doc->createElement(divTag, true); 103 OwnPtr<AttributeVector> fixedAttributes = AttributeVector::create(); 104 fixedAttributes->append(Attribute::create(styleAttr, "font-family:monospace;font-size:12px")); 105 fixed->parserSetAttributes(fixedAttributes.release(), FragmentScriptingNotAllowed); 106 reportElement->parserAddChild(fixed.get()); 108 107 109 return reportElement; 108 fixed->parserAddChild(doc->createTextNode(errorMessages)); 109 110 h3 = doc->createElement(h3Tag, true); 111 reportElement->parserAddChild(h3.get()); 112 h3->parserAddChild(doc->createTextNode("Below is a rendering of the page up to the first error.")); 113 114 return reportElement.release(); 110 115 } 111 116 … … 117 122 118 123 // Create elements for display 119 ExceptionCode ec = 0;120 124 RefPtr<Element> documentElement = m_document->documentElement(); 121 125 if (!documentElement) { 122 RefPtr<Element> rootElement = m_document->createElement(htmlTag, false); 123 m_document->appendChild(rootElement, ec); 124 RefPtr<Element> body = m_document->createElement(bodyTag, false); 125 rootElement->appendChild(body, ec); 126 RefPtr<Element> rootElement = m_document->createElement(htmlTag, true); 127 RefPtr<Element> body = m_document->createElement(bodyTag, true); 128 rootElement->parserAddChild(body); 129 m_document->parserAddChild(rootElement); 130 if (m_document->attached() && !rootElement->attached()) 131 rootElement->attach(); 126 132 documentElement = body.get(); 127 133 } 128 134 #if ENABLE(SVG) 129 135 else if (documentElement->namespaceURI() == SVGNames::svgNamespaceURI) { 130 RefPtr<Element> rootElement = m_document->createElement(htmlTag, false); 131 RefPtr<Element> body = m_document->createElement(bodyTag, false); 132 rootElement->appendChild(body, ec); 133 body->appendChild(documentElement, ec); 134 m_document->appendChild(rootElement.get(), ec); 136 RefPtr<Element> rootElement = m_document->createElement(htmlTag, true); 137 RefPtr<Element> body = m_document->createElement(bodyTag, true); 138 rootElement->parserAddChild(body); 139 140 documentElement->parentNode()->parserRemoveChild(documentElement.get()); 141 if (documentElement->attached()) 142 documentElement->detach(); 143 144 body->parserAddChild(documentElement); 145 m_document->parserAddChild(rootElement.get()); 146 147 if (m_document->attached()) { 148 // rootElement shouldn't be attached right now, but in some cases might be. 149 // See https://bugs.webkit.org/show_bug.cgi?id=81985 150 rootElement->reattach(); 151 } 152 135 153 documentElement = body.get(); 136 154 } 137 155 #endif 156 138 157 String errorMessages = m_errorMessages.toString(); 139 158 RefPtr<Element> reportElement = createXHTMLParserErrorHeader(m_document, errorMessages); 140 documentElement->insertBefore(reportElement, documentElement->firstChild(), ec); 159 141 160 #if ENABLE(XSLT) 142 161 if (m_document->transformSourceDocument()) { 143 RefPtr<Element> paragraph = m_document->createElement(pTag, false); 144 paragraph->setAttribute(styleAttr, "white-space: normal"); 145 paragraph->appendChild(m_document->createTextNode("This document was created as the result of an XSL transformation. The line and column numbers given are from the transformed result."), ec); 146 reportElement->appendChild(paragraph.release(), ec); 162 OwnPtr<AttributeVector> attributes = AttributeVector::create(); 163 attributes->append(Attribute::create(styleAttr, "white-space: normal")); 164 RefPtr<Element> paragraph = m_document->createElement(pTag, true); 165 paragraph->parserSetAttributes(attributes.release(), FragmentScriptingNotAllowed); 166 paragraph->parserAddChild(m_document->createTextNode("This document was created as the result of an XSL transformation. The line and column numbers given are from the transformed result.")); 167 reportElement->parserAddChild(paragraph.release()); 147 168 } 148 169 #endif 170 171 Node* firstChild = documentElement->firstChild(); 172 if (firstChild) 173 documentElement->parserInsertBefore(reportElement, documentElement->firstChild()); 174 else 175 documentElement->parserAddChild(reportElement); 176 177 if (documentElement->attached() && !reportElement->attached()) 178 reportElement->attach(); 179 149 180 m_document->updateStyleIfNeeded(); 150 181 }
Note:
See TracChangeset
for help on using the changeset viewer.