Changeset 103106 in webkit
- Timestamp:
- Dec 16, 2011 2:16:41 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 13 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r103105 r103106 1 2011-12-16 Jarred Nicholls <jarred@sencha.com> 2 3 Support HTML documents in XHR.responseXML 4 https://bugs.webkit.org/show_bug.cgi?id=74626 5 6 Latest W3C XHR spec details for the responseXML attribute: 7 http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-responsexml-attribute 8 http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#document-response-entity-body 9 10 XHR.responseXML was not compliant per the latest editor's draft of the XHR spec. 11 The following compliance issue have been corrected: 12 - A responseType of "text" should disallow access to responseXML by throwing an InvalidState exception. 13 - When the error flag is toggled, responseXML should return "null" immediately and not attempt to create a new Document. 14 - responseXML should return a valid HTML document when the MIME type is "text/html", but only when the caller has 15 explicitly set responseType to "document". 16 17 Reviewed by Alexey Proskuryakov. 18 19 * fast/frames/iframe-reparenting.html: 20 * fast/xmlhttprequest/resources/xmlhttprequest-get-invalid-data.xml: Added. 21 * fast/xmlhttprequest/xmlhttprequest-responseXML-html-document-responsetype-quirks-expected.txt: Added. 22 * fast/xmlhttprequest/xmlhttprequest-responseXML-html-document-responsetype-quirks.html: Added. 23 * fast/xmlhttprequest/xmlhttprequest-responseXML-html-document-responsetype-strict-expected.txt: Added. 24 * fast/xmlhttprequest/xmlhttprequest-responseXML-html-document-responsetype-strict.html: Added. 25 * fast/xmlhttprequest/xmlhttprequest-responseXML-html-no-responsetype-expected.txt: Added. 26 * fast/xmlhttprequest/xmlhttprequest-responseXML-html-no-responsetype.html: Added. 27 * fast/xmlhttprequest/xmlhttprequest-responseXML-invalid-xml-expected.txt: Added. 28 * fast/xmlhttprequest/xmlhttprequest-responseXML-invalid-xml.html: Added. 29 * fast/xmlhttprequest/xmlhttprequest-responseXML-xml-document-responsetype-expected.txt: Added. 30 * fast/xmlhttprequest/xmlhttprequest-responseXML-xml-document-responsetype.html: Added. 31 * fast/xmlhttprequest/xmlhttprequest-responseXML-xml-text-responsetype-expected.txt: Added. 32 * fast/xmlhttprequest/xmlhttprequest-responseXML-xml-text-responsetype.html: Added. 33 1 34 2011-12-16 Adrienne Walker <enne@google.com> 2 35 -
trunk/LayoutTests/fast/frames/iframe-reparenting.html
r82713 r103106 64 64 // Last test - verify that non-attached document does not keep iframe alive even if adoptNode() is used. 65 65 var xhr = new XMLHttpRequest(); 66 xhr.open("GET","data: text/html,<html xmlns='http://www.w3.org/1999/xhtml'><body id='body'>Hello</body></html>", false);66 xhr.open("GET","data:application/xhtml+xml,<html xmlns='http://www.w3.org/1999/xhtml'><body id='body'>Hello</body></html>", false); 67 67 xhr.send(null); 68 68 var doc = xhr.responseXML; -
trunk/Source/WebCore/ChangeLog
r103104 r103106 1 2011-12-16 Jarred Nicholls <jarred@sencha.com> 2 3 Support HTML documents in XHR.responseXML 4 https://bugs.webkit.org/show_bug.cgi?id=74626 5 6 Latest W3C XHR spec details for the responseXML attribute: 7 http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-responsexml-attribute 8 http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#document-response-entity-body 9 10 XHR.responseXML was not compliant per the latest editor's draft of the XHR spec. 11 The following compliance issue have been corrected: 12 - A responseType of "text" should disallow access to responseXML by throwing an InvalidState exception. 13 - When the error flag is toggled, responseXML should return "null" immediately and not attempt to create a new Document. 14 - responseXML should return a valid HTML document when the MIME type is "text/html", but only when the caller has 15 explicitly set responseType to "document". 16 17 Reviewed by Alexey Proskuryakov. 18 19 Tests: fast/xmlhttprequest/xmlhttprequest-responseXML-html-document-responsetype-quirks.html 20 fast/xmlhttprequest/xmlhttprequest-responseXML-html-document-responsetype-strict.html 21 fast/xmlhttprequest/xmlhttprequest-responseXML-html-no-responsetype.html 22 fast/xmlhttprequest/xmlhttprequest-responseXML-invalid-xml.html 23 fast/xmlhttprequest/xmlhttprequest-responseXML-xml-document-responsetype.html 24 fast/xmlhttprequest/xmlhttprequest-responseXML-xml-text-responsetype.html 25 26 * xml/XMLHttpRequest.cpp: 27 (WebCore::XMLHttpRequest::responseXML): 28 (WebCore::XMLHttpRequest::clearResponseBuffers): 29 * xml/XMLHttpRequest.h: Rename m_responseXML to m_responseDocument 30 (WebCore::XMLHttpRequest::optionalResponseXML): 31 1 32 2011-12-16 Ryosuke Niwa <rniwa@webkit.org> 2 33 -
trunk/Source/WebCore/xml/XMLHttpRequest.cpp
r102665 r103106 28 28 #include "DOMFormData.h" 29 29 #include "DOMImplementation.h" 30 #include "Document.h"31 30 #include "Event.h" 32 31 #include "EventException.h" … … 35 34 #include "ExceptionCode.h" 36 35 #include "File.h" 36 #include "HTMLDocument.h" 37 37 #include "HTTPParsers.h" 38 38 #include "HTTPValidation.h" … … 216 216 Document* XMLHttpRequest::responseXML(ExceptionCode& ec) 217 217 { 218 if (m_responseTypeCode != ResponseTypeDefault && m_responseTypeCode != ResponseType Text && m_responseTypeCode != ResponseTypeDocument) {218 if (m_responseTypeCode != ResponseTypeDefault && m_responseTypeCode != ResponseTypeDocument) { 219 219 ec = INVALID_STATE_ERR; 220 220 return 0; 221 221 } 222 222 223 if (m_ state != DONE)223 if (m_error || m_state != DONE) 224 224 return 0; 225 225 226 226 if (!m_createdDocument) { 227 if ((m_response.isHTTP() && !responseIsXML()) || scriptExecutionContext()->isWorkerContext()) { 228 // The W3C spec requires this. 229 m_responseXML = 0; 227 bool isHTML = equalIgnoringCase(responseMIMEType(), "text/html"); 228 229 // The W3C spec requires the final MIME type to be some valid XML type, or text/html. 230 // If it is text/html, then the responseType of "document" must have been supplied explicitly. 231 if ((m_response.isHTTP() && !responseIsXML() && !isHTML) 232 || (isHTML && m_responseTypeCode == ResponseTypeDefault) 233 || scriptExecutionContext()->isWorkerContext()) { 234 m_responseDocument = 0; 230 235 } else { 231 m_responseXML = Document::create(0, m_url); 236 if (isHTML) 237 m_responseDocument = HTMLDocument::create(0, m_url); 238 else 239 m_responseDocument = Document::create(0, m_url); 232 240 // FIXME: Set Last-Modified. 233 m_response XML->setContent(m_responseBuilder.toStringPreserveCapacity());234 m_response XML->setSecurityOrigin(securityOrigin());235 if (!m_response XML->wellFormed())236 m_response XML= 0;241 m_responseDocument->setContent(m_responseBuilder.toStringPreserveCapacity()); 242 m_responseDocument->setSecurityOrigin(securityOrigin()); 243 if (!m_responseDocument->wellFormed()) 244 m_responseDocument = 0; 237 245 } 238 246 m_createdDocument = true; 239 247 } 240 248 241 return m_response XML.get();249 return m_responseDocument.get(); 242 250 } 243 251 … … 741 749 m_responseBuilder.clear(); 742 750 m_createdDocument = false; 743 m_response XML= 0;751 m_responseDocument = 0; 744 752 #if ENABLE(XHR_RESPONSE_BLOB) 745 753 m_responseBlob = 0; -
trunk/Source/WebCore/xml/XMLHttpRequest.h
r102665 r103106 105 105 String responseText(ExceptionCode&); 106 106 Document* responseXML(ExceptionCode&); 107 Document* optionalResponseXML() const { return m_response XML.get(); }107 Document* optionalResponseXML() const { return m_responseDocument.get(); } 108 108 #if ENABLE(XHR_RESPONSE_BLOB) 109 109 Blob* responseBlob(ExceptionCode&) const; … … 207 207 StringBuilder m_responseBuilder; 208 208 mutable bool m_createdDocument; 209 mutable RefPtr<Document> m_response XML;209 mutable RefPtr<Document> m_responseDocument; 210 210 211 211 RefPtr<SharedBuffer> m_binaryResponseBuilder;
Note: See TracChangeset
for help on using the changeset viewer.