Changeset 103675 in webkit
- Timestamp:
- Dec 25, 2011, 8:02:21 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r103661 r103675 1 2011-12-24 Jarred Nicholls <[email protected]> 2 3 Allow XMLHttpRequest responseType to be set at any state up to and including HEADERS_RECEIVED 4 https://bugs.webkit.org/show_bug.cgi?id=75190 5 6 Reviewed by Alexey Proskuryakov. 7 8 * fast/xmlhttprequest/xmlhttprequest-responsetype-before-open-expected.txt: Added. 9 * fast/xmlhttprequest/xmlhttprequest-responsetype-before-open-sync-request-expected.txt: Added. 10 * fast/xmlhttprequest/xmlhttprequest-responsetype-before-open-sync-request.html: Added. 11 Validate that calls to open() for synchronous HTTP(S) requests from the window context will 12 properly fail when responseType has been previously set to a non-default value. 13 * fast/xmlhttprequest/xmlhttprequest-responsetype-before-open.html: Added. 14 Validate that XMLHttpRequest.responseType can be set prior to a call to open(). 15 * fast/xmlhttprequest/xmlhttprequest-responsetype-set-at-headers-received-expected.txt: Added. 16 * fast/xmlhttprequest/xmlhttprequest-responsetype-set-at-headers-received.html: Added. 17 Validate that XMLHttpRequest.responseType can be set at the HEADERS_RECEIVED state, but 18 no state later than that. 19 1 20 2011-12-24 Jarred Nicholls <[email protected]> 2 21 -
trunk/Source/WebCore/ChangeLog
r103673 r103675 1 2011-12-24 Jarred Nicholls <[email protected]> 2 3 Allow XMLHttpRequest responseType to be set at any state up to and including HEADERS_RECEIVED 4 https://bugs.webkit.org/show_bug.cgi?id=75190 5 6 XMLHttpRequest.responseType should be modifiable at any state up to and including the 7 HEADERS_RECEIVED state. Therefore, subsequent calls to open() should not reset responseType 8 to its default value, and calls to open() must follow the same spec mandate set forth in 9 setResponseType() for synchronous HTTP(S) requests made from the window context. 10 11 Reviewed by Alexey Proskuryakov. 12 13 Tests: fast/xmlhttprequest/xmlhttprequest-responsetype-before-open-sync-request.html 14 fast/xmlhttprequest/xmlhttprequest-responsetype-before-open.html 15 fast/xmlhttprequest/xmlhttprequest-responsetype-set-at-headers-received.html 16 17 * xml/XMLHttpRequest.cpp: 18 (WebCore::XMLHttpRequest::setResponseType): 19 Prevent setting the value only when in LOADING and DONE states. No longer check if 20 m_loader is present, which is instantiated on a call to send(), because responseType 21 can be safely changed after a request is sent. 22 (WebCore::XMLHttpRequest::open): 23 Do not reset m_responseTypeCode to the default value, and prevent calls to open() 24 for synchronous HTTP(S) requests made from the window context when m_responseTypeCode 25 is not the default value. 26 1 27 2011-12-25 Sam Weinig <[email protected]> 2 28 -
trunk/Source/WebCore/xml/XMLHttpRequest.cpp
r103661 r103675 293 293 void XMLHttpRequest::setResponseType(const String& responseType, ExceptionCode& ec) 294 294 { 295 if (m_state != OPENED || m_loader) {295 if (m_state >= LOADING) { 296 296 ec = INVALID_STATE_ERR; 297 297 return; … … 435 435 m_state = UNSENT; 436 436 m_error = false; 437 m_responseTypeCode = ResponseTypeDefault;438 437 m_uploadComplete = false; 439 438 … … 457 456 // FIXME: Should this be throwing an exception? 458 457 ec = SECURITY_ERR; 458 return; 459 } 460 461 // Newer functionality is not available to synchronous requests in window contexts, as a spec-mandated 462 // attempt to discourage synchronous XHR use. responseType is one such piece of functionality. 463 // We'll only disable this functionality for HTTP(S) requests since sync requests for local protocols 464 // such as file: and data: still make sense to allow. 465 if (!async && scriptExecutionContext()->isDocument() && url.protocolIsInHTTPFamily() && m_responseTypeCode != ResponseTypeDefault) { 466 logConsoleError(scriptExecutionContext(), "Synchronous HTTP(S) requests made from the window context cannot have XMLHttpRequest.responseType set."); 467 ec = INVALID_ACCESS_ERR; 459 468 return; 460 469 }
Note:
See TracChangeset
for help on using the changeset viewer.